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

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

问题描述

我想知道是否可以在使用 @font-face 时进行后备设置,以便如果我页面上的文本包含字体中未考虑的字符(例如日语字符),则只有这些字符以基本字体显示,其他所有字符都保留为自定义字体?

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.

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

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

例如:

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

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

很遗憾,存在浏览器支持问题.

Unfortunatelly there are browser support issues.

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

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