// TTF.h ////////////////////////////////////////////////////////////////////////////////////////////////////// // Macros for TrueType portability #define FS_2BYTE(p) ( ((unsigned short)((p)[0]) << 8) | (p)[1]) #define FS_4BYTE(p) ( FS_2BYTE((p)+2) | ( (FS_2BYTE(p)+0L) << 16) ) #define SWAPW(a) ((short) FS_2BYTE( (unsigned char *)(&a) )) #define SWAPL(a) ((long) FS_4BYTE( (unsigned char *)(&a) )) typedef short int16; typedef unsigned short uint16; typedef long int32; typedef unsigned long uint32; typedef long sfnt_TableTag; typedef struct { uint16 platformID; uint16 specificID; uint16 languageID; uint16 nameID; uint16 length; uint16 offset; } sfnt_NameRecord; typedef struct { uint16 format; uint16 count; uint16 stringOffset; } sfnt_NamingTable; typedef struct { sfnt_TableTag tag; uint32 checkSum; uint32 offset; uint32 length; } sfnt_DirectoryEntry; typedef struct { int32 version; /* 0x10000 (1.0) */ uint16 numOffsets; /* number of tables */ uint16 searchRange; /* (max2 <= numOffsets)*16 */ uint16 entrySelector; /* log2 (max2 <= numOffsets) */ uint16 rangeShift; /* numOffsets*16-searchRange*/ sfnt_DirectoryEntry table[1]; /* table[numOffsets] */ } sfnt_OffsetTable; #define OFFSETTABLESIZE 12 /* not including any entries */ #define tag_NamingTable 0x656d616e /* 'name' */ namespace TTF { enum { AppleUnicode = 0, Macintosh = 1, ISO = 2, Microsoft = 3 }; enum { Copyright = 0, Family = 1, Subfamily = 2, ID = 3, Name = 4, Version = 5, PostscriptName = 6, Trademark = 7 }; };