Remove the annoying HB_ prefix.

This commit is contained in:
Behdad Esfahbod 2006-12-21 22:31:31 -05:00
parent 6b4ce01da1
commit 01e4fcb032
1 changed files with 52 additions and 55 deletions

View File

@ -38,59 +38,59 @@ struct NAME { \
#define DEFINE_INT_TYPE0(NAME, type) DEFINE_INT_TYPE1 (NAME, type, hb_be_##type) #define DEFINE_INT_TYPE0(NAME, type) DEFINE_INT_TYPE1 (NAME, type, hb_be_##type)
#define DEFINE_INT_TYPE(NAME, u, w) DEFINE_INT_TYPE0 (NAME, u##int##w##_t) #define DEFINE_INT_TYPE(NAME, u, w) DEFINE_INT_TYPE0 (NAME, u##int##w##_t)
DEFINE_INT_TYPE (HB_BYTE, u, 8); /* 8-bit unsigned integer. */ DEFINE_INT_TYPE (BYTE, u, 8); /* 8-bit unsigned integer. */
DEFINE_INT_TYPE (HB_CHAR, , 8); /* 8-bit signed integer. */ DEFINE_INT_TYPE (CHAR, , 8); /* 8-bit signed integer. */
DEFINE_INT_TYPE (HB_USHORT, u, 16); /* 16-bit unsigned integer. */ DEFINE_INT_TYPE (USHORT, u, 16); /* 16-bit unsigned integer. */
DEFINE_INT_TYPE (HB_SHORT, , 16); /* 16-bit signed integer. */ DEFINE_INT_TYPE (SHORT, , 16); /* 16-bit signed integer. */
DEFINE_INT_TYPE (HB_ULONG, u, 32); /* 32-bit unsigned integer. */ DEFINE_INT_TYPE (ULONG, u, 32); /* 32-bit unsigned integer. */
DEFINE_INT_TYPE (HB_LONG, , 32); /* 32-bit signed integer. */ DEFINE_INT_TYPE (LONG, , 32); /* 32-bit signed integer. */
/* Date represented in number of seconds since 12:00 midnight, January 1, /* Date represented in number of seconds since 12:00 midnight, January 1,
* 1904. The value is represented as a signed 64-bit integer. */ * 1904. The value is represented as a signed 64-bit integer. */
DEFINE_INT_TYPE (HB_LONGDATETIME, , 64); DEFINE_INT_TYPE (LONGDATETIME, , 64);
/* 32-bit signed fixed-point number (16.16) */ /* 32-bit signed fixed-point number (16.16) */
struct HB_Fixed : HB_LONG { struct Fixed : LONG {
inline operator double(void) { return (uint32_t) this / 65536.; } inline operator double(void) { return (uint32_t) this / 65536.; }
inline int16_t int_part (void) { return (uint32_t) this >> 16; } inline int16_t int_part (void) { return (uint32_t) this >> 16; }
inline int16_t frac_part (void) { return (uint32_t) this & 0xffff; } inline int16_t frac_part (void) { return (uint32_t) this & 0xffff; }
}; };
/* Smallest measurable distance in the em space. */ /* Smallest measurable distance in the em space. */
struct HB_FUNIT; struct FUNIT;
/* 16-bit signed integer (SHORT) that describes a quantity in FUnits. */ /* 16-bit signed integer (SHORT) that describes a quantity in FUnits. */
struct HB_FWORD : HB_SHORT { struct FWORD : SHORT {
}; };
/* 16-bit unsigned integer (USHORT) that describes a quantity in FUnits. */ /* 16-bit unsigned integer (USHORT) that describes a quantity in FUnits. */
struct HB_UFWORD : HB_USHORT { struct UFWORD : USHORT {
}; };
/* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */ /* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */
struct HB_F2DOT14 : HB_SHORT { struct F2DOT14 : SHORT {
inline operator double() { return (uint32_t) this / 16384.; } inline operator double() { return (uint32_t) this / 16384.; }
}; };
/* Array of four uint8s (length = 32 bits) used to identify a script, language /* Array of four uint8s (length = 32 bits) used to identify a script, language
* system, feature, or baseline */ * system, feature, or baseline */
struct HB_Tag : public HB_ULONG { struct Tag : public ULONG {
inline HB_Tag (char *c) : HB_ULONG(c ? *(uint32_t*)c : 0) {} inline Tag (char *c) : ULONG(c ? *(uint32_t*)c : 0) {}
}; };
/* Glyph index number, same as uint16 (length = 16 bits) */ /* Glyph index number, same as uint16 (length = 16 bits) */
struct HB_GlyphID : HB_USHORT { struct GlyphID : USHORT {
}; };
/* Offset to a table, same as uint16 (length = 16 bits), NULL offset = 0x0000 */ /* Offset to a table, same as uint16 (length = 16 bits), NULL offset = 0x0000 */
struct HB_Offset : HB_USHORT { struct Offset : USHORT {
}; };
/* CheckSum */ /* CheckSum */
struct HB_CheckSum : HB_ULONG { struct CheckSum : ULONG {
static uint32_t CalcTableChecksum (HB_ULONG *Table, uint32_t Length) { static uint32_t CalcTableChecksum (ULONG *Table, uint32_t Length) {
uint32_t Sum = 0L; uint32_t Sum = 0L;
HB_ULONG *EndPtr = Table+((Length+3) & ~3) / sizeof(HB_ULONG); ULONG *EndPtr = Table+((Length+3) & ~3) / sizeof(ULONG);
while (Table < EndPtr) while (Table < EndPtr)
Sum += *Table++; Sum += *Table++;
@ -105,10 +105,10 @@ struct HB_CheckSum : HB_ULONG {
*/ */
struct HB_USHORT_Version : HB_USHORT { struct USHORT_Version : USHORT {
}; };
struct HB_Fixed_Version : HB_Fixed { struct Fixed_Version : Fixed {
inline int16_t major (void) { return this->int_part(); } inline int16_t major (void) { return this->int_part(); }
inline int16_t minor (void) { return this->frac_part(); } inline int16_t minor (void) { return this->frac_part(); }
}; };
@ -121,24 +121,22 @@ struct HB_Fixed_Version : HB_Fixed {
/* Offset Table */ /* Offset Table */
struct HB_OffsetTable { struct OffsetTable {
HB_Fixed_Version sfnt_version; /* 0x00010000 for version 1.0. */ Fixed_Version sfnt_version; /* 0x00010000 for version 1.0. */
HB_USHORT numTables; /* Number of tables. */ USHORT numTables; /* Number of tables. */
HB_USHORT searchRange; /* (Maximum power of 2 <= numTables) USHORT searchRange; /* (Maximum power of 2 <= numTables) x 16 */
* x 16 */ USHORT entrySelector; /* Log2(maximum power of 2 <= numTables). */
HB_USHORT entrySelector; /* Log2(maximum power of 2 <= USHORT rangeShift; /* NumTables x 16-searchRange. */
* numTables). */
HB_USHORT rangeShift; /* NumTables x 16-searchRange. */
}; };
/* Table Directory */ /* Table Directory */
struct HB_TableDirectory { struct TableDirectory {
HB_Tag tag; /* 4-byte identifier. */ Tag tag; /* 4-byte identifier. */
HB_CheckSum checkSum; /* CheckSum for this table. */ CheckSum checkSum; /* CheckSum for this table. */
HB_ULONG offset; /* Offset from beginning of TrueType font ULONG offset; /* Offset from beginning of TrueType font
* file. */ * file. */
HB_ULONG length; /* Length of this table. */ ULONG length; /* Length of this table. */
}; };
@ -149,30 +147,29 @@ struct HB_TableDirectory {
/* TTC Header Version 1.0 */ /* TTC Header Version 1.0 */
struct HB_TTCHeader { struct TTCHeader {
HB_Tag TTCTag; /* TrueType Collection ID string: 'ttcf' */ Tag TTCTag; /* TrueType Collection ID string: 'ttcf' */
HB_ULONG version; /* Version of the TTC Header (1.0 or 2.0), ULONG version; /* Version of the TTC Header (1.0 or 2.0),
* 0x00010000 or 0x00020000 */ * 0x00010000 or 0x00020000 */
HB_ULONG numFonts; /* Number of fonts in TTC */ ULONG numFonts; /* Number of fonts in TTC */
HB_ULONG offsetTable[0]; /* Array of offsets to the OffsetTable for ULONG offsetTable[0]; /* Array of offsets to the OffsetTable for each font
* each font from the beginning of the file. * from the beginning of the file.
* numFonts entries long. */ * numFonts entries long. */
inline int len(void) { return sizeof (HB_TTCHeader) inline int len(void) { return sizeof (TTCHeader)
+ sizeof (HB_ULONG) * numFonts; } + sizeof (ULONG) * numFonts; }
}; };
/* TTC Header Version 2.0 tail /* TTC Header Version 2.0 tail
* Follows after HB_TTCHeader with appropriate size for the offsetTable. */ * Follows after TTCHeader with appropriate size for the offsetTable. */
struct HB_TTCHeaderVersion2Tail { struct TTCHeaderVersion2Tail {
HB_ULONG ulDsigTag; /* Tag indicating that a DSIG table exists, ULONG ulDsigTag; /* Tag indicating that a DSIG table exists,
* 0x44534947 ('DSIG') (null if no signature) */ * 0x44534947 ('DSIG') (null if no signature) */
HB_ULONG ulDsigLength; /* The length (in bytes) of the DSIG table ULONG ulDsigLength; /* The length (in bytes) of the DSIG table (null if
* (null if no signature) */ * no signature) */
HB_ULONG ulDsigOffset; /* The offset (in bytes) of the DSIG table ULONG ulDsigOffset; /* The offset (in bytes) of the DSIG table from the
* from the beginning of the TTC file (null if * beginning of the TTC file (null if no signature) */
* no signature) */
}; };
@ -217,9 +214,9 @@ struct ScriptList {
int int
main (void) main (void)
{ {
HB_Tag y("abcd"); Tag y("abcd");
HB_Tag &x = y; Tag &x = y;
HB_BYTE b(0); BYTE b(0);
printf ("%d %04x %04x\n", sizeof (x), x+0, y+0); printf ("%d %04x %04x\n", sizeof (x), x+0, y+0);
return 0; return 0;