Problem#
The void theme itself references its own font, and the author's website displays the font correctly, but the banner font on my own website is the default font. Initially, I thought it was due to an error in the Google API reference, but after much investigation, I learned that the original author referenced a local font, and importantly, this local font was compressed.
In simple terms, the original Chinese font files are often several megabytes in size, and loading such large font files on a website is clearly impractical, so a method has emerged to merge the required characters into a smaller font file.
The compressed font from the original author does not contain the characters I need, so it cannot display correctly.
Solution (General)#
- Find the font file (ttf) you want to use.
~~ 2. Go to this website (lcddjm) to compress the font the website is no longer valid ~~
- Use font-spider to compress the font.
-
After decompressing the compressed font file, you will get a font folder. Upload this folder to the root directory of your website, or it can be in another directory, as long as you can write the correct URL. (https://xxxx.com/font/font.css)
-
Next, add a link in the head of your website.
<link rel="stylesheet" href="https://xxxx.com/font/font.css">
-
The font source has been successfully introduced, now add the style (
font-family: font;
) to the text you want to use the font for. -
Shout out {{Nagano is so handsome han chang ye}}, problem solved~ :@(献花)