提交 01e4fcb0 编写于 作者: B Behdad Esfahbod

Remove the annoying HB_ prefix.

上级 6b4ce01d
......@@ -38,59 +38,59 @@ struct NAME { \
#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_INT_TYPE (HB_BYTE, u, 8); /* 8-bit unsigned integer. */
DEFINE_INT_TYPE (HB_CHAR, , 8); /* 8-bit signed integer. */
DEFINE_INT_TYPE (HB_USHORT, u, 16); /* 16-bit unsigned integer. */
DEFINE_INT_TYPE (HB_SHORT, , 16); /* 16-bit signed integer. */
DEFINE_INT_TYPE (HB_ULONG, u, 32); /* 32-bit unsigned integer. */
DEFINE_INT_TYPE (HB_LONG, , 32); /* 32-bit signed integer. */
DEFINE_INT_TYPE (BYTE, u, 8); /* 8-bit unsigned integer. */
DEFINE_INT_TYPE (CHAR, , 8); /* 8-bit signed integer. */
DEFINE_INT_TYPE (USHORT, u, 16); /* 16-bit unsigned integer. */
DEFINE_INT_TYPE (SHORT, , 16); /* 16-bit signed integer. */
DEFINE_INT_TYPE (ULONG, u, 32); /* 32-bit unsigned integer. */
DEFINE_INT_TYPE (LONG, , 32); /* 32-bit signed integer. */
/* Date represented in number of seconds since 12:00 midnight, January 1,
* 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) */
struct HB_Fixed : HB_LONG {
struct Fixed : LONG {
inline operator double(void) { return (uint32_t) this / 65536.; }
inline int16_t int_part (void) { return (uint32_t) this >> 16; }
inline int16_t frac_part (void) { return (uint32_t) this & 0xffff; }
};
/* Smallest measurable distance in the em space. */
struct HB_FUNIT;
struct FUNIT;
/* 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. */
struct HB_UFWORD : HB_USHORT {
struct UFWORD : USHORT {
};
/* 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.; }
};
/* Array of four uint8s (length = 32 bits) used to identify a script, language
* system, feature, or baseline */
struct HB_Tag : public HB_ULONG {
inline HB_Tag (char *c) : HB_ULONG(c ? *(uint32_t*)c : 0) {}
struct Tag : public ULONG {
inline Tag (char *c) : ULONG(c ? *(uint32_t*)c : 0) {}
};
/* 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 */
struct HB_Offset : HB_USHORT {
struct Offset : USHORT {
};
/* CheckSum */
struct HB_CheckSum : HB_ULONG {
static uint32_t CalcTableChecksum (HB_ULONG *Table, uint32_t Length) {
struct CheckSum : ULONG {
static uint32_t CalcTableChecksum (ULONG *Table, uint32_t Length) {
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)
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 minor (void) { return this->frac_part(); }
};
......@@ -121,24 +121,22 @@ struct HB_Fixed_Version : HB_Fixed {
/* Offset Table */
struct HB_OffsetTable {
HB_Fixed_Version sfnt_version; /* 0x00010000 for version 1.0. */
HB_USHORT numTables; /* Number of tables. */
HB_USHORT searchRange; /* (Maximum power of 2 <= numTables)
* x 16 */
HB_USHORT entrySelector; /* Log2(maximum power of 2 <=
* numTables). */
HB_USHORT rangeShift; /* NumTables x 16-searchRange. */
struct OffsetTable {
Fixed_Version sfnt_version; /* 0x00010000 for version 1.0. */
USHORT numTables; /* Number of tables. */
USHORT searchRange; /* (Maximum power of 2 <= numTables) x 16 */
USHORT entrySelector; /* Log2(maximum power of 2 <= numTables). */
USHORT rangeShift; /* NumTables x 16-searchRange. */
};
/* Table Directory */
struct HB_TableDirectory {
HB_Tag tag; /* 4-byte identifier. */
HB_CheckSum checkSum; /* CheckSum for this table. */
HB_ULONG offset; /* Offset from beginning of TrueType font
struct TableDirectory {
Tag tag; /* 4-byte identifier. */
CheckSum checkSum; /* CheckSum for this table. */
ULONG offset; /* Offset from beginning of TrueType font
* 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 */
struct HB_TTCHeader {
HB_Tag TTCTag; /* TrueType Collection ID string: 'ttcf' */
HB_ULONG version; /* Version of the TTC Header (1.0 or 2.0),
struct TTCHeader {
Tag TTCTag; /* TrueType Collection ID string: 'ttcf' */
ULONG version; /* Version of the TTC Header (1.0 or 2.0),
* 0x00010000 or 0x00020000 */
HB_ULONG numFonts; /* Number of fonts in TTC */
HB_ULONG offsetTable[0]; /* Array of offsets to the OffsetTable for
* each font from the beginning of the file.
ULONG numFonts; /* Number of fonts in TTC */
ULONG offsetTable[0]; /* Array of offsets to the OffsetTable for each font
* from the beginning of the file.
* numFonts entries long. */
inline int len(void) { return sizeof (HB_TTCHeader)
+ sizeof (HB_ULONG) * numFonts; }
inline int len(void) { return sizeof (TTCHeader)
+ sizeof (ULONG) * numFonts; }
};
/* TTC Header Version 2.0 tail
* Follows after HB_TTCHeader with appropriate size for the offsetTable. */
struct HB_TTCHeaderVersion2Tail {
HB_ULONG ulDsigTag; /* Tag indicating that a DSIG table exists,
* Follows after TTCHeader with appropriate size for the offsetTable. */
struct TTCHeaderVersion2Tail {
ULONG ulDsigTag; /* Tag indicating that a DSIG table exists,
* 0x44534947 ('DSIG') (null if no signature) */
HB_ULONG ulDsigLength; /* The length (in bytes) of the DSIG table
* (null if no signature) */
HB_ULONG ulDsigOffset; /* The offset (in bytes) of the DSIG table
* from the beginning of the TTC file (null if
ULONG ulDsigLength; /* The length (in bytes) of the DSIG table (null if
* no signature) */
ULONG ulDsigOffset; /* The offset (in bytes) of the DSIG table from the
* beginning of the TTC file (null if no signature) */
};
......@@ -217,9 +214,9 @@ struct ScriptList {
int
main (void)
{
HB_Tag y("abcd");
HB_Tag &x = y;
HB_BYTE b(0);
Tag y("abcd");
Tag &x = y;
BYTE b(0);
printf ("%d %04x %04x\n", sizeof (x), x+0, y+0);
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册