Two fonts in xfree86

xiaoxiao2021-03-05  21

Copyright © 2005 This article complies with the terms of the Free Document License, welcome to reprint, modify, and spread.

XFree86 is a free implementation in the X system in the X86 architecture, and is also the default x system of the Linux system. In order to set the font, we need to understand the principles and implementation techniques of the font system in the XFree86 system.

Two font systems

The xfree86 system has two sets of font systems, which is why the font settings in x windows are more complicated. The font systems of these two sets are:

Core X11 Font System: It is the most widely used letter system, and all X systems are supported. The XFT font system is: a new font technology that can only be used on X systems based on XFree86 systems, but the set of philosophral systems are simple, easy to use, will be the direction in the future.

1.1. XFT

XFT is a library, which has no self-configured mechanism, which relies on the Fontconfig library to configure and custom fonts, and XFT is responsible for the display of the font. That is, FontConfig is a library that allows X systems to find a font, and XFT is a library that is responsible for how fonts found in the X system. So discuss the XFT font configuration is actually discussing Fontconfig. FontConfig is included in the XFree86 release.

FontConfig's role:

Automatically search the font path and find the new copy of the font. Other fonts are automatically selected when the fonts are displayed do not exist. This is why we want to adjust the order of the font when we beautify the font. Combine the rendering engine of X system and other X systems to achieve quality font output.

Fontconfig configuration file has three, one is a system-level profile /etc/fonts/fonts.conf, there is also a local.conf in this directory, usually we only modify the local.conf file (but as new version of XFT configuration Files do not use local.conf files), fonts.conf is generally not recommended to modify it. The third profile is the ~ / .fonts.conf under the user's home directory, which is the user-level font configuration file, which is only valid for the current user. The format of these three files is the same, all of which are files in XML format. The syntax rules for this XML file are defined in fonts.dtd. For detailed configuration, please refer to the "Linux High Quality Font Research" forum in China Linux Commune.

Installing new fonts in the XFT font system is very simple, just copy the font file to the font file directory specified in Fonts.conf, FontConfig automatically senses new fonts. The default font directory has four, namely:

/usr/share/fonts/usr/x11r6/lib/x11/FONTS/Type1/usr/local/share/fonts ~/.fonts

After copying the new font file to the font directory, we can use the fc-list command to list newly installed fonts. If not, you can use the FC-Cache command to manually update the system font configuration. In this way, running FC-LIST should be able to see the newly installed font. With the XFT font system, it is not necessary to configure / etc / x11 / xf86config-4, nor does it need to restart the X server to make the configuration. The XFT font system is really convenient than traditional X11 core font systems. So it is the future development direction. Currently, not all applications support XFT font systems. Below is the support of various programs on the XFT font system:

Both the GTK 2.x and QT programs can use the XFT font system, but the GTK 1.x program does not support the XFT font system, which can only use the X11 core font system. The GTK 2.2 version and the above programs use the XFT font system by default without configuring. GTK 2.0 Program If you want to use XFT, you need to set the environment variable GDK_USE_XFT = 1. GTK 2.x Program Font Configuration can be configured through the GNOME-Font-Properties tool provided by the GNOME desktop system, which can be in the "Application" - "Desktop Preferences" - "Font" in the GNOME desktop environment. turn up. The GTK 2.x program has a global profile /etc/gtk-2.0/gtkrc, which can set the font used by the GTK 2.x program. The contents of the file are as follows: Style "gtk-default-zh-cn" { FONT_NAME = "Bitstream Vera Sans 10, SIMSUN 10"} Class "gtkwidget" style "gtk-default-zh-cn" in English with the GTK 2.x program, using the 10th BitStream Vera Sans Font display, Chinese will use 10 The SIMSUN font display. The default font of the Qt program can be set in the "Control Center" - "Appearance and Topics" - "Font" in KDE, or run the Qtconfig Graphical Configuration Tool settings. But the setting of the control center is higher than the QTconfig tool. 1.2. X11 core font system

Configuring the X11 core font has two steps,

The first step is to establish a font directory that contains a font file in this directory. The second step is to configure the X server so that it can use these fonts.

I am using configured SIMSUN.TTC fonts as an example:

The x server font directory is generally built by default, such as / usr / x11r6 / lib / x11 / fonts / trueType. We copied SIMSUN.TTC to this directory. Born a font index file, if the font is only a fonts.dir index file, if it is a sharp font like SIMSUN.TTT, a fonts.scale index file is required. Index files can be generated automatically through tools, and if it is a TRUETYPE font, a TTMKFDIR tool can be used. Other fonts can be generated by two tools of MKFontDir and Mkfontscale. SIMSUN.TTC is a TRUETYPE font, so I use the TTMKFDIR tool to generate fonts.scale: debian: / usr / x11r6 / lib / x11 / fonts / trueType # TTMKFDIRFONTS.DIR file and fonts.scale content is the same, so you can copy it directly. If you don't have to copy, you can use the mkfontdir command, the result is the same. Set the XF86CONFIG-4 configuration file to determine the above font path and the X-letter module is properly loaded.

Section "Files" # fontpath "UNIX /: 7110" # local font server # ify # 旗舰/ lib / x11 / fonts / misc "fontpath" / usr / lib / x11 / fonts / cyrillic "fontpath" / usr / lib / x11 / fonts / 100dpi /: unscaled "fontpath" / usr / lib / x11 / fonts / 75dpi /: unscaled "fontpath" / usr / lib / x11 / fonts / type1 "fontpath" / usr / lib / x11 / fonts / cid "fontpath" / usr / lib / x11 / fonts / spetedo "fontpath" / usr / lib / X11 / fonts / 100dpi "fontpath" / usr / lib / x11 / fonts / 75dpi "endsection" module "# loading" glcore "load" bitmap "load" dbe "load" ddc "load" dri "load" extMod "# loading "freetype" LOAD "GLX" LOAD "INT10" LOAD "Record" Load "Speedo" LOAD "TYPE1" LOAD "VBE" LOAD "XTT" Endsection Font Module List: Bitmap: Bitmap font, supported font files are * .bdf, *. Pcf and * .snf. Type1: Type1 font, supported font files are * .pfa and * .pfb, as well as CidFonts. Speedo: BitStream Speedo font, supported font files are * .spd. Freetype: TrueType font, supported font files are * .ttf and * .ttc. XTT: Another TrueType font module, supported font files are * .ttf and * .ttc.

After restarting the X server, you can use the SIMSUN Chinese character. The xlsfonts command can list the X11 core fonts installed in the system.

If you are using the Debian system, you can use the Debian Font Manager tool to help you complete the above settings. Please refer to the contents of the "Debian Installation and Configuration" of this tool.

GTK 1.x program uses the X11 core font system. To use the SIMSUN font in GTK 1.x, you need to configure the /etc/gtk/gtkrc.zh_cn file, the content is as follows: # this file defines the fontsets for Chinese language (zh) using # The Simplified Chinese Standard Guobiao as in mainland China (cn) ## 1999, pablo saratxaga #style "gtk-default-zh-cn" {fontset = "- * - bitsTream Vera Serif-Medium-r-NORMAL - * - * - 120 - * - * - P - * - Microsoft-CP1252, / - * - SIMSUN-Medium-R-NORMAL - * - 12 - * - * - * - * - * - GBK-0 "} class" gtkwidget "style" GTK-Default-en-CN "

Such GTK 1.x programs can be displayed in Chinese, using a Simsun font, English using BitStream Vera Sans font.

转载请注明原文地址:https://www.9cbs.com/read-38936.html

New Post(0)