html - 如何为字体中不支持的字符添加后备字体?

标签 html css utf-8 font-face hebrew

我在网站上使用希伯来语的自定义字体,但我缺少整套英文字符 a-b、A-Z。

现在我在 body 标签上使用字体(reformareregular):

body { font-family: 'reformaregular', Arial, Halvetica, sans-serif; }

英文字符出现在 windows 上的衬线字体 Times New Roman 的系统默认值中:

enter image description here

请注意底部的英文衬线和顶部的自定义希伯来语字体。

除了使用自定义 .en 类标记所有内容;

我的问题是如何为英文字体添加后备?

最佳答案

实际上,如果我理解你的问题,你可以使用 css unicode-range

请参阅@font-face/unicode-range:https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range

还有一个简单的例子:

@font-face {
    font-family: Almoni;
    src: url(Almoni.ttf);
    unicode-range: U+0590-05FF;
}
@font-face {
    font-family: CoolOtherLanguageFont;
    src: url(CoolOtherLanguageFont.ttf);
    unicode-range: U+0370-03FF, U+1F00-1FFF;
}
body {
    font-family: Almoni, CoolOtherLanguageFont, Helvetica;
}

关于html - 如何为字体中不支持的字符添加后备字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23980100/

相关文章:

html - 如何禁用文本区域和超链接

javascript - Navbar bootstrap 3 无法在移动设备上运行

html - 中心汉堡包、文本和删除轮廓

python - Tweepy过滤器utf-8编码

html - 在 <select> 上使用 v-model 会使第一个选项不出现在 select 中

jquery - 更改图标颜色并基于选择的元素。包括工作片段

html - 如何锐化css3中的文字?

单击更改正文不透明度的jquery

mysql - SQL 如何选择所有 utf8mb4 字符?

php - 错误的字符串值 : '\xE8.. &n...' for column