Article Title: linux font technical principles. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
We need to understand that X's font engine. X supports Truetype fonts (a scalable font) mainly in four engines: freetype, xtt, xfs, and Xft.
First, we need to understand that X's font engine. X supports Truetype fonts (a scalable font) mainly in four engines: freetype, xtt, xfs, and Xft.
Freetype and xtt are internal modules of X. freetype1 rendering engine is used.
Xfs and xft are external service programs. xfs is a system-level Font Service program. It can also be used as an internal module of X. Like other class libraries, freetype2. Xft is loaded only when it is called. only xft supports antialias.
It is necessary to talk about freetype here. freetype is an open source font rendering engine, not just designed for X. its function is to read Truetype font information, such as the size, resolution, encoding, and so on, and then render it into the desired bitmap data output. freetype's current version is 2.x. the biggest difference from 1.0 is the addition of the anti-aliasing function.
Which one should I use if there are so many engines? As a matter of fact, the best Chinese support is xtt so far. because the effect of Chinese fonts calculated by using the function description method is unsatisfactory when the font is small, many Chinese font companies embed bitmap fonts in Truetype fonts. these bitmap fonts need to be read in special ways, and only xtt can do this in all engines.
The next step is to add the font to X so that xtt can be read correctly.
First, to configure the Linux system file, we need to use the root account to enter, which is equivalent to the administrator in windows.
The configuration file for X is/etc/XF86Config-4 (newer graphics card) or XF86Config (older graphics card). Open it with your favorite text editor, such as kedit or gedit.
After opening the configuration file, we find that the configuration file is divided into multiple sections. The first Section we need to configure is Section "Files". This Section describes the file information to be called by X.
To add a font directory, you just need to insert a line of FontPath "directory name" in it, such:
Section "Files"
# Multiple FontPath entries are allowed (they are concatenated together)
# By default, Mandrake 6.0 and later now use a font server independent
# The X server to render fonts.
FontPath "unix/:-1"
FontPath "/truetype" # insert a font directory
EndSection
Then let X load the xtt font engine:
Locate Section "Module" and modify it as follows:
Section "Module"
# Load "dbe" # Double-Buffering Extension
# Load "v4l" # Video for Linux
Load "extmod"
Load "glx
# Load "type1" # The type1 module renders the type1 font, which is in conflict with xtt and must be shielded.
# Load "freetype" # The freetype module renders Truetype fonts, conflicts with xtt, and must be shielded.
Load "xtt" # Add the xtt module Engine
EndSection
Now, xtt will automatically find the font in/truetype.
Now, copy the font to/truetype. First, create a truetype directory in the root directory
Mkdir/truetype
You can.
To copy data from a windows partition, you must first mount the file to connect the Linux directory to the windows partition. Create a "c" directory under the root directory.
Mkdir/c
Then
Mount/dev/hda1/c
In this way, the drive c under windows is connected to the/c directory under Linux. You can see the file on drive c in/c.
Then, enter the font file directory in/c, which is usually in Fonts under the window. Note that the directory names are case-sensitive in Linux.
In this way, we will copy the required font file to truetype.
Next, we need to set the font file. in Linux, the font setting of X is very annoying. Unlike windows, it's just a copy. In the initial stage, we can't help it.
Okay. Let's restart. Change all default fonts such as KDE, mozilla, and galeon to simsun. Haha, isn't it much more beautiful than before?
You can back up these configuration files and do not need to set them later.
The following describes the configurations of several other font engines:
Xfs: the configuration file is/etc/X11/fs/config.
Xft: the configuration file is/etc/X11/Xftconfig.
Xft configuration is relatively easy. You only need to copy the font to any directory specified by dir in the configuration file. If you need a small font that does not display AA, you can add it at the end:
Match
Any size> 8
Any size <17
Edit
Antialias = false;
Match
Any pixelsize> 8
Any pixelsize <17
Edit
Antialias = false;
So 8 ~ The font on the 17th will not use the anti-aliasing function.
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.