Google Chrome字符错误 - 错误? [英] Google Chrome wrong character - bug?

查看:97
本文介绍了Google Chrome字符错误 - 错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这个简单的HTML,显示你在打扰我。

 <!DOCTYPE html> 

< html xmlns =http://www.w3.org/1999/xhtmlxml:lang =enlang =en>
< meta http-equiv =Content-Typecontent =text / html; charset = UTF-8/>

< html>

@ font-face {
font-family:ubuntu-light;
src:url(Font / ubuntu / Ubuntu-L.ttf)格式(truetype);
}

h1 {
font-family:ubuntu-light;
}
< / style>

< body>
< h1> Ubuntu字体测试< / h1>
< h1>ŠšŽžČč< / h1>
< / body>
< / html>

您可以在这里获取字体: http://font.ubuntu.com



所以关键是如果我在Safari或Firefox中打开页面,页面正确打开,但是如果我在Chrome中打开它,字母Š和š不会正确显示。



我试图把它放在我的风格,但不工作:

  body {
-webkit-animation-duration:0.5s;
-webkit-animation-name:fontfix;
-webkit-animation-iteration-count:1;
-webkit-animation-timing-function:linear;
-webkit-animation-delay:0.5s;
}

@ -webkit-keyframes fontfix {
from {opacity:1;}
到{opacity:1;}
}

我也尝试用这种风格创建一个CSS文件,然后在JS页面的en调用它,它不工作。



我在Apache中有AddDefaultCharset utf-8。在Google Chrome中,我将编码设置为中欧和UTF-8,但没有设置。

解决方案

,请参阅其在启动板上的说明: Bug#1334363某些Mac应用程序中出现错误的字符([']→[8],[']→[9],[ - ]→[ẃ],[ - ]→[Ẅ]):Bug:Ubuntu Font Family



原因似乎是一个破碎的Unicode cmap子表。



你可以规避这个bug,如果你使用一个精简版本的Ubuntu ,例如由Google Fonts提供的子集版本,例如具有以下样式:



@import url(http://fonts.googleapis然而,在安装了Ubuntu字体的计算机上,如果您使用的是Ubuntu安装程序,您可以使用Ubuntu安装程序(例如.com / css?family = Ubuntu:300& subset = latin);





如果您想修复自己电脑上的显示器,,如果您不需要完整的Ubuntu字体,您可以从Google字体中抓取精简版本。为此,请在Safari中访问以下Google字体样式表,将链接复制到TTF文件并下载(在其他浏览器中,Google Fonts样式表将使用WOFF字体生成,您无法在Mac OS X上安装) p>

http://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700,300italic,400italic500italic.700italic|Ubuntu+Condensed&subset=latin,latin-ext


I did this simple HTML to show you what is bothering me..

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<html>

    <style>
        @font-face {
            font-family: "ubuntu-light";
            src: url(Font/ubuntu/Ubuntu-L.ttf) format("truetype");
        }

        h1 {
            font-family: "ubuntu-light";
        }
    </style>

    <body>
        <h1>Ubuntu font test</h1>
        <h1>Š š Ž ž Č č</h1>
    </body>
</html>

You can get the font here: http://font.ubuntu.com

So the point is that if I open the Page in Safari or Firefox, the page opens correctly, BUT if I open it in Chrome, the letters Š and š are not displayed correctly.

I tried to put this in my style but is not working:

body {
    -webkit-animation-duration: 0.5s;
    -webkit-animation-name: fontfix;
    -webkit-animation-iteration-count: 1;
    -webkit-animation-timing-function: linear;
    -webkit-animation-delay: 0.5s;
}

@-webkit-keyframes fontfix {
from {opacity: 1;}
to {opacity: 1;}
}

I also tried to create a CSS file with this style and then call it at the en of the page with JS but it is not working.

I have "AddDefaultCharset utf-8" in Apache. In Google Chrome I set the encoding to Central Europe and also to UTF-8 but nothing..

解决方案

This is indeed a bug, see its description on launchpad: Bug #1334363 "Wrong characters appear in some Mac apps ([‘] → [⁸], [’] → [⁹], [–] → [ẃ], [—] → [Ẅ])" : Bugs : Ubuntu Font Family

The reason seems to be a broken Unicode cmap subtable.

You can circumvent this bug if you use a stripped-down version of Ubuntu, for instance a subsetted version served by Google Fonts, for instance with the following style :

@import url(http://fonts.googleapis.com/css?family=Ubuntu:300&subset=latin);

However, on a computer where the Ubuntu fonts are installed, the characters will still look wrong.

If you want to fix the display on your own computer and if you do not need the complete Ubuntu fonts, you can grab the stripped-down versions from Google Fonts. To do this, visit the following Google Fonts stylesheet in Safari, copy the links to the TTF files and download them (in other browsers, the Google Fonts stylesheet will be generated with WOFF fonts that you cannot install on Mac OS X):

http://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700,300italic,400italic,500italic,700italic|Ubuntu+Condensed&subset=latin,latin-ext

这篇关于Google Chrome字符错误 - 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆