True Type Fonts
From Luke Jackson
(diff) ←Older revision | Current revision | Newer revision→ (diff)
Contents |
Overview
The primary font technology used on Microsoft Windows and the Mac OS is based on the TrueType specification. TrueType fonts are scalable which means the glyphs can be displayed at any resolution and any point size (though the glyphs may not look good in extreme cases). A TrueType font is a binary file containing a number of tables. There is a directory of tables at the start of the file. The file may contain only one table of each type, and the type is indicated by a case-sensitive four letter tag. Each table and the whole font file have checksums.
The TrueType specification was developed by Apple and adopted by Microsoft. Later Microsoft and Adobe expanded the specification to support smart rendering and PostScript glyphs. The new specification, which added more tables, was called OpenType. Apple also added tables to TrueType to support a different smart rendering system producing the Apple Advanced Typography (AAT) font specification. SIL’s Graphite smart rendering system works by adding tables, too.
Data Tables
Platform
Name
This table stores text strings which an application can use to provide information about the font. Each string in the name table has a platform and encoding id corresponding to the platform and encoding ids in the cmap table. Each string also has a language id which can be used to support strings in different languages. For Windows (platform id 3) the language id is the same as a Windows LCID. For the Mac OS (platform id 1), script manager codes are used instead.
ID | Description |
---|---|
0 | Copyright notice |
1 | Font Family name. |
2 | Font Subfamily name. Font style (italic, oblique) and weight (light, bold, black, etc.). A font with no particular differences in weight or style (e.g. medium weight, not italic) should have the string "Regular" stored in this position. |
3 | Unique font identifier. Usually similar to 4 but with enough additional information to be globally unique. Often includes information from Id 8 and Id 0. |
4 | Full font name. This should be a combination of strings 1 and 2. Exception: if the font is “Regular” as indicated in string 2, then use only the family name contained in string 1. This is the font name that Windows will expose to users. |
5 | Version string. Must begin with the syntax ‘Version n.nn ‘ (upper case, lower case, or mixed, with a space following the number). |
6 | Postscript name for the font. |
7 | Trademark. Used to save any trademark notice/information for this font. Such information should be based on legal advice. This is distinctly separate from the copyright. |
8 | Manufacturer Name. |
9 | Designer. Name of the designer of the typeface. |
10 | Description. Description of the typeface. Can contain revision information, usage recommendations, history, features, etc. |
11 | URL Vendor. URL of font vendor (with protocol, e.g., http://, ftp://). If a unique serial number is embedded in the URL, it can be used to register the font. |
12 | URL Designer. URL of typeface designer (with protocol, e.g., http://, ftp://). |
13 | License description. Description of how the font may be legally used, or different example scenarios for licensed use. This field should be written in plain language, not legalese. |
14 | License information URL. Where additional licensing information can be found. |
15 | Reserved; Set to zero. |
16 | Preferred Family (Windows only). In Windows, the Family name is displayed in the font menu. The Subfamily name is presented as the Style name. For historical reasons, font families have contained a maximum of four styles, but font designers may group more than four fonts to a single family. The Preferred Family and Preferred Subfamily IDs allow font designers to include the preferred family/subfamily groupings. These IDs are only present if they are different from IDs 1 and 2. |
17 | Preferred Subfamily (Windows only). See above. |
18 | Compatible Full (Mac OS only). On the Mac OS, the menu name is constructed using the FOND resource. This usually matches the Full Name. If you want the name of the font to appear differently than the Full Name, you can insert the Compatible Full Name here. |
19 | Sample text. This can be the font name, or any other text that the designer thinks is the best sample text to show what the font looks like. |
20 | PostScript CID findfont name. |
21-255 | Reserved for future expansion. |
256-32767 | Font-specific names. |
Example (.SVG File)
Below is a text generated .svg file. You can match the element font-family of the text container to key id 1 (Font Family Name) in the Name table above.
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg xml:space="preserve"> <g> <text x="0" y="149.62448979592" font-size="161.33333333333" font-family="Hole-HeartedRegular" text-anchor="" fill="#D31818">Adrian</text> <text x="0" y="352.07346938776" font-size="161.33333333333" font-family="Hole-HeartedRegular" text-anchor="" fill="#D31818">was here!</text> </g> <font-face font-family="Hole-HeartedRegular"> <font-face-src><font-face-uri xlink:href="/local/www/us/img/fonts/ttf/hole-heartedregular.ttf" /> </font-face-src> </font-face> </svg>
Linux
An easy way to install Microsoft's TrueType core fonts on linux
Questions or comments? Contact me at noa@resare.com. Good luck! / noa News
* 060430 A long awaited overhaul. Many things are fixed, links updated. Selects a random mirror. Uses tahoma from word 97 viewer instead of the ie6 update so no windows license is needed. * 030331 Updated the package to match the new location of the Tahoma cab file on microsoft's download site * 021108 Added link to suse adaption of the .spec file * 021107 Updated the Tahoma font link, as Microsoft moved their file * 021026 Removed the python hack as it rarlely needed anyway. That means that only the spec file is interesting nowdays. Updated misc other things as well. * 021026 It seems like this page got linked. First The Register, then that article was linked from slashdot. * 020827 A friendly soul over at Microsoft informed me that the Tahoma font was never a part of the "core fonts for the web" initiative and has unclear licensing, so I've removed it * 020815 Microsoft pulls their fonts from their site. Fortunately, according to the End User License Agreement and the faq I have the right to redistribute the fonts in unaltered form. This right I intend to exercise. * 020409 Installing doesn't work on 1.1-2. Fixed in 1.1-3 * 020312 Upgrading doesn't work on versions prior to 1.1-2. You will need to remove the old package with 'rpm -e' and than install the new one with 'rpm -i'. * 020312 Version 1.1 o cabextract is now in a separate package, so no gcc toolchain is needed to follow the instructions o The Tahoma font is included
Just the fonts
The original unaltered .exe files as downloaded from microsoft.com when they were available here
If you don't have a rpm based distribution, you can compile the tool to extract the .ttf files from the .exe files, cabextract from source, found here How to install
Installing Microsoft's TrueType core fonts for the web on any rpm based linux box with TrueType support is now easy. The instructions below have been tested on various Red Hat and Fedora Core systems, but they are fairly generic so they should apply to any redhat-like linux distribution, such as mandrake or yellowdog. If you are running debian, please have a look here. If you are running suse, please have a look here
1.
Make sure you have the following rpm-packages installed from from your favourite distribution. Any version should do. * rpm-build * wget * A package that provides the ttmkfdir utility. For example o For Fedora Core and Red Hat Enterprise Linux 4, ttmkfdir o For old redhat releases, XFree86-font-utils o For mandrake-8.2, freetype-tools 2.
Install the cabextract utility. For users of Fedora Core it is available from extras. Others may want to compile it themselves from source, or download the source rpm from fedora extras and rebuild. 3.
Download the latest msttcorefonts spec file from here 4.
If you haven't done so already, set up an rpm build environment in your home directory. You can to this by adding the line %_topdir %(echo $HOME)/rpmbuild to your $HOME/.rpmmacros and create the directories $HOME/rpmbuild/BUILD and $HOME/rpmbuild/RPMS/noarch 5.
Build the binary rpm with this command:
$ rpmbuild -bb msttcorefonts-2.0-1.spec
This will download the fonts from a Sourcforge mirror (about 8 megs) and repackage them so that they can be easily installed. 6.
Install the newly built rpm using the following command (you will need to be root):
# rpm -ivh $HOME/rpmbuild/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm
7.
You might need to reload the X font server. Normally this is done as a part of the installation process (this is done by chkfontpath). However in some situations it seems like you need to reload or restart the font server manually. I am told that the last argument needs to be restart and not reload on Mandrake 9.0
# /sbin/service xfs reload
A bug in RedHat 8.0 makes the X server lose the connection to the font server if the font server is restarted instead of reloaded. That will cause assorted strange behaviour (changed fonts in newly opened applications, applications hanging). Logging out and logging in again will solve the problems, or just use 'reload' instead of 'restart'. 8. Enjoy your new high quality fonts. To verify that the installation succeeded, please use the command 'xlsfonts | grep ^-microsoft'. You should see a whole lot of microsoft font names there. Please note that you need to restart all programs that you want to make aware of the new fonts. Note also that not all fonts have 'microsoft' in their name, some of them will be from 'monotype' instead.
Features
* Does not distribute Microsoft's fonts in a prohibited way (to the best of my knowledge that is) * Doesn't bypass the rpm database like other font install scripts