BigAdmin System Administration Portal
Feature Tech Tip
Print-friendly VersionPrint-friendly Version

How to Enable Embedded Bitmap Fonts

William Wei Xue, April 2008

In some TrueType fonts, there are several sizes of embedded bitmap fonts. What is the advantage of embedding bitmap fonts into TrueType fonts? Embedding bitmap fonts can improve the on-screen appearance of small pixel sizes. If you have a TrueType font that has embedded bitmaps, you can customize the bitmaps for a specific small pixel size or render the characters from the regular outline data. Of course, these embedded small-size bitmap fonts should be included in your TrueType font files. Here I give an example of how to enable embedded bitmap fonts for the UMing TrueType font (uming.ttf).

Note: This information is written for the Solaris Operating System, but it should also be suitable for other forms of UNIX, such as Linux.

The uming.ttf font supports embedded bitmaps for pixel sizes of 11, 12, 13, 14, 15 and 16. To show the effects of enabling embedded bitmap fonts, I use /usr/openwin/bin/xmag to magnify the test characters. Figure 1 shows a scalable TrueType font in 10 pt (absolute length size). This size should have embedded bitmap fonts, but in Figure 1 embedded bitmap fonts are disabled.

Fig. 1

Figure 1: Scalable TrueType Font Without Embedded Bitmap Fonts
(Click to Enlarge)

To enable embedded bitmap fonts, modify (or create) the /etc/fonts/fonts.conf file as follows:

<match target="font">
	<test name="prefer_bitmap">
		<bool>true</bool>
	</test>
	<test name="family">
		<string>AR PL ShanHeiSun Uni</string>
	</test>
	<test name="pixelsize" compare="more_eq">
		<double>11</double>
	</test>
	<test name="pixelsize" compare="less">
		<double>16</double>
	</test>
	<edit name="antialias" mode="assign">
		<bool>false</bool>
	</edit>
</match>

In the section <test name="prefer_bitmap">, set the value to true. The last section is set to disable anti-aliasing for bitmap fonts from 11 to 16 pixel size. (Anti-aliasing is a technique for minimizing distortion artifacts, known as aliasing, when representing a high-resolution signal at a lower resolution.) Then restart your application, and you will see the embed bitmap font, which looks like Figure 2.

Fig. 2

Figure 2: Scalable TrueType Font With Embedded Bitmap Fonts
(Click to Enlarge)

For More Information


Comments (latest comments first)

Discuss and comment on this resource in the BigAdmin Wiki

Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License.


BigAdmin
  
 
BigAdmin Upgrade Hub