Comments (4)
今天试出来了一个简单的办法,目前看上去效果还不错,尚且不知道有什么瑕疵,个人用的字体是思源宋体。
第一步:先在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.
from hexo-theme-a4.
老问题,字体自选暂不支持,希望大佬出手填补A4这一空白。我目前暂无想法。
from hexo-theme-a4.
2024-01-23
v1.8.2已新增 默认中文字体为 霞鹜文楷,显著提高中文阅读体验。(也内置思源宋体)
同时提供配置给用户,可自行关闭 霞鹜文楷 则会启用 思源宋体。(思源宋体不提供关闭)
2023-11-23
v1.7.8已经更换 默认字体为 思源宋体 Noto Serifsc 字体,欢迎更新体验。
至于更换为其他字体,后期应该会开发一个新版本,或者写一篇教程,提供让用户自己更换字体的方法。
from hexo-theme-a4.
Related Issues (20)
- fork了仓库准备魔改,有几点小想法 HOT 2
- 请问本地服务器显示正常,推送到github上部署后网页什么都不显示是什么问题 HOT 1
- 关于hexo-reference中引用的hint.min.css问题 HOT 1
- 可以加个友链页面 HOT 2
- 怎么才能让文章页作为首页那 HOT 5
- 关于首页的标题能否设置大小 HOT 2
- hexo generate output HOT 3
- 代码行不显示、 超出宽度问题 HOT 5
- 字体配置 HOT 1
- feature:“首页”,“文章”,“关于” 这几个栏目的名称能否支持修改 HOT 2
- 在firefox上list文章高度异常
- 控制台启动报错?(分类标签相关)
- Customized favicon 404 on Non-index pages -- Possible cause & Possible fix HOT 1
- 代码块怎么没有渲染? HOT 3
- 本地部署正常,github action部署有问题
- 强制在每一页面进行数学公式渲染 HOT 1
- nvm 安装 A4 主题的问题 HOT 2
- 如何更改代码块渲染方式 HOT 1
- 关于部分LaTex显示有问题 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hexo-theme-a4.