特殊字符上的后备字体 [英] Fallback fonts on special characters

查看:98
本文介绍了特殊字符上的后备字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以,当使用@ font-face时,有一个回退设置,如果我的页面上的文本包含字体(例如日语字符)中没有考虑的字符,只有那些字符以一种基本字体显示,每隔一个字符保留为自定义字体?



我想像一个段落中可能会混合使用两种字体

解决方案

您所描述的是浏览器的默认行为 - 它应该自然地回退到缺少字符的基本字体。



但是,有时自定义字体使用空白字符,在这种情况下,您可以尝试使用 unicode-range p>

例如:

  @ font-face {
字体家庭:BBCBengali
src:url(fonts / BBCBengali.ttf)format(opentype);
unicode-range:U + 00-FF;
}

取自这篇有趣的文章:使用Unicode范围创建自定义字体栈



Unfortunatelly there是浏览器支持问题。


I was wondering if it's possible to, when using @font-face, have a fallback setup so that if the text on my page contains characters that are not accounted for within the font (Japanese characters for example), only those characters are presented in a basic font and every other character remains as the custom font?

I'm imagining that potentially there'd be a mix of two fonts within one paragraph on occasion.

解决方案

What you described is the default behaviour of a browser - it should naturally fall back to basic font for missing characters.

However, sometimes custom fonts use blank characters, in that case you can try using the unicode-range

For example:

@font-face {
    font-family: BBCBengali;
    src: url(fonts/BBCBengali.ttf) format("opentype");
    unicode-range: U+00-FF;
}

Taken from this interesting article: Creating Custom Font Stacks with Unicode-Range

Unfortunatelly there are browser support issues.

这篇关于特殊字符上的后备字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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