微信小程序引入第三方字体问题?

小程序 文章 2020-09-03 16:21 1220 0 全屏看文

AI助手支持GPT4.0

微信小程序引入第三方字体问题?WeChat applet introduces third-party fonts?

微信小程序引入第三方字体问题?

今天测试遇到这样一个问题,引入第三方字体

font-family: YouSheBiaoTiHei;

ios生效,但是安卓没有生效,各位知道是啥问题吗?

Today's test encountered such a problem, the introduction of a third-party font family: youshebiaotihei; IOS took effect, but Android did not work. Do you know what the problem is?

回答:

圣殿骑士:

首先,一般不太会出现 IOS有效,Android无效的情况,你看下 font-face引入是否正确?

其次,通用的解决方案是有的,用api引入

wx.loadFontFace({  family: 'Bitstream Vera Serif Bold',  source: 'url("https://sungd.github.io/Pacifico.ttf")',  success: console.log})

官方文档参考

https://developers.weixin.qq.com/miniprogram/dev/api/ui/font/wx.loadFontFace.html


低版本的兼容处理是 将字体包转化为base64

微喵网络:

用图片吧

丽丽:找不到解决办法的话,准备用图片。想不明白,难道安卓不支持还是怎么样
丽丽:

这种效果的

-EOF-

AI助手支持GPT4.0