in ttfonts Online Help Contents
TTFonts Online Help Contents

QuickStart:

1.  Push the "EnumFonts" button.

2.  Mouse click on one of the fonts displayed.

3.  Modify the values in the LOGFONT dialog.

4.  Push the "CreateFont" button.

5.  Observe the results in the "Display" window.

More Information:

Overview	Advanced Features

Printing	True Type Information

Display Window	EnumFonts Window

References


Overview

The TTFonts program is designed to provide the user an easy interface to the API calls related to the font system.  It will not protect against meaningless values, nor will it hide system oddities.  Most of the buttons on the toolbar are self explanatory and represent a single system API.

Pressing the EnumFonts button will show all of the face names listed horizontally, and each of the fonts within that face name listed vertically below it, see EnumFontsin .  TrueType fonts will be marked with a [image] bitmap.  Fonts that have the DEVICE_FONTTYPE bit on will be marked with a small bitmap image of a printer [image].  When the enumeration windows are showing the user can click the left mouse button to copy the information about a selected font into the LOGFONT and TEXTMETRIC dialogs.  The user can dismiss this window without changing the dialog boxes by clicking with the right mouse button or typing any character.

The Display Window is able to operate in any one of three modes.  These are listed in the "Display" menu.  The first just writes "Hello" in the middle of the screen, and it grids the background.  This is useful when utilizing the lfEscapement and lfOrientation fields of the LOGFONT structure.  The second mode writes all of the glyphs between the tmFirstChar and tmLastChar values stored in the TEXTMETRIC structure.  The final mode is used only for true type fonts.  It calls GetFontData, finds the 'cmap' table, and displays glyphs from the different ranges in this table.  Use the horizontal scroll bar in the display window to step through the ranges.


Advanced
Advanced Features

Shows all of the fonts installed on the display in their own type face. (See  EnumFonts).

Lists the fonts available to the default printer.

Provides user friendly, structured access to GetFontData().

Reads the 'cmap' table and shows all of the glyphs in a true type font.  (See  Display Window).

Able to print to the default printer.  (See  Printing).


Display Window

The "Display" Window operates in one of three modes.  This may be controlled by using the "Display" menu.  The modes are:

"Hello"	(single string written in the center)

tmFirstChar, tmLastChar	(range from TEXTMETRIC structure)

All Glyphs	(for true type fonts, show all glyphs from all ranges)

For the later two modes, if there are more characters than will fit in the window, the vertical scroll bar may be used to scroll through them.

The third mode works by calling GetFontData(), finding the 'cmap' table, and then using the code point ranges from this table.  The horizontal scroll bar will appear when in this mode, and may be used to step through the different ranges.  The current code point range that is being displayed is shown in the title bar of this window.


EnumFonts Window

There are two "EnumFonts" windows.  One lists all of the fonts available to the display; the other lists all of the fonts available to the default printer.  Both windows show the results of calling the EnumFonts() API.  The typeface names are listed horizontally.  The different variations for each type face are listed vertically.  TrueType fonts will be marked with a [image] bitmap.  Fonts that have the DEVICE_FONTTYPE bit on will be marked with a small bitmap image of a printer [image].

These two windows are maximized as a result of selecting "EnumFonts" in the "Control" menu, or as a result of hitting the "EnumFonts" buttons on the toolbar.  When one the windows is maximized, clicking the left mouse button will cause the LOGFONT and TEXTMETRIC information to be copied into their respective dialogs, and the EnumFonts window will be minimized.  Notice that this information is stored from the call to EnumFonts().  It is necessary to hit the "CreateFont" button to see the resulting logical font in the display window.


TrueType
TrueType Information

TrueType fonts are marked with a [image] bitmap in the EnumFontswindows.

Use "Display" menu to check "All Glyphs from FontData" in order to see all of the different ranges of codepoints in the  Display Window.  Notice that the list of codepoints covered is not well handled by the existing API since it will only specify contiguous ranges in the TEXTMETRIC structure.  In order to get this information, the program uses GetFontData() and the 'cmap' table.  The format of the 'cmap' table is documented in the TrueType font Specification, seeReferences.


Printing

The "Control" menu contains an item labeled "Print."  Selecting this will send a job to the default printer, the same printer used for EnumFonts (Printer).  First the program will print a small header.  If the font returns information with GetOutlineTextMetrics() then the otmpFullName field is written.  After that, the contents of this print job are dependent upon the mode of the Display Window.  In the first two modes the output to the printer should be very similar to the contents of the display window.  In the "All Glyphs" mode, the output will print each code point range one after the other.  Each range is labeled and separated from the previous range by a horizontal line.

NOTICE:  The logical font created in the print job results from the same LOGFONT parameters as were used to create the font in the display window.  Since the resolution of the printer is probably much greater, and since the size is in "pels," fonts will appear much smaller on the printer.  There is no attempt at WYSIWYG output.  To make decent sized output on the printer, increase the lfHeight parameter so that the font in the display window looks quite large, then print.  For a 300dpi printer, setting lfHeight to 100 will print characters that are 1/3 inch high.


References/more information
References

TTFonts was written by Steve Firebaugh in Microsoft's Developer Support.  Look for us in the MSWIN32 forum of Compuserve.  Questions or bug reports related to this program should be posted there.

Understanding the 'cmap' table is most easily possible with a specification for TrueType font files.  This is available from many sources including the following:

Microsoft Software Library.  (Available on Compuserve by "GO MDKB" then search for keyword TTSPEC1.)

Anonymous ftp on ftp.uu.net in vendor/microsoft/TrueType-Info.

To learn all about unicode, including the names given to the different code point ranges, the best reference is the following two volume book available from Addison-Wesley:

The Unicode Standard

World-wide character encoding

Version 1.0

Vol 1: ISBN 0-201-56788-1

Vol 2: ISBN 0-201-60845-6