浏览器如何通过font

编程入门 行业动态 更新时间:2024-10-19 23:25:20
浏览器如何通过font-family值获取正确的字体文件?(How does browser pickup the right font file via font-family value?)

我将一些新的字体文件,Apple的PingFang文件,许多.ttf文件复制到我的CentOS / usr / share / fonts目录,并通过命令fc-cache -fv重建字体缓存,看起来很成功。 但是当我运行fc-match'PingFang'时,结果不是新安装的字体文件。 有什么事?

另一个相关的问题是,对于Apple的PingFang家族,有很多文件,如PingFang Bold.ttf PingFang ExtraLight.ttf PingFang Heavy.ttf PingFang Light.ttf PingFang Medium.ttf PingFang Regular.ttf,每个文件的正确姓氏是什么字体文件,如果我想使用特定的字体文件的浏览器渲染?

I copied some new fonts files , Apple's PingFang files, many .ttf files, to my CentOS /usr/share/fonts dir and rebuild the font cache via command fc-cache -fv , it seems success. But when I run fc-match 'PingFang', the result is not the newly installed font file. What is the matter?

Another related question is , for the Apple's PingFang family , there are many files, like PingFang Bold.ttf PingFang ExtraLight.ttf PingFang Heavy.ttf PingFang Light.ttf PingFang Medium.ttf PingFang Regular.ttf, what is the right family name for each font file if I want the browser render using specific font file?

最满意答案

要在css中放置本地.ttf字体并指定系列中的粗体,中等或任何样式,其中font-family是指定权重的别名:

@font-face { font-family: "PingFang"; src: url("PingFang-Medium.ttf") format('truetype'); }

For putting a local .ttf font in your css and specifying bold, medium, or whatever style in the family, where font-family below is the alias of the specified weight:

@font-face { font-family: "PingFang"; src: url("PingFang-Medium.ttf") format('truetype'); }

更多推荐

本文发布于:2023-07-31 02:43:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1340503.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:浏览器   font

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!