Closed fps144 closed 1 month ago
Directly add font files into resources is not very practical, for Chinese font files are usually large and takes a long time to transmit (especially when you deploy websites on servers with low bandwidth).
You can use CDN to deliver fonts from elsewhere with larger bandwidth; also CDNs split font file (by unicode range) in beforehand, so user only need to load required parts.
To change fonts used in the theme, and change font source to CDN:
Specify new font families in cactus/source/_variables.styl
, change original font families (for example from Meslo
to Noto Sans SC
for better Chinese display);
Add font from CDN as CSS: import font link in site header specified in cactus\layout\_partial\head.ejs
before </head>
marker:
<link rel="stylesheet" type="text/css" href="https://fonts.font.im/css?family=Noto+Sans+SC:normal,bold">
By this you import Noto Sans SC
medium and bold from CDN.
You can also delete original font files in cactus/sources/lib/Meslo*
and cactus/sources/lib/vazir*
to make site resources smaller.
In this way fonts should load faster than load from site resources.
When Chinese characters appear on the page, it always loads very slowly. The font file 'MesloLGS-Regular.ttf' takes a very long time. Can this be optimized? Or what should I do?