【转载】Fonts.css -- 跨平台中文字体解决方案

转载
这位老哥  zenozeng / fonts.css 的项目。
相关链接:

这个的主要作用是在项目中引入 fonts.css 之后,在 html 标签中直接使用类似于 font-kai class 属性,该 div 的字体就是楷体
< div class= "font-kai" > 感谢您的协助! </ div >
其实都是系统自带的,现在可以跨了平台不用自己兼容了



Fonts.css -- 跨平台中文字体解决方案
Note: 下滑线标注的为本地存在的字体,关于测试字体的方法,可以看我 这个 Repo
  • Windows
  • Mac
  • Linux

黑体

24px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
18px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
16px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
14px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
12px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
.font-hei
font-family: -apple-system, "Helvetica Neue", Helvetica, "Nimbus Sans L", Arial, "Liberation Sans", "PingFang SC", "Hiragino Sans GB", "Source Han Sans CN", "Source Han Sans SC", "Microsoft YaHei", "Wenquanyi Micro Hei", "WenQuanYi Zen Hei", "ST Heiti", SimHei, "WenQuanYi Zen Hei Sharp", sans-serif;
  • >Use apple system font (like San Francisco) by default, see also: https://github.com/zenozeng/fonts.css/issues/29
  • >某些 Linux 中 Helvetica 会自动 fallback 到 Nimbus Sans L (具体见 /etc/fonts/conf.d/30-metric-aliases.conf, debian jessie/sid )
  • >某些 Linux 中 Arial 会自动 fallback 到 Liberation Sans (具体见 /etc/fonts/conf.d/30-metric-aliases.conf, debian jessie/sid )
  • Windows
  • Mac
  • Linux

楷体

24px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
18px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
16px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
14px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
12px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
.font-kai
font-family: Baskerville, Georgia, "Liberation Serif", "Kaiti SC", STKaiti, "AR PL UKai CN", "AR PL UKai HK", "AR PL UKai TW", "AR PL UKai TW MBE", "AR PL KaitiM GB", KaiTi, KaiTi_GB2312, DFKai-SB, "TW\-Kai", serif;
  • Windows
  • Mac
  • Linux

宋体

24px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
18px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
16px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
14px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
12px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
.font-song
font-family: Georgia, "Nimbus Roman No9 L", "Songti SC", STSong, "AR PL New Sung", "AR PL SungtiL GB", NSimSun, SimSun, "TW\-Sung", "WenQuanYi Bitmap Song", "AR PL UMing CN", "AR PL UMing HK", "AR PL UMing TW", "AR PL UMing TW MBE", PMingLiU, MingLiU, serif;
  • Windows
  • Mac

仿宋

24px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
18px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
16px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
14px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
12px 我能吞下玻璃而不伤身体,The quick brown fox jumps over the lazy dog.
.font-fang-song
font-family: Baskerville, "Times New Roman", "Liberation Serif", STFangsong, FangSong, FangSong_GB2312, "CWTEX\-F", serif;
  • >某些 Linux 中 Times New Roman 会自动 fallback 到 Liberation Serif (具体见 /etc/fonts/conf.d/30-metric-aliases.conf, debian jessie/sid )
  • >CWTEX仿宋体是繁体字型
0
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值