代码之家  ›  专栏  ›  技术社区  ›  bjudson

为什么不在@font face,font Squirrel中定义字体大小或字体样式呢?

  •  13
  • bjudson  · 技术社区  · 15 年前

    How to add multiple font files for the same font?

    @font-face {
        font-family: 'FontinSans';
        src: local('☺'), url('fontin_sans_regular.woff') format('woff');
        font-weight: normal;
        font-style: normal;
    }
    
    @font-face {
        font-family: 'FontinSans';
        src: local('☺'), url('fontin_sans_bold.woff') format('woff');
        font-weight: bold;
        font-style: normal;
    }
    

    @font-face {
        font-family: 'FontinSans';
        src: local('☺'), url('fontin_sans_regular.woff') format('woff');
        font-weight: normal;
        font-style: normal;
    }
    
    @font-face {
        font-family: 'FontinSansBold';
        src: local('☺'), url('fontin_sans_bold.woff') format('woff');
        font-weight: normal;
        font-style: normal;
    }
    

    这意味着在我们的CSS文件中,我们必须这样做:

    h2 {
        font-family: 'FontinSansBold', Verdana, sans-serif;
        font-weight: normal;
    }
    

    为什么FontSquirrel不使用字体粗细和字体样式声明来区分粗体和斜体变体?为什么要使用单独的字体系列?他们是否知道某些浏览器对该功能的支持(缺乏)?

    4 回复  |  直到 8 年前
        1
  •  17
  •   Community Mohan Dere    13 年前

    默认情况下 font-weight font-style ).

    如果您不关心那些过时的用户代理,则可以启用“样式链接”选项,该选项位于 @font-face 发电机套件。请注意,IE8及以下版本忽略编号 字体加粗 normal bold (和相应的 400 , 700 权重值)。

        2
  •  9
  •   Font Squirrel    15 年前

    它确实涉及到在字体内部戳来判断字体是粗体还是斜体。必须在字体内部设置某些位,以便IE获取样式链接。大多数粗体/斜体字体都设置了这些位,但不是全部。我们正在研究一种方法,使之更加自动化。

        3
  •  3
  •   Terry Riegel    15 年前

    我正在尝试使用@font face和font系列使bold/italic/bolditalic自动。

    到目前为止,我的努力毫无结果。这里有一页演示了这个问题。

    http://clearimageonline.com/apps/playground/fonts/test_IE.html


    下面是一个建议的解决方法(非常难看的解决方法)。。。。

    http://clearimageonline.com/apps/playground/fonts/proposed_IE.html

    这些测试页仅为Internet Explorer设计。此测试仅限于IE。跨浏览器功能显然是最终解决方案的一部分。

        4
  •  0
  •   laraborg    11 年前

    使用默认FontSquirrel方法的问题是,如果加载回退字体,所有权重都将丢失,因为它们都设置为正常。我认为风格链接是最好的方法。

    如果你担心IE8用户,你可以使用条件css。