标签: unicode-range

CSS3 unicode-range在Firefox中不起作用

我正在使用CSS3属性unicode-range为不同的字符集设置不同的字体.Arial拉丁字符和WebNazanin阿拉伯语/波斯语.它似乎适用于Chrome 29和IE10但不适用于Firefox 23,它仍然使用ArialFirefox中的字体:

Chrome截图:
铬


Firefox截图:
火狐

这是我的css:

@font-face {
    font-family: 'WebNazanin';
    src: url('http://awebfont.ir/services/fonts/775b712c01cdf4eb7f15d9180567345060f700291901931.eot'),
    url('http://awebfont.ir/services/fonts/775b712c01cdf4eb7f15d9180567345060f700291901931.otf') format('opentype'),url('http://awebfont.ir/services/fonts/775b712c01cdf4eb7f15d9180567345060f700291901931.woff') format('woff'),
    url('http://awebfont.ir/services/fonts/775b712c01cdf4eb7f15d9180567345060f700291901931.ttf') format('truetype'),
    url('http://awebfont.ir/services/fonts/775b712c01cdf4eb7f15d9180567345060f700291901931.svg') format('svg');
}
@font-face {
    font-family:'WebNazanin';
    src: local('Times New Roman');
    unicode-range: U+41-7F;

}
Run Code Online (Sandbox Code Playgroud)

JSFiddle:http://jsfiddle.net/maysamsh/t9MpF/

css firefox css3 unicode-range

8
推荐指数
1
解决办法
1563
查看次数

从 Google Fonts 导入时操作 unicode-range

我的问题可以看作是这个答案的后续。

我在我的项目中使用了 Google 字体,现在想更改 unicode 范围,因此只有数字会受到影响(请参阅上面的链接答案)。我的问题是我没有让它与包含一起工作:

@import url("http://fonts.googleapis.com/css?family=Lato:300,400,700");
Run Code Online (Sandbox Code Playgroud)

当我像这样导入字体时,字体已经由谷歌生成(谷歌也提供了正确的字体设置以避免跨浏览器问题,非常方便)。我尝试像这样覆盖导入的字体:

@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 400;
  unicode-range: U+30-39;
}
Run Code Online (Sandbox Code Playgroud)

但这没有用。为了实现仅附加数字的预期效果,我需要从 Google 导入 URL 中获取 CSS 并将其复制到我自己的 CSS/SASS 文档中。但是后来我失去了由 Google Fonts API 完成的跨浏览器服务以及他们 CDN 的速度。

有没有办法在保持 Google 字体导入的同时更改 unicode 范围,或者当我想使用 unicode 范围时是否真的需要自己托管字体?

css google-font-api unicode-range

5
推荐指数
1
解决办法
3210
查看次数

使用 unicode_range 仅排除数字

我正在使用自定义字体并通过@font-face加载它。文本看起来不错,但数字看起来很奇怪(仅在 chrome-windows 上,这是一个众所周知的错误。是的,我尝试使用 chrome 的 svg 格式,它解决了数字问题,但搞乱了文本)。我决定将自己的字体限制为仅[a-z][A-Z],并使用此生成器得到:

unicode-range: U+0041-U+005a, U+0061-U+007a;
Run Code Online (Sandbox Code Playgroud)

而且它似乎...不起作用。数字仍然使用该字体显示。如何找到合适的范围来使用\其他解决方案?我希望有一个通用的解决方案,例如,如果我也想限制未来的字体。

提前致谢!

Ps 当我谈论这个主题时 - 我假设没有办法加载相同的字体两次 - 将文件用于.svg数字和.otf文本,对吧?因为如果可能的话那就太棒了。

css unicode font-face unicode-range

3
推荐指数
1
解决办法
3088
查看次数

@ font-face unicode-range属性

在一些html文档中,我只使用几个单词的webfonts.以性能方式加载完整的字体文件似乎很浪费.这是@ font-face声明的unicode-range参数的来源:

http://www.w3.org/TR/css3-fonts/#unicode-range-desc

有了它,我认为可以定义要加载的字体文件的哪些字符,从而大大提高性能.但我无法让它发挥作用.奇怪的是它覆盖了firefox中的所有字符,并且如果我在声明中包含unicode-range参数,它无法在safari中加载字体.任何帮助将不胜感激,下面是我测试它的html:

<!doctype html>
<html lang="en">
<head>
<style text="text/css">
@font-face {
font-family: 'dream';
src: url(Fonts/Digital-dream/DIGITALDREAM.ttf) format("truetype");
unicode-range: U+FF21;
}

*{
font-family:dream;
font-weight:normal;
}
</style>
</head>
<body>
<p>ASDWEWQDSCF</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

performance css3 webfonts font-face unicode-range

1
推荐指数
1
解决办法
2729
查看次数