Opera not rendering certain characters from webfonts

夙愿已清 提交于 2019-12-12 06:06:58

问题


Maybe it is not supposed to. But bear with me. I am using Google Web Fonts, and I am including PT Sans font like so:

<link href="https://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">

and I even have .htaccess set like so:

<IfModule mod_headers.c>
  <FilesMatch "\.woff$">
    Header set Content-Type "application/octet-stream"
  </FilesMatch>

  <FilesMatch "\.ttf$">
    Header set Content-Type application/octet-stream
  </FilesMatch>
</IfModule>

Now PT Sans font does not include Baltic (ąčęėįšųūž) characters, which I am using. But Chrome, Firefox, IE render them all perfectly - not even using another font. Opera just skips them and leaves an empty space.

Just realized that it only does it with bold fonts. Check this example:

<!doctype html>
<html lang="en" class="no-js">
  <head>
    <title>Font test</title>
    <meta charset="UTF-8">
    <link href="https://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
  </head>

  <body style="font-family:'PT Sans';">
    aceeisuuz<br />
    ąčęėįšųūž
    <p style="font-weight:bold">ąčęėįšųūž</p>
  </body>
</html>

Now how do I fix it?


回答1:


Looks alright to me, I just threw your example code into a jsfiddle. Maybe there's something else going on with your CSS/page?

http://jsfiddle.net/MetalFrog/gHhGv/




回答2:


Since the PT Sans font does not contain the Baltic characters, browsers will use some fallback fonts. In the absence of declarations for this in the page style sheet, they will use their default methods, so browser differences are to be expected.

It is not clear why Opera sometimes fails here, but it is more important to provide some planned fallback. Either select a completely different font, or at least specify some alternate fonts in your font list, e.g. font-family: 'PT Sans', Arial, sans-serif. This prevents odd mixtures, like PT Sans and Times New Roman (the common default font) and may well circumvent the Opera bug too.




回答3:


I've encountered same problem.

solution was:

  1. Google Web Fonts page | Chose your cirilic Font | Quick usage | Verify your settings... -> add Cyrilic set to selection.

  2. Clear Opera cache;



来源:https://stackoverflow.com/questions/9771629/opera-not-rendering-certain-characters-from-webfonts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!