banner
rabithua

rabithua

twitter
github

Website introduces proprietary Chinese fonts

Problem#

The void theme itself references its own fonts. The font on the author's website is displayed correctly, but the font in my website banner is the default font. Initially, I thought it was due to an error in the Google API reference, but after some investigation, I found out that the original author referenced a local font, and importantly, this local font was compressed.

In simple terms, Chinese font files are usually several megabytes in size, and it is not sensible for a website to load such large font files. Therefore, a practice emerged to merge the required characters into a smaller font file.

The font compressed by the original author does not contain the characters I need, so they cannot be displayed correctly.

Solution (Universal)#

  1. Find the font file you want to use (ttf).

~~ 2. Compress the font on this website (lcddjm) Link is no longer valid ~~

  1. Compress the font using font-spider.

lcddjm

  1. After decompressing the compressed font file, you will get a font folder. Upload the folder to the root directory of the website or any other directory. As long as you can write the correct URL. (https://xxxx.com/font/font.css)

  2. Next, add a link in the header of the website

<link rel="stylesheet" href="https://xxxx.com/font/font.css">

  1. The font source has been successfully imported. Now, add the style to the text where you want to use the font (font-family: font;)

  2. Shout out loud {{Nagano is handsome: han han chang ye}}, problem solved~ :@(flower)

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.