简体   繁体   English

字体无法在Mac / iOS Safari上呈现

[英]Font not rendering on Mac/iOS Safari

I have an issue with a font not being rendered correctly at all on iOS and MAC OSX. 我在iOS和MAC OSX上根本无法 正确 呈现字体时遇到问题。 It renders correctly everywhere else I've tried, including a brand-new virtual Windows 7 machine. 它可以在我尝试过的所有其他位置正确渲染,包括全新的虚拟Windows 7计算机。

It's really starting to grind my gears. 真的开始磨我的齿轮。

Here's my CSS for defining the font. 这是我定义字体的CSS。

@font-face {
    font-family: 'Knockout';
    src: local('☺'), 
         url('Fonts/knockout.otf') format('otf'), 
         url('Fonts/knockout.woff') format('woff'),
         url('Fonts/knockout.ttf') format('truetype'),
        url('/Fonts/knockout.svg#Knockout') format('svg');
    font-weight: normal;
    font-style: normal;
}

For the legacy SVG file, here's the header: 对于旧版SVG文件,以下是标头:

<defs>
<font id="Knockout" horiz-adv-x="269" >
  <font-face 
    font-family="Knockout"
    font-weight="500"
    font-stretch="normal"
    units-per-em="1000"

And here's the LESS/CSS styling for the actual class where the font needs to be applied: 这是实际类中需要应用字体的LESS / CSS样式:

 .header
       {
            position: absolute;
            top: 0;
            font-family: 'Knockout';
            color: @ColorTealD;
            font-size: 10vw;
            pointer-events: none;
            text-rendering: optimizeLegibility;
       }

As far as StackOverflow links I've visited: 至于我访问过的StackOverflow链接:

css @font-face doesn't work CSS @ font-face不起作用

Webfont not showing in iOS Webfont未在iOS中显示

@font-face not working in mobile Webkit @ font-face在移动Webkit中不起作用

I also visited a link that suggested using the smileyface trick, and another one that suggested prefacing the SVG URL with a '/'. 我还访问了一个建议使用笑脸技巧的链接,以及另一个建议使用'/'开头的SVG URL的链接。 I also wiped the Safari cache on my iPhone. 我还擦除了iPhone上的Safari缓存。 I need to emphasize that this font appears in other browsers, including completely wiped virtual machines. 我需要强调的是,这种字体会出现在其他浏览器中,包括完全擦除的虚拟机。 Switching fonts isn't an option at this point, because $500 has been forked over for licensing. 目前,不能选择切换字体,因为已经为许可费了500美元。

Anyone have any ideas on what else I could do, to fix this? 有人对我还能做些什么有任何想法来解决此问题? I'm pretty sure the next steps involve throwing a virgin into a volcano or bloodletting a goat. 我敢肯定,接下来的步骤涉及将处女扔进火山或放血山羊。

This could be a problem with the browser and not the font or your code. 这可能是浏览器的问题,而不是字体或代码的问题。 Every browser renders the font differently. 每个浏览器都以不同的方式呈现字体。 I also had this problem in chrome. 我在Chrome中也遇到了这个问题。

Did you try another font? 您尝试其他字体了吗? If another font works, than it's the browsers fault. 如果其他字体有效,那是浏览器故障。

There was an error in the "Knockout 32" font original files. “ Knockout 32”字体原始文件中有错误。 I opened it in FontForge and recreated it. 我在FontForge中打开它并重新创建了它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM