True type font tables


Published on

True Type Font Tables
Omer Salih Dawood Omer,
College of computer Science and Information Technology,
Sudan University of Science and Technology,

Published in: Technology, Art & Photos
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

True type font tables

  1. 1. True Type Font Tables Omer Salih Dawood Omer, College of computer Science and Information Technology, Sudan University of Science and Technology, June 22, 2011Abstract P latf orm F ontT ype RequiredF iles TrueType 1TTF play major roles in operating system because Windows TrueType Collection 1it represents fonts that contained in the system and PostScript Type 1 2you can add your own font, TTF consist from set OpenType 1of tables each table responsible from specific func- Windows style TT 1tion which collectively provide the main functional- Mac OS X OpenType 1ity of the TTF. This paper aimed to provide general PostScript Type 1 2overview of TTF and how to read the TTF content Linux TrueType 1to be readied by human. Linux PostScript Type 1 2 Table 1: TTF in different OS1 Introduction.1.1 True Type Font. ent smart rendering system producing the Apple Ad- vanced Typography (AAT) font specification. SILsThe primary font technology used on Microsoft Win- Graphite smart rendering system works by addingdows and the Mac OS is based on the TrueType spec- tables, too. This section is only concerned with theification. TrueType fonts are scalable which means tables which were part of the original TrueType spec-the glyphs can be displayed at any resolution and ification and which are still used in OpenType, AAT,any point size (though the glyphs may not look good and Graphite to describe glyphs and provide generalin extreme cases). A TrueType font is a binary font data [1].file containing a number of tables. There is a di-rectory of tables at the start of the file. The file 1.1.1 True Type Font tables in different Op-may contain only one table of each type, and the erating System.type is indicated by a case-sensitive four letter tag.Each table and the whole font have checksums. The The table 1 shows information about the various fontTrueType specification was developed by Apple and types on each platform [2].adopted by Microsoft. Later Microsoft and Adobeexpanded the specification to support smart render- 1.2 Open Type and PostScript glyphs. The new specification,which added more tables, was called OpenType. Ap- An OpenType font file contains data, in table format,ple also added tables to TrueType to support a differ- that comprises either a TrueType or a PostScript out- 1
  2. 2. DataT ype Description 3. Unicode support BYTE 8-bit unsigned integer CHAR 8-bit signed integer 4. Glyph alternates supported USHORT 16-bit unsigned integer 5. Advanced typography supported SHORT 16-bit signed integer UINT24 24-bit unsigned integer 6. Better protection of font data ULONG 32-bit unsigned integer 7. Font embedding controls LONG 32-bit signed integer LONG 32-bit signed integer Table 2: OTF Data Type 2 Background. 2.1 development of True Type Fontline font. Rasterizers use combinations of data from • Back in the late 1980s, it was clear to most of thethe tables contained in the font to render the True- major players in the personal computer worldType or PostScript glyph outlines. Some of this sup- that scalable font technology was going to beporting data is used no matter which outline format an important part of future operating used; some of the supporting data is specific to ei- Adobe was trying to get Apple and Microsoft tother TrueType or PostScript.[3] OpenType fonts may license its PostScript code for this purpose. Ap-have the extension .OTF or .TTF, depending on the ple and Microsoft agreed a cross-licensing andkind of outlines in the font and the creator’s desire for product development deal, the fruits of whichcompatibility on systems without native OpenType would be available to both parties: Microsoftsupport. would bring a PostScript-style graphics engine to • In all cases, fonts with only CFF data (no True- the table (TrueImage), while Apple would create Type outlines) always have an .OTF extension. a font system even better than Adobe’s • Fonts containing TrueType outlines may have ei- • In mid-1989, when they learned that Apple ther .OTF or .TTF, depending on the desire for would not be requiring its technology, they an- backward compatibility on older systems or with nounced a program, Adobe Type Manager, be- previous versions of the font. TrueType Collec- fore it had even been written,About a year later, tion fonts should have a .TTC extension whether you could buy ATM to display Adobe Type 1 or not the fonts have OpenType layout tables fonts on the Macintosh, without any help from present.[3] Apple. ATM was sold cheaply, or was bundled with fonts bought from Adobe.1.2.1 OTF Data Type • Apple had been developing what was to become TrueType from late 1987 At that time there weretable 2 show and describe open type font (OTF) data many competing font scaling technologies, andtypes [3] several would have been suitable for the Macin- tosh. Kaasila completed his work on TrueType,1.2.2 Benefits of Open Type Font [4] though it didn’t yet have that name, in AugustThere are many benefits from Open Type Font,as 1989.Follows : • Apple released TrueType to the world in March 1. Support for large character sets 1991 - the core engine in much the same form that Kaasila left it back in 1989. This first cus- 2. Multi-script character sets tomer version was an 80K add-on to System 6.0, 2
  3. 3. available until recently on the Apple website! number of TrueType tables[6]. The TTC Header The system needed fonts of course, and the first must be located at the beginning of the TTC file. TrueType fonts - Times Roman, Helvetica and The TTC file must contain a complete Table Direc- Courier - were great examples of what could be tory for each different font design. A TTC file Table done with the technology. Directory has exactly the same format as a TTF file Table Directory. The table offsets in all Table Di- • Microsoft introduced TrueType into Windows rectories within a TTC file are measured from the with version 3.1 in early 1992. Working with beginning of the TTC file. Each TrueType table in Monotype, they had created the superb core set a TTC file is referenced through the Table Directo- of fonts - TrueType versions of Times New Ro- ries of all fonts which use that table. Some of the man, Arial and Courier. These fonts showed, TrueType tables must appear multiple times, once just as Apple’s TrueTypes had, that scalable for each font included in the TTC; while other ta- fonts could generate bitmaps virtually as though bles should be shared by all fonts in the TTC. As each size had been designed by hand. an example, consider a TTC file which combines two • Only in August 1995, with the release of Win- Japanese fonts (Font1 and Font2). The fonts have dows 95, did Microsoft’s TrueType engine be- different kana designs (Kana1 and Kana2) but use come 32-bit, complete and reliable. Indeed, the same design for kanji. The TTC file contains a it now features greyscale rasterization (anti- single glyf table which includes both designs of kana aliasing), enhancing on-screen text substan- together with the kanji; both fonts Table Directories tially. Microsoft have commissioned some superb point to this glyf table. But each fonts Table Direc- new[5]. TrueType fonts that they give out free tory points to a different cmap table, which identifies on their website. The rehabilitation of TrueType the glyph set to use. Font1s cmap table points to is well underway [5]. the Kana1 region of the loca and glyf tables for kana glyphs, and to the kanji region for the kanji. Font2s cmap table points to the Kana2 region of the loca and2.2 TrueType Collection (TTC) glyf tables for kana glyphs, and to the same kanji re-A TrueType Collection (TTC) is a means of deliv- gion for the kanji.ering multiple TrueType fonts in a single file struc- The tables that should have a unique copy per fontture. TrueType Collections are most useful when the are those that are used by the system in identifyingfonts to be delivered together share many glyphs in the font and its character mapping, including cmap,common. By allowing multiple fonts to share glyph name, and OS/2. The tables that should be sharedsets, TTCs can result in a significant saving of file by all fonts in the TTC are those that define glyphspace. For example, a group of Japanese fonts may and instruction data or use glyph indices to accesseach have their own designs for the kana glyphs, but data: glyf, loca, hmtx, hdmx, LTSH, cvt , fpgm, prep,share identical designs for the kanji. With ordinary EBLC, EBDT, EBSC, maxp, and so on. In practice,TrueType font files, the only way to include the com- any tables which have identical data for two or moremon kanji glyphs is to copy their glyph data into each fonts may be shared. Creating a TrueType Collec-font. Since the kanji represent much more data than tion by combining existing TrueType font files is athe kana, this results in a great deal of wasteful du- non-trivial process. It involves paying close atten-plication of glyph data. TTCs were defined to solve tion the issue of glyph renumbering in a font andthis problem . the side effects that can result, in the cmap table and elsewhere. The fonts to be merged must also have compatible TrueType instructionsthat is, their2.2.1 TTC File Structure preprograms, function definitions, and control valuesA TrueType Collection file consists of a single TTC must not conflict[6].Header table, two or more Table Directories, and a TrueType Collection files use the filename suffix 3
  4. 4. N ame req Description T ype N ame Description name [req] Font Information USHORT numberOfGlyphs Number of glyphs glyf [req] Contains glyph outlines CHAR offset[numGlyphs] Difference between cmap [req] Contains multiple graphic index and mapping tables standard order of glyph post [req] contain glyph names OS/2 [req on spacing, font Table 4: glyph in the font file Windows] weight and font style head [req] font metrics and OpenType fonts with TrueType data. OpenType and checksum fonts with TrueType data may also use Version 3.0. CFF embedded PostScript OpenType fonts with CFF data use Version 3.0 only. glyphs kern kerning pair data • Version 1.0 This TrueType-based font file contains exactly Table 3: TTF Tables the 258 glyphs in the standard Macintosh True- Type font file.TTC • Version 2.0 This is the version required by TrueType-based2.2.2 TTC Header Table fonts to be used on Windows. This TrueType-The purpose of the TTC Header table is to locate the based font file contains glyphs not in the stan-different Table Directories within a TTC file. The dard Macintosh set or the ordering of the glyphsTTC Header is located at the beginning of the TTC in the TrueType font file is non-standard (again,file (offset = 0). It consists of an identification tag, a for the Macintosh). The glyph name array mapsversion number, a count of the number of TrueType the glyphs in this font to name index. If thefonts (Table Directories) in the file, and an array of name index is between 0 and 257, treat the nameoffsets to each Table Directory. index as a glyph index in the Macintosh stan- dard order. If the name index is between 258 and 32767, then subtract 258 and use that to in-3 True Type Font tables. dex into the list of Pascal strings at the end of the table. Thus a given font may map some of itsBelow is a list of the tables used in TrueType glyphs to the standard glyph names, and somefiles. Also included are tables added by OpenType, to its own names. Index numbers 32768 throughGraphite, and Apple. The table name is case sensi- 65535 are reserved for future use. If you do nottive and always consists of four eight-bit characters, want to associate a PostScript name with a par-which are spaces if the name below is less than four ticular glyph, use index number 0 which pointscharacters. The [req] label is placed on tables that are the name .notdef.required in fonts that contain TrueType outlines[7]. • Version 2.5 This version of the ’post’ table has been deprecated as of OpenType Specification3.1 PostScript v1.3. This version provides a space saving ta-This table contains additional information needed to ble for TrueType-based fonts which contain ause TrueType or OpenType fonts on PostScript print- pure subset of, or a simple reordering of, theers. This includes data for the FontInfo dictionary standard Macintosh glyph set. This version isentry and the PostScript names of all the glyphs. useful for TrueType-based font files that con-Versions 1.0, 2.0, and 2.5 refer to TrueType fonts tain only glyphs in the standard Macintosh glyph 4
  5. 5. set but which have those glyphs arranged in a non-standard order or which are missing some glyphs. The table contains one byte for each glyph in the font file. The byte is treated as a signed offset that maps the glyph index used in this font into the standard glyph index. In other words, assuming that the font contains the three glyphs A, B, and C which are the 37th, 38th, and 39th glyphs in the standard ordering, the ’post’ table would contain the bytes +36, +36, +36. This format has been deprecated by Apple, as of February 2000. • Version 3.0 This version is used by OpenType fonts with TrueType or CFF data. The version makes it possible to create a special font that is not burdened with a large ’post’ table set of glyph . names. This version specifies that no PostScript name information is provided for the glyphs in Figure 1: application Components this font file. The printing behavior of this ver- sion on PostScript printers is unspecified, except that it should not result in a fatal or unrecov- erable error. Some drivers may print nothing, 4.2 TTF Reader/Analyser other drivers may attempt to print using a de- fault naming scheme[8]. The TTF reader reads the TTF File contents and shows them to the user and it works as follows:4 Implementation 1. Open the specified TTF table.As shown in Figure 1 the Implementation consistfrom three parts : 1. TTF File 2. Calculate the numbers of table the contained into TTF File . 2. TTF File Reader/Analyzer. 3. TTF contents. 3. Read TTF tables name according to their num-The entire application developed using web program- berming language known as PHP which used in this ap-plication to read and present the TTF content to bereadied by human. 4.3 Show TTF contents4.1 TTF Filehere we specify the TTF file that we want to read its here we display the TTF tables name that generatedcontents from the TTF Reader/Analyser 5
  6. 6. 5 Result: [8] 7- otspec/post.htm figure[1]:application Results6 Conclusions:TTF File is essential in the system and provide im-portant functionality to the system ,and you can addyour own TTF file to the system, this paper explainTTF font and other fonts like open Type Font andpost Script ,and give approach to read the tables ofthe TTF FileReferences [1] item id=IWS-Chapter08#3054f18b [2] [3] otspec/otff.htm [4] [5] http://www.truetype- [6] spec/ttch03.doc [7] id=IWS-AppendixC 6