Giter VIP home page Giter VIP logo

Comments (4)

havenoideawhatismyname avatar havenoideawhatismyname commented on May 29, 2024 2

今天试出来了一个简单的办法,目前看上去效果还不错,尚且不知道有什么瑕疵,个人用的字体是思源宋体。
第一步:先在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的适配情况介绍。

from hexo-theme-a4.

jiangjiang1116 avatar jiangjiang1116 commented on May 29, 2024

手机:image
PC:1694510759051

from hexo-theme-a4.

HiNinoJay avatar HiNinoJay commented on May 29, 2024

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

from hexo-theme-a4.

HiNinoJay avatar HiNinoJay commented on May 29, 2024

2024-01-23

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

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


2023-11-23

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

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


from hexo-theme-a4.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.