uLib  User mode C/C++ extended API library for Win32 programmers.
TrueType Font File Struct

Module Description

Partial declarations for the TTF file format.

Note: TrueType data is big endian !
You need to use _byteswap_ushort & co. before using the data.

Groups

 Optional Tables
 Other optional TTF tables..
 

Classes

struct  TTFDirEntry
 
struct  TTFDirectory
 
struct  TTFNameRec
 
struct  TTFNames
 

Enumerations

enum  eTTTableId {
  TTT_CMAP = 0x70616D63, TTT_GLYF = 0x66796C67, TTT_HEAD = 0x64616568, TTT_HHEA = 0x61656868,
  TTT_HMTX = 0x78746D68, TTT_LOCA = 0x61636F6C, TTT_MAXP = 0x7078616D, TTT_NAME = 0x656D616E,
  TTT_POST = 0x74736F70, TTT_OS2 = 0x322F534F
}
 
enum  eTTFPlatform { TTNP_APPLE, TTNP_MAC, TTNP_ISO, TTNP_MS }
 
enum  eMSEncoding { TTNE_MS_UNDEF, TTNE_MS_UGL }
 
enum  eNameTblIndex {
  TTNI_COPYRIGHT, TTNI_FAMILY, TTNI_SUBFAMILY, TTNI_FONTNAME,
  TTNI_FULLNAME, TTNI_VERSION, TTNI_POSTSCRIPT, TTNI_TRADEMARK
}
 

Class Documentation

◆ TTFDirEntry

struct TTFDirEntry

TTF directory entry.

Definition at line 30 of file TTFFile.h.

Class Members
ULONG Tag

FourCC identifier.

ULONG Checksum

Checksum for this table.

ULONG Offset

Offset from beginning of file.

ULONG Length

Length of this table.

◆ TTFDirectory

struct TTFDirectory

TrueType Directory - At offset 0 in the TTF file..

Definition at line 94 of file TTFFile.h.

Class Members
FIXED Version

16.16, 0x00010000 for version 1.0.

USHORT NrTables

Nr of tables in this file.

USHORT Range

(Maximum power of 2 <= NrTables) x 16.

USHORT Selector

Log2(maximum power of 2 <= NrTables).

USHORT Shift

NumTables x 16 - Range.

TTFDirEntry Entry[10]

Minimum directory, per spec.

◆ TTFNameRec

struct TTFNameRec

An entry in the TTF name table..

Definition at line 116 of file TTFFile.h.

Class Members
USHORT Platform

Platform ID.

USHORT Encoding

Platform-specific encoding ID.

USHORT Language

Language ID.

USHORT Id

Name ID.

USHORT Length

String length (in bytes).

USHORT Offset

String offset from start of storage area (in bytes).

◆ TTFNames

struct TTFNames

TTF Names table..

Definition at line 163 of file TTFFile.h.

Class Members
USHORT Format

Format selector (=0).

USHORT NrNames

Number of NameRecords that follow n.

USHORT Offset

Offset to start of string storage (from start of table).

TTFNameRec Names[1]

(Variable) The NameRecords.

Enumeration Type Documentation

◆ eTTTableId

enum eTTTableId

Required Tables (TTT : TrueTypeTable).
Note: These table tags are defined as-is.

Enumerator
TTT_CMAP 

'cmap' - Character to glyph mapping

TTT_GLYF 

'glyf' - Glyph data

TTT_HEAD 

'head' - Font header

TTT_HHEA 

'hhea' - Horizontal header

TTT_HMTX 

'hmtx' - Horizontal metrics

TTT_LOCA 

'loca' - Index to location

TTT_MAXP 

'maxp' - Maximum profile

TTT_NAME 

'name' - Naming table

TTT_POST 

'post' - PostScript information

TTT_OS2 

'OS/2' - OS/2 and Windows specific metrics

Definition at line 44 of file TTFFile.h.

◆ eTTFPlatform

TTF Platforms..

Enumerator
TTNP_APPLE 

Apple Unicode, Specific encoding = none

TTNP_MAC 

Macintosh, Specific encoding = Script manager code

TTNP_ISO 

ISO, Specific encoding = ISO encoding

TTNP_MS 

Microsoft, Specific encoding = Microsoft encoding

Definition at line 131 of file TTFFile.h.

◆ eMSEncoding

Microsoft platform-specific encoding IDs (platform ID = 3)

Enumerator
TTNE_MS_UNDEF 

Undefined character set or indexing scheme.

TTNE_MS_UGL 

UGL character set with Unicode indexing scheme.

Definition at line 141 of file TTFFile.h.

◆ eNameTblIndex

Predefined Name Table IDs..

Enumerator
TTNI_COPYRIGHT 

Copyright notice.

TTNI_FAMILY 

Font Family name

TTNI_SUBFAMILY 

Font Subfamily name; for purposes of definition, this is assumed to address style (italic, oblique) and weight (light, bold, black, etc.) only. A font with no particular differences in weight or style (e.g. medium weight, not italic and fsSelection bit 6 set) should have the string 'Regular' stored in this position.

TTNI_FONTNAME 

Unique font identifier

TTNI_FULLNAME 

Full font name; this should simply be a combination of strings 1 and 2. Exception: if string 2 is 'Regular', then use only string 1. This is the font name that Windows will expose to users.

TTNI_VERSION 

Version string. In n.nn format.

TTNI_POSTSCRIPT 

Postscript name for the font.

TTNI_TRADEMARK 

Trademark; this is 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.

Definition at line 149 of file TTFFile.h.