2017-10-18 18 views
0

인터넷 에서뿐만 아니라 Stack Overflow에서도 찾아 보았습니다. 그러나 많은 사람들이이 주제를 다뤘지만 필자는이를 효과적으로 수행하는 방법을 모르겠습니다.CSS3 font-face 구식 브라우저 호환성 + 로컬 글꼴

가능한 한 최대한의 호환성 범위로 CSS3 글꼴 - 페이스를 사용하여 사용 된 웹 글꼴이 이미 장치에 설치되어 있는지 확인합니다. 그런 다음 브라우저가 다운로드하는 대신 사용하도록하십시오.

이것은 내 시도입니다. 물론 예상대로 작동하지 않습니다. 예를 들어 Firefox는 내 webfont의 woff2 버전을 다운로드합니다.

@font-face{ 
    font-family: mplus-1c; 
    src: local('M+ 1c regular'), 
     local ('mplus-1c-regular'); 
    src: url('../fonts/mplus-1c-regular-webfont.eot'); 
    src: url('../fonts/mplus-1c-regular-webfont.eot?#iefix') format('embedded-opentype'), 
     url('../fonts/mplus-1c-regular-webfont.woff2') format('woff2'), 
     url('../fonts/mplus-1c-regular-webfont.woff') format('woff'), 
     url('../fonts/mplus-1c-regular-webfont.ttf') format('truetype'), 
     url('../fonts/mplus-1c-regular-webfont.svg#m_1cregular') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 
+0

브라우저는 하나의'src' 속성을 사용하므로 귀하의 예제에서 처음 두를 무시합니다 : 여기에 올바른 코드는, '이 요약합니다. 대신에'src : local (font), url (webfont);'를 사용하십시오. 또한 [@ font-face src : local - 사용자가 이미 가지고있는 경우 로컬 글꼴을 사용하는 방법?] (https://stackoverflow.com/q/3837249/1016716) –

+0

? #fix 부분과 함께? – matteobin

+0

다른 모든 IE 변형의 함정에 그다지 능숙하지는 않지만 잘 작동하는지 확인하려면 #iffixed를 먼저 배치하고 로컬 및 새로운 형식을 따르는 것이 좋습니다. 그런 다음 이전 IE는 로컬 글꼴이 있더라도 eot를로드하지만 적어도 중단되지는 않습니다. –

답변

0

Mr Lister는 절대적으로 옳습니다!

local ('mplus-1c-regular'); 

하는 했어야

local('mplus-1c-regular'); 

바보 나 : 는 또한 내가 작업에서 자신의 제안을 방지 아주 바보 같은 구문 오류를 발견했습니다.

다시 고마워, 리스터!

@font-face{ 
    font-family: mplus-1c; 
    src: url('../fonts/mplus-1c-regular-webfont.eot'); 
    src: url('../fonts/mplus-1c-regular-webfont.eot?#iefix') format('embedded-opentype'), 
     local('M+ 1c regular'), 
     local('mplus-1c-regular'), 
     url('../fonts/mplus-1c-regular-webfont.woff2') format('woff2'), 
     url('../fonts/mplus-1c-regular-webfont.woff') format('woff'), 
     url('../fonts/mplus-1c-regular-webfont.ttf') format('truetype'), 
     url('../fonts/mplus-1c-regular-webfont.svg#m_1cregular') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
}