Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

字体更换问题 #48

Open
jiangjiang1116 opened this issue Sep 12, 2023 · 4 comments
Open

字体更换问题 #48

jiangjiang1116 opened this issue Sep 12, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@jiangjiang1116
Copy link

pc端能正确显示,但移动端不能,比如我引入了楷体的ttf,然后配置好之后在pc上正确显示,手机上不能。

@jiangjiang1116
Copy link
Author

手机:image
PC:1694510759051

@HiNinoJay
Copy link
Owner

HiNinoJay commented Sep 12, 2023

老问题,字体自选暂不支持,希望大佬出手填补A4这一空白。我目前暂无想法。

@havenoideawhatismyname
Copy link

havenoideawhatismyname commented Oct 20, 2023

今天试出来了一个简单的办法,目前看上去效果还不错,尚且不知道有什么瑕疵,个人用的字体是思源宋体。
第一步:先在A4的_config.yml里面把cdn关掉。
第二步:打开fonts.css文件,直接在网页的F12里面写也可以:
@font-face { font-family:montserrat; font-style:normal; font-weight:400; src:local(""), url(../fonts/montserrat-v23-latin-600.woff2) format("woff2"), url(../fonts/montserrat-v23-latin-600.woff) format("woff") }
font-family改成字体名称,下面两个不同格式的url分别贴上两个字体文件的下载链接,也可以再加一个opentype的,ttf我没试过。
也可以把上面的local后面改成文件的位置。
第三步:打开style.css文件,找到body的这一段:
body { /* font-family: "Montserrat", "SF UI Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Helvetica, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif; */ font-family: <字体名称>; font-size: 16px; line-height: 1.75; letter-spacing: 0.6px; color: var(--font-color-1); background: #efeaf2; }
(我有自定义背景色所以可能不一样)
font-family后面改成刚刚写在fonts文件里的字体名称,然后保存。
第四步:运行 hexo clean && hexo g && hexo s看效果,需要一点时间才能加载出来。
我自己试了下手机端谷歌和电脑端火狐都效果不错,edge响应时间比较长但加载好之后效果也挺好的,safari貌似适用不了。详细的可以再研究一下https://developer.mozilla.org/zh-TW/docs/Web/CSS/@font-face 上面对font-face的适配情况介绍。

@HiNinoJay
Copy link
Owner

HiNinoJay commented Nov 23, 2023

2024-01-23

v1.8.2已新增 默认中文字体为 霞鹜文楷,显著提高中文阅读体验。(也内置思源宋体)

同时提供配置给用户,可自行关闭 霞鹜文楷 则会启用 思源宋体。(思源宋体不提供关闭)


2023-11-23

v1.7.8已经更换 默认字体为 思源宋体 Noto Serifsc 字体,欢迎更新体验。

至于更换为其他字体,后期应该会开发一个新版本,或者写一篇教程,提供让用户自己更换字体的方法。


@HiNinoJay HiNinoJay changed the title 字体显示问题 字体更换问题 Nov 23, 2023
@HiNinoJay HiNinoJay added the enhancement New feature or request label Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants