我在Rails项目中将多个字体重量和样式的单个字体添加到字体。我知道这里的顺序很重要,即。先定义法线,然后粗体,然后斜体,然后斜体粗体。默认情况下错误地使用了最后的字体重量
但是,当我尝试定义正常的第一个然后斜体的第二个时,默认显示在我的网站上的是斜体版本。
fonts.scss
包含:
@font-face {
font-family: 'Sentinel Book';
src: font-url('sentinel-book-webfont.eot');
src: font-url('sentinel-book-webfont.eot?#iefix') format('embedded-opentype'),
font-url('sentinel-book-webfont.woff2') format('woff2'),
font-url('sentinel-book-webfont.woff') format('woff'),
font-url('sentinel-book-webfont.ttf') format('truetype'),
font-url('sentinel-book-webfont.svg#sentinelbook') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'Sentinel Book';
src: font-url('sentinel-bookital-webfont.eot');
src: font-url('sentinel-bookital-webfont.eot?#iefix') format('embedded-opentype'),
font-url('sentinel-bookital-webfont.woff2') format('woff2'),
font-url('sentinel-bookital-webfont.woff') format('woff'),
font-url('sentinel-bookital-webfont.ttf') format('truetype'),
font-url('sentinel-bookital-webfont.svg#sentinelbook_italic') format('svg');
font-style: italic, oblique;
}
$font-family-serif: 'Sentinel Book', sans-serif;
$font-family-base: $font-family-serif;
请注意,我使用的是引导+ SASS并覆盖它们的变量,但我依然看到默认为斜体:
如果我重新排列样式的定义顺序(斜体第一,然后正常),我的文本显示正常。但是,如果我将任何东西斜体化(例如使用<em>
标签),则浏览器将自行斜体化,而不是使用加载的WebFont的斜体版本。
任何提示在这里将不胜感激!
布拉沃。你是我的英雄。 – mattangriffel 2015-01-31 22:36:54