微信小程序:使用自定义中文字体的一种(非在线)方法

2022/6/3 1:20:31

本文主要是介绍微信小程序:使用自定义中文字体的一种(非在线)方法,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

Step1: Choose your font and download it as *.ttf
Step2: Use 'Fontmin'(http://ecomfe.github.io/) to compress your font
Step3: Use (https://transfonter.org/) with 'Base64 encode on' to convert your compressed font
Step4: Download the converted zip file and copy the content in *.css to your index.wxss file (better at the bottom of the file cause it's pretty long).

 

之前在 https://github.com/ADu2021/GirlsDay0/pull/3/ 写小程序的时候总结的,现在搬过来免得以后找不到。

不过话说回来,如果能找到能在线访问的字体资源就没这么多事儿了,这种办法不仅要用户现下载(压缩版)字体,还要在每次改动内容之后重新生成字体base64,不适合大规模开发。



这篇关于微信小程序:使用自定义中文字体的一种(非在线)方法的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程