@@ -826,6 +826,96 @@ const ConfigModal = () => {
826826 return ! ! document . getElementById ( "fad-lyrics-plus-container" ) ;
827827 } , [ ] ) ;
828828
829+ // 컴포넌트 마운트 시 저장된 폰트 설정 로드 및 Google Font 링크 추가
830+ react . useEffect ( ( ) => {
831+ const loadFont = ( fontFamily , linkId ) => {
832+ console . log ( `[Lyrics Plus] Attempting to load font: ${ fontFamily } (${ linkId } )` ) ;
833+ if ( fontFamily && GOOGLE_FONTS . includes ( fontFamily ) ) {
834+ let link = document . getElementById ( linkId ) ;
835+ if ( ! link ) {
836+ link = document . createElement ( "link" ) ;
837+ link . id = linkId ;
838+ link . rel = "stylesheet" ;
839+ document . head . appendChild ( link ) ;
840+ console . log ( `[Lyrics Plus] Created new link element for: ${ fontFamily } ` ) ;
841+ }
842+ if ( fontFamily === "Pretendard Variable" ) {
843+ link . href = "https://cdn.jsdelivr.net/gh/orioncactus/[email protected] /dist/web/variable/pretendardvariable.min.css" ; 844+ } else {
845+ link . href = `https://fonts.googleapis.com/css2?family=${ fontFamily . replace ( / / g, "+" ) } :wght@100;200;300;400;500;600;700;800;900&display=swap` ;
846+ }
847+ console . log ( `[Lyrics Plus] Font link href set to: ${ link . href } ` ) ;
848+ } else {
849+ console . log ( `[Lyrics Plus] Font ${ fontFamily } not in GOOGLE_FONTS list or invalid` ) ;
850+ }
851+ } ;
852+
853+ // 기본 폰트 로드 (separate-fonts가 false일 때 사용)
854+ const baseFont = CONFIG . visual [ "font-family" ] ;
855+ console . log ( `[Lyrics Plus] Base font from CONFIG: ${ baseFont } ` ) ;
856+ loadFont ( baseFont , "lyrics-plus-google-font-base" ) ;
857+
858+ // 원문 폰트 로드
859+ const originalFont = CONFIG . visual [ "original-font-family" ] ;
860+ console . log ( `[Lyrics Plus] Original font from CONFIG: ${ originalFont } ` ) ;
861+ loadFont ( originalFont , "lyrics-plus-google-font-original" ) ;
862+
863+ // 발음 폰트 로드
864+ const phoneticFont = CONFIG . visual [ "phonetic-font-family" ] ;
865+ console . log ( `[Lyrics Plus] Phonetic font from CONFIG: ${ phoneticFont } ` ) ;
866+ loadFont ( phoneticFont , "lyrics-plus-google-font-phonetic" ) ;
867+
868+ // 번역 폰트 로드
869+ const translationFont = CONFIG . visual [ "translation-font-family" ] ;
870+ console . log ( `[Lyrics Plus] Translation font from CONFIG: ${ translationFont } ` ) ;
871+ loadFont ( translationFont , "lyrics-plus-google-font-translation" ) ;
872+ } , [ ] ) ;
873+
874+ // 외관 탭으로 전환될 때 미리보기 폰트 강제 업데이트
875+ react . useEffect ( ( ) => {
876+ if ( activeTab === "appearance" ) {
877+ console . log ( `[Lyrics Plus] Appearance tab activated, updating preview fonts` ) ;
878+ // 약간의 지연을 주어 DOM이 렌더링된 후 실행
879+ setTimeout ( ( ) => {
880+ const lyricsPreview = document . getElementById ( "lyrics-preview" ) ;
881+ const phoneticPreview = document . getElementById ( "phonetic-preview" ) ;
882+ const translationPreview = document . getElementById ( "translation-preview" ) ;
883+
884+ const originalFont = CONFIG . visual [ "original-font-family" ] ;
885+ const phoneticFont = CONFIG . visual [ "phonetic-font-family" ] ;
886+ const translationFont = CONFIG . visual [ "translation-font-family" ] ;
887+
888+ console . log ( `[Lyrics Plus] Fonts - original: ${ originalFont } , phonetic: ${ phoneticFont } , translation: ${ translationFont } ` ) ;
889+
890+ if ( lyricsPreview ) {
891+ // 기본값으로 초기화
892+ lyricsPreview . style . fontFamily = "var(--font-family)" ;
893+ // 짧은 지연 후 실제 폰트 적용
894+ setTimeout ( ( ) => {
895+ console . log ( `[Lyrics Plus] Setting lyrics preview font to: ${ originalFont } ` ) ;
896+ lyricsPreview . style . fontFamily = originalFont || "Pretendard Variable" ;
897+ } , 10 ) ;
898+ }
899+
900+ if ( phoneticPreview ) {
901+ phoneticPreview . style . fontFamily = "var(--font-family)" ;
902+ setTimeout ( ( ) => {
903+ console . log ( `[Lyrics Plus] Setting phonetic preview font to: ${ phoneticFont } ` ) ;
904+ phoneticPreview . style . fontFamily = phoneticFont || "Pretendard Variable" ;
905+ } , 10 ) ;
906+ }
907+
908+ if ( translationPreview ) {
909+ translationPreview . style . fontFamily = "var(--font-family)" ;
910+ setTimeout ( ( ) => {
911+ console . log ( `[Lyrics Plus] Setting translation preview font to: ${ translationFont } ` ) ;
912+ translationPreview . style . fontFamily = translationFont || "Pretendard Variable" ;
913+ } , 10 ) ;
914+ }
915+ } , 50 ) ;
916+ }
917+ } , [ activeTab ] ) ;
918+
829919 const HeaderSection = ( ) => {
830920 return react . createElement (
831921 "div" ,
@@ -911,7 +1001,7 @@ const ConfigModal = () => {
9111001/* 전체 컨테이너 - iOS 18 스타일 */
9121002#${ APP_NAME } -config-container {
9131003 padding: 0;
914- height: 90vh ;
1004+ height: 80vh ;
9151005 display: flex;
9161006 flex-direction: column;
9171007 overflow: hidden;
@@ -966,7 +1056,7 @@ const ConfigModal = () => {
9661056 background: #1c1c1e;
9671057 border: none;
9681058 border-radius: 10px;
969- color: #007aff ;
1059+ color: #ffffffff ;
9701060 cursor: pointer;
9711061 transition: all 0.2s ease;
9721062 font-size: 14px;
@@ -1898,9 +1988,7 @@ const ConfigModal = () => {
18981988 style : {
18991989 fontSize : `${ CONFIG . visual [ "original-font-size" ] || 20 } px` ,
19001990 fontWeight : CONFIG . visual [ "original-font-weight" ] || "400" ,
1901- fontFamily : CONFIG . visual [ "separate-fonts" ]
1902- ? ( CONFIG . visual [ "original-font-family" ] || CONFIG . visual [ "font-family" ] || "var(--font-family)" )
1903- : ( CONFIG . visual [ "font-family" ] || "var(--font-family)" ) ,
1991+ fontFamily : CONFIG . visual [ "original-font-family" ] || "Pretendard Variable" ,
19041992 textAlign : CONFIG . visual [ "alignment" ] || "left" ,
19051993 opacity : ( CONFIG . visual [ "original-opacity" ] || 100 ) / 100 ,
19061994 textShadow : CONFIG . visual [ "text-shadow-enabled" ] ?
@@ -1913,9 +2001,7 @@ const ConfigModal = () => {
19132001 style : {
19142002 fontSize : `${ CONFIG . visual [ "phonetic-font-size" ] || 20 } px` ,
19152003 fontWeight : CONFIG . visual [ "phonetic-font-weight" ] || "400" ,
1916- fontFamily : CONFIG . visual [ "separate-fonts" ]
1917- ? ( CONFIG . visual [ "phonetic-font-family" ] || CONFIG . visual [ "font-family" ] || "var(--font-family)" )
1918- : ( CONFIG . visual [ "font-family" ] || "var(--font-family)" ) ,
2004+ fontFamily : CONFIG . visual [ "phonetic-font-family" ] || "Pretendard Variable" ,
19192005 textAlign : CONFIG . visual [ "alignment" ] || "left" ,
19202006 lineHeight : "1.3" ,
19212007 opacity : ( CONFIG . visual [ "phonetic-opacity" ] || 70 ) / 100 ,
@@ -1931,9 +2017,7 @@ const ConfigModal = () => {
19312017 style : {
19322018 fontSize : `${ CONFIG . visual [ "translation-font-size" ] || 16 } px` ,
19332019 fontWeight : CONFIG . visual [ "translation-font-weight" ] || "400" ,
1934- fontFamily : CONFIG . visual [ "separate-fonts" ]
1935- ? ( CONFIG . visual [ "translation-font-family" ] || CONFIG . visual [ "font-family" ] || "var(--font-family)" )
1936- : ( CONFIG . visual [ "font-family" ] || "var(--font-family)" ) ,
2020+ fontFamily : CONFIG . visual [ "translation-font-family" ] || "Pretendard Variable" ,
19372021 textAlign : CONFIG . visual [ "alignment" ] || "left" ,
19382022 lineHeight : "1.4" ,
19392023 opacity : ( CONFIG . visual [ "translation-opacity" ] || 100 ) / 100 ,
0 commit comments