-
-
Save dstyle0210/93da06b4ca70b23e0f12 to your computer and use it in GitHub Desktop.
나눔고딕 로딩 크로스브라우징 스크립트
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 구글API로 로딩이 되면, | |
| font-family에 대해서 한글이 아닌 Nanum Gothic 으로 적용해야 함. | |
| 그렇게 하지 않으면, 나눔고딕이 미리 깔린 PC에서는 PC용 나눔고딕을 우선시하여 로딩하게 됨. | |
| 본코드의 장점 : 나눔고딕의 중국어가 호환되지 않는 현상 해결. | |
| CSS는 미리 선언 | |
| @import url(https://fonts.googleapis.com/earlyaccess/nanumgothic.css); | |
| html - <head> | |
| */ | |
| (function(){ | |
| var userAgent = navigator.userAgent.toLowerCase(); | |
| if( userAgent.indexOf('safari') != -1 && userAgent.indexOf('version') != -1 ){ | |
| // safari(중문표현 가능한 나눔고딕 폰트로 대체(.ttf, .otf) | |
| document.write('<link href="${cp}/css/webFont.css" rel="stylesheet" type="text/css" />'); | |
| }else{ | |
| document.write('<style type="text/css">@import url(https://fonts.googleapis.com/earlyaccess/nanumgothic.css);</style>'); | |
| } | |
| })(); | |
| /* | |
| webFont.css | |
| @charset "utf-8"; | |
| @font-face{font-family:'Nanum Gothic'; src:url('/asan/css/fonts/NanumGothic.otf')} | |
| @font-face{font-family:'Nanum Gothic'; src:url('/asan/css/fonts/NanumGothic.ttf')} | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment