weixin_39943799
weixin_39943799
2021-01-07 15:38

Rename Roboto Condensed Regular

Rename Roboto Condensed to Roboto Condensed Regular as per Google Fonts CSS.

该提问来源于开源项目:alfredxing/brick

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39943799 weixin_39943799 3月前

    Hmn, after some testing in Chrome on OS X and IE10 on Windows 8: Using src: local("Roboto Condensed Regular”); or src: local("Roboto Condensed Bold”);did not load the local font in OS X, but did on Windows. src: local(“RobotoCondensed-Regular”); and src: local(“RobotoCondensed-Bold”); (using its PostScript name) do seem to load the locally installed font in both Windows and OS X. Should the PostScript name be specified?

    点赞 评论 复制链接分享
  • weixin_39575937 weixin_39575937 3月前

    Hmm, I'll have to investigate that a bit further, but if it turns out to be true, I'll rename all of the fonts in the catalogue.

    I'll merge the commit you made, since that's still right.

    点赞 评论 复制链接分享
  • weixin_39943799 weixin_39943799 3月前

    In the mean time I did a bit of googling and apparently you'd want to add the font's full name and additionally the PostScript name for Safari on OS X (which probably means for all webkit browsers as this also applies to Chrome). This is basically how the Googles do it.

    As an example, these styles load the font locally in both Firefox and Safari/Chrome:

    
    -face{
        font-family: 'Roboto Condensed';
        font-style: normal;
        font-weight: 400;
        src: local('Roboto Condensed Regular'),
        local('RobotoCondensed-Regular'),
        url('//brick.a.ssl.fastly.net/fonts/robotocondensed/400.woff') format('woff')
    }
    -face{
        font-family: 'Roboto Condensed';
        font-style: normal;
        font-weight: 700;
        src: local('Roboto Condensed Bold'),
        local('RobotoCondensed-Bold'),
        url('//brick.a.ssl.fastly.net/fonts/robotocondensed/700.woff') format('woff')
    }
    -face{
        font-family: 'Roboto Condensed';
        font-style: italic;
        font-weight: 400;
        src: local('Roboto Condensed Italic'),
        local('RobotoCondensed-Italic'),
        url('//brick.a.ssl.fastly.net/fonts/robotocondensed/400i.woff') format('woff')
    }
    -face{
        font-family: 'Roboto Condensed';
        font-style: italic;
        font-weight: 700;
        src:local('Roboto Condensed Bold Italic'),
        local('RobotoCondensed-BoldItalic'),
        url('//brick.a.ssl.fastly.net/fonts/robotocondensed/700i.woff') format('woff')
    }
    

    If I omit the PostScript names, the font is only loaded locally in Firefox, not in Chrome or Safari.

    Note that during testing I changed the font-family value as curiously, if I leave out the src: completely, all three browsers will load Roboto Condensed locally if it is installed based on the font-family value. Same goes for ie10 and ie9.

    点赞 评论 复制链接分享
  • weixin_39575937 weixin_39575937 3月前

    Thanks for the info! What happens when you only use the PostScript name?

    点赞 评论 复制链接分享