请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

正在回答 回答被采纳积分+3

3回答

negrochn 2018-12-24 17:35:11

windows电脑无法直接使用苹方字体,即使字体中安装苹方字体也无法直接在css中使用,需要从外部引入苹方字体,具体方法,我后续写一篇文章出来,先提供一个解决方案


将以下代码复制到app.wxss中,然后在index.wxss中的.container text的font-family: PingFang Light;

PS:我这边使用的是PingFang Light字体,而非PingFang Thin哈

@font-face {

    font-family: 'PingFang Light';

    src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAcYAA0AAAAACjQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAG/AAAABwAAAAcfxoHtUdERUYAAAbcAAAAHgAAAB4AKQAST1MvMgAAAZwAAABSAAAAYGeUCCNjbWFwAAACEAAAAEwAAAFCDB0T+Wdhc3AAAAbUAAAACAAAAAj//wADZ2x5ZgAAAngAAAMmAAAEMAF83QJoZWFkAAABMAAAADYAAAA2Cu5XjmhoZWEAAAFoAAAAHgAAACQGYgKZaG10eAAAAfAAAAAgAAAAIAhrAgZsb2NhAAACXAAAABoAAAAaBbwExG1heHAAAAGIAAAAFAAAACAAEABCbmFtZQAABaAAAAEFAAACSVhXw4Vwb3N0AAAGqAAAACsAAAA6AAMAgwABAAAAATMz2AUM518PPPUACwPoAAAAANGAbdoAAAAA1/Vy0gAd//ICPALYAAAACAACAAAAAAAAeNpjYGRgYFH5t4aBgfkFAxAw2TAwMqACFgBSCgMCAAB42mNgZGBg4GFwYmBmwAoACDoAU3jaY2BhimCcwMDKwMD4hfELAwOMBmJ5hhMcjEzcTAwQsICB6b8AhCkGIhwDAnwYHBgMGSyZY/6XME5gUWEMYWBhYATJMUUwxwApBQZGAPiLDhoAAAPoAH8AAAAAAU0AAAJYAH0ASwBAAB0AQABAAEoANgBAeNpjYGBgZoBgGQZGBhCwAfIYwXwWBgUgzQKEIL7l//9A0vD///+XoCoZGNkYYEwGRiYgwcSAChgZMAEzCys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4uS/h8XlNFuYwalfLWsxtrNPzF+3yGc7JfyWQYPXGhJBNVnykYNLnf5kbgsgAAeNqdj8FKw0AQhr9tk0oVNFXwpgTx4CUlG4hQgqdAT1WKeYJAwzZQAoo9+i4+jeDD+Aw6iYMUUhDcw+w3/878MwsEvGNoj2HCtfKAA+bKQ254U/ak5lPZZ2zOlEecmDvlgCNTKU/wzas4GG8sylXn1vKAY26Vhyx5UPak5kPZ55Qv5RGX5kI54NzcK084NE/SX9PgZOOyu0MKcokL0R1rXmBZN25eNi4s8nBRu7VIj1TyumUjXc+SVm67KQX+dssks8RMJVpWzMTJdmoiqiUlkruNbd6fnYU2nlq7mlU2C5PYplGcRknMPz/SX4Vf/75n67jHr8jVbf8Ou3PZ7f/p+gbSv1a3AAAAeNpjYGIAg/81DIoM2AAPEDMyMDGIMIgyiDGIM0gwSDJIMUgzyAAAWMwChgAAAAAB//8AAgABAAAADAAAABYAAAACAAEAAwALAAEABAAAAAIAAAAAAAAAAQAAAADVpCcIAAAAANGAbdoAAAAA1/Vy0g==) format('woff');



3 回复 有任何疑惑可以回复我~
negrochn 2018-12-25 08:53:06

写了一篇文章详细说明微信小程序如何设置苹方字体的,

指正一下之前回复的错误,windows中安装PingFang Light等字体,是可以直接在微信小程序的wxss中设置并生效的,

另外可以通过引入base64的字体的方式也是可以生效的


文章:《微信小程序设置苹方字体

0 回复 有任何疑惑可以回复我~
  • 刚刚我的设置也生效不了,看了您的解答解决了,感谢您!
    回复 有任何疑惑可以回复我~ 2022-10-22 17:54:40
7七月 2018-11-08 04:39:11

代码肯定写错了吧,检查下。

0 回复 有任何疑惑可以回复我~
  • 提问者 冻豆腐仔 #1
    字体我是看着您的一个字母一个字母打的,反复到了好几遍,我用的windows系统,会不会跟这个有关系
    回复 有任何疑惑可以回复我~ 2018-11-09 17:33:18
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信