How to troubleshoot using custom Chinese fonts in Web pages

Source: Internet
Author: User

English font customization

Chinese font customization

The above two picture examples show the application of custom fonts in the Web page, this is not a browser font, nor is the client computer installed fonts, nor pictures or other ways, but also in the way of text display, the advantages of doing so is some, the simplest good-looking ah, and then, for example, can be easily modified, The important thing is to facilitate SEO optimization. The benefits are not many, let's talk about how to achieve.

First, to prepare the font, use the three file formats of the font to ensure that the font is displayed correctly in the mainstream browser.

The following are some of the major browsers ' support for font formats:

. TTF or. OTF, suitable for Firefox 3.5, Safari, Opera

. EOT, for use with internet Explorer 4.0+

. SVG, suitable for Chrome, IPhone

When you get to a three-format font file, you can use the @font-face property of the CSS to invoke the font.

The code is as follows:

@font-face {

font-family: ' Fontnameregular ';

Src:url (' Fontname.eot ');

Src:local (' FontName Regular '),

Local (' FontName '),

URL (' fontname.woff ') format (' Woff '),

URL (' Fontname.ttf ') format (' TrueType '),

URL (' fontname.svg#fontname ') format (' SVG ');

}

This is a simple two-step implementation, not complicated, but if you really think this is done, then there is no need for this article.

There's a problem here, how do you get these three formats for a font? Generally, we use the special fonts that are downloaded, most commonly. TTF files, through TTF files we can obtain through the online font conversion service provided by the website font squirrel or the Web font converter. I am using the font Squirrel, which allows us to select the characters needed to generate font files, which greatly reduces the size of the font file, so that the site performance is stronger. The web site does not support font file conversion above 1M. As for how to use this website, the Internet has a lot of, to see it yourself.

Note that the font file here cannot exceed 1M, so there is no problem with English fonts, after all, the English font on 26 letters, plus some symbols, dozens of KB can be done, but for Chinese fonts, I am afraid this method is not applicable, Chinese fonts are not only a few m, some even more than 10M, Font squirrel for Chinese fonts is powerless, even if it can be converted, a Web site because of a custom font, and increase the flow of a few m is a very unwise choice.

So in this case, for Chinese fonts, we need to pick out the text from the font of the site, and then make their own fonts, generally Bailai Chinese characters almost.

From the font to pick out the text we need, font editing software, the typeface creator is essential, first look at what the software looks like.

This is the last word I have to pick out. How to find these words from a font file is the next question. Select the editor here-Find or direct ctrl+f, you will see the following interface

Select Unicode, where you can locate the text you want based on the Unicode of the Chinese character. As for the Chinese character of Unicode, online but a lot of resources can be found, casual Baidu a http://www.nengcha.com/soucha/code/unicode/class/, such as I find "side", the corresponding Unicode is "65b9", That in the dollar sign after the "65B9", point lookup, you can locate the side, so we want to which word, you can quickly find, you may copy out a new font, you can also font files inside other do not delete the font. We can first find all the words we need, and then according to the Unicode order, how to sort, I am afraid there is this problem, the simplest, is through the Web site just mentioned Http://www.nengcha.com/soucha/code/unicode/class /, here at one time can enter a maximum of 100 words, out is sorted by Unicode, very convenient, one to find, the middle part of all deleted, is not much easier.

Here basically a thin body of the. TTF font file is done, and then go back to the site font squirrel to generate other formats of the file bar. There's nothing left to say about the back.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.