Misc cleanup
This commit is contained in:
parent
4c2556cb4c
commit
303fe62824
10
src/Makefile
10
src/Makefile
|
@ -1,5 +1,11 @@
|
|||
all: main
|
||||
|
||||
CXXFLAGS = -Wall -Wextra `pkg-config --cflags --libs glib-2.0`
|
||||
CPPFLAGS = -Wall -Wextra `pkg-config --cflags glib-2.0`
|
||||
LDFLAGS = `pkg-config --libs glib-2.0`
|
||||
CXX = gcc $(GCCOPTS) -fno-rtti -fno-exceptions -Wabi -Wpadded -Wcast-align
|
||||
|
||||
main: *.h
|
||||
main: main.cc *.h
|
||||
$(CXX) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f main main.o
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
#include "harfbuzz-open-private.h"
|
||||
|
||||
struct GDEFHeader {
|
||||
/* TODO */
|
||||
|
||||
private:
|
||||
Fixed version; /* Version of the GDEF table--initially
|
||||
* 0x00010000 */
|
||||
Offset glyphClassDef; /* Offset to class definition table
|
||||
|
@ -19,6 +22,7 @@ struct GDEFHeader {
|
|||
* mark attachment type--from beginning
|
||||
* of GDEF header (may be NULL) */
|
||||
};
|
||||
ASSERT_SIZE (GDEFHeader, 12);
|
||||
|
||||
struct GlyphClassDef : ClassDef {
|
||||
static const uint16_t BaseGlyph = 0x0001u;
|
||||
|
@ -27,10 +31,24 @@ struct GlyphClassDef : ClassDef {
|
|||
static const uint16_t ComponentGlyph = 0x0004u;
|
||||
};
|
||||
|
||||
struct AttachPoint;
|
||||
|
||||
struct AttachList {
|
||||
/* XXX */
|
||||
/* AttachPoint tables, in Coverage Index order */
|
||||
/* TODO get attach lists */
|
||||
/* DEFINE_INDIRECT_OFFSET_ARRAY_TYPE (AttachPoint, attachPoint, glyphCount, get_coverage);
|
||||
|
||||
// get_coverage
|
||||
|
||||
inline Coverage* get_default_language_system (void) {
|
||||
if (!defaultLangSys)
|
||||
return NULL;
|
||||
return (LangSys *)((char*)this + defaultLangSys);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
private:
|
||||
Offset coverage; /* Offset to Coverage table -- from
|
||||
* beginning of AttachList table */
|
||||
USHORT glyphCount; /* Number of glyphs with attachment
|
||||
|
@ -39,15 +57,18 @@ struct AttachList {
|
|||
* tables--from beginning of AttachList
|
||||
* table--in Coverage Index order */
|
||||
};
|
||||
ASSERT_SIZE (AttachList, 4);
|
||||
|
||||
struct AttachPoint {
|
||||
/* XXX */
|
||||
/* TODO */
|
||||
|
||||
private:
|
||||
USHORT pointCount; /* Number of attachment points on
|
||||
* this glyph */
|
||||
USHORT pointIndex[]; /* Array of contour point indices--in
|
||||
* increasing numerical order */
|
||||
};
|
||||
ASSERT_SIZE (AttachPoint, 2);
|
||||
|
||||
/*
|
||||
* Ligature Caret Table
|
||||
|
@ -56,8 +77,9 @@ struct AttachPoint {
|
|||
struct CaretValue;
|
||||
|
||||
struct LigCaretList {
|
||||
/* XXX */
|
||||
/* TODO */
|
||||
|
||||
private:
|
||||
Offset coverage; /* Offset to Coverage table--from
|
||||
* beginning of LigCaretList table */
|
||||
USHORT ligGlyphCount; /* Number of ligature glyphs */
|
||||
|
@ -66,12 +88,14 @@ struct LigCaretList {
|
|||
* LigCaretList table--in Coverage
|
||||
* Index order */
|
||||
};
|
||||
ASSERT_SIZE (LigCaretList, 4);
|
||||
|
||||
struct LigGlyph {
|
||||
/* Caret value tables, in increasing coordinate order */
|
||||
DEFINE_OFFSET_ARRAY_TYPE (CaretValue, caretValue, caretCount);
|
||||
/* XXX */
|
||||
/* TODO */
|
||||
|
||||
private:
|
||||
USHORT caretCount; /* Number of CaretValues for this
|
||||
* ligature (components - 1) */
|
||||
Offset caretValue[]; /* Array of offsets to CaretValue
|
||||
|
@ -79,40 +103,50 @@ struct LigGlyph {
|
|||
* table--in increasing coordinate
|
||||
* order */
|
||||
};
|
||||
ASSERT_SIZE (LigGlyph, 2);
|
||||
|
||||
struct CaretValueFormat1 {
|
||||
|
||||
inline int get_caret_value (int ppem) const {
|
||||
return /* TODO garbage */ coordinate / ppem;
|
||||
}
|
||||
|
||||
private:
|
||||
USHORT caretValueFormat; /* Format identifier--format = 1 */
|
||||
SHORT coordinate; /* X or Y value, in design units */
|
||||
|
||||
inline int get_caret_value (int ppem) const {
|
||||
return /* XXX garbage */ coordinate / ppem;
|
||||
}
|
||||
};
|
||||
ASSERT_SIZE (CaretValueFormat1, 4);
|
||||
|
||||
struct CaretValueFormat2 {
|
||||
USHORT caretValueFormat; /* Format identifier--format = 2 */
|
||||
USHORT caretValuePoint; /* Contour point index on glyph */
|
||||
|
||||
inline int get_caret_value (int ppem) const {
|
||||
return /* XXX garbage */ 0 / ppem;
|
||||
return /* TODO garbage */ 0 / ppem;
|
||||
}
|
||||
|
||||
private:
|
||||
USHORT caretValueFormat; /* Format identifier--format = 2 */
|
||||
USHORT caretValuePoint; /* Contour point index on glyph */
|
||||
};
|
||||
ASSERT_SIZE (CaretValueFormat2, 4);
|
||||
|
||||
struct CaretValueFormat3 {
|
||||
|
||||
inline const Device* get_device (void) const {
|
||||
return (const Device*)((const char*)this + deviceTable);
|
||||
}
|
||||
|
||||
inline int get_caret_value (int ppem) const {
|
||||
return /* TODO garbage */ (coordinate + get_device()->get_delta (ppem)) / ppem;
|
||||
}
|
||||
|
||||
private:
|
||||
USHORT caretValueFormat; /* Format identifier--format = 3 */
|
||||
SHORT coordinate; /* X or Y value, in design units */
|
||||
Offset deviceTable; /* Offset to Device table for X or Y
|
||||
* value--from beginning of CaretValue
|
||||
* table */
|
||||
|
||||
inline int get_caret_value (int ppem) const {
|
||||
return /* XXX garbage */ (coordinate + get_device()->get_delta (ppem)) / ppem;
|
||||
}
|
||||
};
|
||||
ASSERT_SIZE (CaretValueFormat3, 6);
|
||||
|
||||
struct CaretValue {
|
||||
DEFINE_NON_INSTANTIABLE(CaretValue);
|
||||
|
@ -136,12 +170,13 @@ struct CaretValue {
|
|||
}
|
||||
}
|
||||
|
||||
private:
|
||||
union {
|
||||
USHORT caretValueFormat; /* Format identifier */
|
||||
CaretValueFormat1 format1;
|
||||
CaretValueFormat2 format2;
|
||||
CaretValueFormat3 format3;
|
||||
/* XXX old HarfBuzz code has a format 4 here! */
|
||||
/* FIXME old HarfBuzz code has a format 4 here! */
|
||||
} u;
|
||||
};
|
||||
|
||||
|
|
|
@ -116,22 +116,37 @@
|
|||
|
||||
|
||||
DEFINE_INT_TYPE_STRUCT (BYTE, u, 8); /* 8-bit unsigned integer. */
|
||||
ASSERT_SIZE (BYTE, 1);
|
||||
DEFINE_INT_TYPE_STRUCT (CHAR, , 8); /* 8-bit signed integer. */
|
||||
ASSERT_SIZE (CHAR, 1);
|
||||
DEFINE_INT_TYPE_STRUCT (USHORT, u, 16); /* 16-bit unsigned integer. */
|
||||
ASSERT_SIZE (USHORT, 2);
|
||||
DEFINE_INT_TYPE_STRUCT (SHORT, , 16); /* 16-bit signed integer. */
|
||||
ASSERT_SIZE (SHORT, 2);
|
||||
DEFINE_INT_TYPE_STRUCT (ULONG, u, 32); /* 32-bit unsigned integer. */
|
||||
ASSERT_SIZE (ULONG, 4);
|
||||
DEFINE_INT_TYPE_STRUCT (LONG, , 32); /* 32-bit signed integer. */
|
||||
ASSERT_SIZE (LONG, 4);
|
||||
|
||||
/* 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_STRUCT (LONGDATETIME, , 64);
|
||||
|
||||
/* 32-bit signed fixed-point number (16.16) */
|
||||
struct Fixed : LONG {
|
||||
struct Fixed {
|
||||
inline Fixed& operator = (int32_t v) { i = (int16_t) (v >> 16); f = (uint16_t) v; return *this; } \
|
||||
inline operator int32_t(void) const { return (((int32_t) i) << 16) + (uint16_t) f; } \
|
||||
inline bool operator== (Fixed o) const { return i == o.i && f == o.f; } \
|
||||
|
||||
inline operator double(void) const { return (uint32_t) this / 65536.; }
|
||||
inline int16_t int_part (void) const { return (uint32_t) this >> 16; }
|
||||
inline int16_t frac_part (void) const { return (uint32_t) this & 0xffff; }
|
||||
inline int16_t int_part (void) const { return i; }
|
||||
inline uint16_t frac_part (void) const { return f; }
|
||||
|
||||
private:
|
||||
SHORT i;
|
||||
USHORT f;
|
||||
};
|
||||
ASSERT_SIZE (Fixed, 4);
|
||||
|
||||
/* Smallest measurable distance in the em space. */
|
||||
struct FUNIT;
|
||||
|
@ -139,15 +154,18 @@ struct FUNIT;
|
|||
/* 16-bit signed integer (SHORT) that describes a quantity in FUnits. */
|
||||
struct FWORD : SHORT {
|
||||
};
|
||||
ASSERT_SIZE (FWORD, 2);
|
||||
|
||||
/* 16-bit unsigned integer (USHORT) that describes a quantity in FUnits. */
|
||||
struct UFWORD : USHORT {
|
||||
};
|
||||
ASSERT_SIZE (UFWORD, 2);
|
||||
|
||||
/* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */
|
||||
struct F2DOT14 : SHORT {
|
||||
inline operator double() const { return (uint32_t) this / 16384.; }
|
||||
};
|
||||
ASSERT_SIZE (F2DOT14, 2);
|
||||
|
||||
/* Array of four uint8s (length = 32 bits) used to identify a script, language
|
||||
* system, feature, or baseline */
|
||||
|
@ -162,14 +180,18 @@ struct Tag {
|
|||
inline operator const char* (void) const { return (const char *)this; }
|
||||
inline operator char* (void) { return (char *)this; }
|
||||
|
||||
private: char v[4];
|
||||
private:
|
||||
char v[4];
|
||||
};
|
||||
ASSERT_SIZE (Tag, 4);
|
||||
|
||||
/* Glyph index number, same as uint16 (length = 16 bits) */
|
||||
DEFINE_INT_TYPE_STRUCT (GlyphID, u, 16);
|
||||
ASSERT_SIZE (GlyphID, 2);
|
||||
|
||||
/* Offset to a table, same as uint16 (length = 16 bits), NULL offset = 0x0000 */
|
||||
DEFINE_INT_TYPE_STRUCT (Offset, u, 16);
|
||||
ASSERT_SIZE (Offset, 2);
|
||||
|
||||
/* CheckSum */
|
||||
struct CheckSum : ULONG {
|
||||
|
@ -182,6 +204,7 @@ struct CheckSum : ULONG {
|
|||
return Sum;
|
||||
}
|
||||
};
|
||||
ASSERT_SIZE (CheckSum, 4);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -190,11 +213,13 @@ struct CheckSum : ULONG {
|
|||
|
||||
struct USHORT_Version : USHORT {
|
||||
};
|
||||
ASSERT_SIZE (USHORT_Version, 2);
|
||||
|
||||
struct Fixed_Version : Fixed {
|
||||
inline int16_t major (void) const { return this->int_part(); }
|
||||
inline int16_t minor (void) const { return this->frac_part(); }
|
||||
};
|
||||
ASSERT_SIZE (Fixed_Version, 4);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -206,18 +231,29 @@ struct OffsetTable;
|
|||
struct TTCHeader;
|
||||
|
||||
typedef struct TableDirectory {
|
||||
|
||||
friend struct OpenTypeFontFile;
|
||||
|
||||
inline const Tag& get_tag (void) const { return tag; }
|
||||
inline unsigned long get_checksum (void) const { return checkSum; }
|
||||
inline unsigned long get_offset (void) const { return offset; }
|
||||
inline unsigned long get_length (void) const { return length; }
|
||||
|
||||
private:
|
||||
Tag tag; /* 4-byte identifier. */
|
||||
CheckSum checkSum; /* CheckSum for this table. */
|
||||
ULONG offset; /* Offset from beginning of TrueType font
|
||||
* file. */
|
||||
ULONG length; /* Length of this table. */
|
||||
} OpenTypeTable;
|
||||
ASSERT_SIZE (TableDirectory, 16);
|
||||
|
||||
typedef struct OffsetTable {
|
||||
/* OpenTypeTables, in no particular order */
|
||||
DEFINE_ARRAY_TYPE (TableDirectory, tableDir, numTables);
|
||||
// TODO: Implement find_table
|
||||
|
||||
private:
|
||||
Tag sfnt_version; /* '\0\001\0\00' if TrueType / 'OTTO' if CFF */
|
||||
USHORT numTables; /* Number of tables. */
|
||||
USHORT searchRange; /* (Maximum power of 2 <= numTables) x 16 */
|
||||
|
@ -225,6 +261,7 @@ typedef struct OffsetTable {
|
|||
USHORT rangeShift; /* NumTables x 16-searchRange. */
|
||||
TableDirectory tableDir[]; /* TableDirectory entries. numTables items */
|
||||
} OpenTypeFontFace;
|
||||
ASSERT_SIZE (OffsetTable, 12);
|
||||
|
||||
/*
|
||||
* TrueType Collections
|
||||
|
@ -234,6 +271,7 @@ struct TTCHeader {
|
|||
/* OpenTypeFontFaces, in no particular order */
|
||||
DEFINE_OFFSET_ARRAY_TYPE (OffsetTable, offsetTable, numFonts);
|
||||
|
||||
private:
|
||||
Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
|
||||
ULONG version; /* Version of the TTC Header (1.0 or 2.0),
|
||||
* 0x00010000 or 0x00020000 */
|
||||
|
@ -241,6 +279,7 @@ struct TTCHeader {
|
|||
ULONG offsetTable[]; /* Array of offsets to the OffsetTable for each font
|
||||
* from the beginning of the file */
|
||||
};
|
||||
ASSERT_SIZE (TTCHeader, 12);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -299,9 +338,12 @@ struct OpenTypeFontFile {
|
|||
case TTCTag: return ((TTCHeader&)*this)[i];
|
||||
}
|
||||
}
|
||||
inline const Tag& get_tag (void) const { return tag; }
|
||||
|
||||
private:
|
||||
Tag tag; /* 4-byte identifier. */
|
||||
};
|
||||
ASSERT_SIZE (OpenTypeFontFile, 4);
|
||||
|
||||
|
||||
|
||||
|
@ -328,15 +370,18 @@ typedef struct Record {
|
|||
Offset offset; /* Offset from beginning of object holding
|
||||
* the Record */
|
||||
} ScriptRecord, LangSysRecord, FeatureRecord;
|
||||
ASSERT_SIZE (Record, 6);
|
||||
|
||||
struct ScriptList {
|
||||
/* Scripts, in sorted alphabetical tag order */
|
||||
DEFINE_RECORD_ARRAY_TYPE (Script, scriptRecord, scriptCount);
|
||||
|
||||
private:
|
||||
USHORT scriptCount; /* Number of ScriptRecords */
|
||||
ScriptRecord scriptRecord[]; /* Array of ScriptRecords--listed alphabetically
|
||||
* by ScriptTag */
|
||||
};
|
||||
ASSERT_SIZE (ScriptList, 2);
|
||||
|
||||
struct Script {
|
||||
/* LangSys', in sorted alphabetical tag order */
|
||||
|
@ -354,6 +399,7 @@ struct Script {
|
|||
return (LangSys *)((char*)this + defaultLangSys);
|
||||
}
|
||||
|
||||
private:
|
||||
Offset defaultLangSys; /* Offset to DefaultLangSys table--from
|
||||
* beginning of Script table--may be NULL */
|
||||
USHORT langSysCount; /* Number of LangSysRecords for this script--
|
||||
|
@ -361,6 +407,7 @@ struct Script {
|
|||
LangSysRecord langSysRecord[];/* Array of LangSysRecords--listed
|
||||
* alphabetically by LangSysTag */
|
||||
};
|
||||
ASSERT_SIZE (Script, 4);
|
||||
|
||||
struct LangSys {
|
||||
/* Feature indices, in no particular order */
|
||||
|
@ -373,6 +420,7 @@ struct LangSys {
|
|||
return reqFeatureIndex;;
|
||||
}
|
||||
|
||||
private:
|
||||
Offset lookupOrder; /* = NULL (reserved for an offset to a
|
||||
* reordering table) */
|
||||
USHORT reqFeatureIndex;/* Index of a feature required for this
|
||||
|
@ -384,16 +432,19 @@ struct LangSys {
|
|||
USHORT featureIndex[]; /* Array of indices into the FeatureList--in
|
||||
* arbitrary order. featureCount entires long */
|
||||
};
|
||||
ASSERT_SIZE (LangSys, 6);
|
||||
|
||||
struct FeatureList {
|
||||
/* Feature indices, in sorted alphabetical tag order */
|
||||
DEFINE_RECORD_ARRAY_TYPE (Feature, featureRecord, featureCount);
|
||||
|
||||
private:
|
||||
USHORT featureCount; /* Number of FeatureRecords in this table */
|
||||
FeatureRecord featureRecord[];/* Array of FeatureRecords--zero-based (first
|
||||
* feature has FeatureIndex = 0)--listed
|
||||
* alphabetically by FeatureTag */
|
||||
};
|
||||
ASSERT_SIZE (FeatureList, 2);
|
||||
|
||||
struct Feature {
|
||||
/* LookupList indices, in no particular order */
|
||||
|
@ -401,6 +452,7 @@ struct Feature {
|
|||
|
||||
// TODO: implement get_feature_params()
|
||||
|
||||
private:
|
||||
Offset featureParams; /* Offset to Feature Parameters table (if one
|
||||
* has been defined for the feature), relative
|
||||
* to the beginning of the Feature Table; = NULL
|
||||
|
@ -411,16 +463,19 @@ struct Feature {
|
|||
* feature--zero-based (first lookup is
|
||||
* LookupListIndex = 0) */
|
||||
};
|
||||
ASSERT_SIZE (Feature, 4);
|
||||
|
||||
struct LookupList {
|
||||
/* Lookup indices, in sorted alphabetical tag order */
|
||||
DEFINE_OFFSET_ARRAY_TYPE (Lookup, lookupOffset, lookupCount);
|
||||
|
||||
private:
|
||||
USHORT lookupCount; /* Number of lookups in this table */
|
||||
Offset lookupOffset[]; /* Array of offsets to Lookup tables--from
|
||||
* beginning of LookupList--zero based (first
|
||||
* lookup is Lookup index = 0) */
|
||||
};
|
||||
ASSERT_SIZE (LookupList, 2);
|
||||
|
||||
struct LookupFlag : USHORT {
|
||||
static const uint16_t RightToLeft = 0x0001u;
|
||||
|
@ -430,6 +485,7 @@ struct LookupFlag : USHORT {
|
|||
static const uint16_t Reserved = 0x00F0u;
|
||||
static const uint16_t MarkAttachmentType = 0xFF00u;
|
||||
};
|
||||
ASSERT_SIZE (LookupFlag, 2);
|
||||
|
||||
struct Lookup {
|
||||
/* SubTables, in the desired order */
|
||||
|
@ -441,12 +497,17 @@ struct Lookup {
|
|||
inline bool ignore_marks (void) const { return lookupFlag & LookupFlag::IgnoreMarks; }
|
||||
inline bool get_mark_attachment_type (void) const { return lookupFlag & LookupFlag::MarkAttachmentType; }
|
||||
|
||||
inline uint16_t get_type (void) const { return lookupType; }
|
||||
inline uint16_t get_flag (void) const { return lookupFlag; }
|
||||
|
||||
private:
|
||||
USHORT lookupType; /* Different enumerations for GSUB and GPOS */
|
||||
USHORT lookupFlag; /* Lookup qualifiers */
|
||||
USHORT subTableCount; /* Number of SubTables for this lookup */
|
||||
Offset subTableOffset[];/* Array of offsets to SubTables-from
|
||||
* beginning of Lookup table */
|
||||
};
|
||||
ASSERT_SIZE (Lookup, 6);
|
||||
|
||||
/*
|
||||
* Coverage Table
|
||||
|
@ -466,10 +527,12 @@ struct CoverageFormat1 {
|
|||
return -1;
|
||||
}
|
||||
|
||||
private:
|
||||
USHORT coverageFormat; /* Format identifier--format = 1 */
|
||||
USHORT glyphCount; /* Number of glyphs in the GlyphArray */
|
||||
GlyphID glyphArray[]; /* Array of GlyphIDs--in numerical order */
|
||||
};
|
||||
ASSERT_SIZE (CoverageFormat1, 4);
|
||||
|
||||
struct CoverageRangeRecord {
|
||||
|
||||
|
@ -479,11 +542,13 @@ struct CoverageRangeRecord {
|
|||
return -1;
|
||||
}
|
||||
|
||||
private:
|
||||
GlyphID start; /* First GlyphID in the range */
|
||||
GlyphID end; /* Last GlyphID in the range */
|
||||
USHORT startCoverageIndex; /* Coverage Index of first GlyphID in
|
||||
* range */
|
||||
};
|
||||
ASSERT_SIZE (CoverageRangeRecord, 6);
|
||||
|
||||
struct CoverageFormat2 {
|
||||
/* CoverageRangeRecords, in sorted numerical start order */
|
||||
|
@ -499,12 +564,14 @@ struct CoverageFormat2 {
|
|||
return -1;
|
||||
}
|
||||
|
||||
private:
|
||||
USHORT coverageFormat; /* Format identifier--format = 2 */
|
||||
USHORT rangeCount; /* Number of CoverageRangeRecords */
|
||||
CoverageRangeRecord rangeRecord[]; /* Array of glyph ranges--ordered by
|
||||
* Start GlyphID. rangeCount entries
|
||||
* long */
|
||||
};
|
||||
ASSERT_SIZE (CoverageFormat2, 4);
|
||||
|
||||
struct Coverage {
|
||||
DEFINE_NON_INSTANTIABLE(Coverage);
|
||||
|
@ -526,6 +593,7 @@ struct Coverage {
|
|||
}
|
||||
}
|
||||
|
||||
private:
|
||||
union {
|
||||
USHORT coverageFormat; /* Format identifier */
|
||||
CoverageFormat1 format1;
|
||||
|
@ -547,11 +615,13 @@ struct ClassDefFormat1 {
|
|||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
USHORT classFormat; /* Format identifier--format = 1 */
|
||||
GlyphID startGlyph; /* First GlyphID of the classValueArray */
|
||||
USHORT glyphCount; /* Size of the classValueArray */
|
||||
USHORT classValueArray[]; /* Array of Class Values--one per GlyphID */
|
||||
};
|
||||
ASSERT_SIZE (ClassDefFormat1, 6);
|
||||
|
||||
struct ClassRangeRecord {
|
||||
|
||||
|
@ -561,11 +631,12 @@ struct ClassRangeRecord {
|
|||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
GlyphID start; /* First GlyphID in the range */
|
||||
GlyphID end; /* Last GlyphID in the range */
|
||||
USHORT classValue; /* Applied to all glyphs in the range
|
||||
*/
|
||||
USHORT classValue; /* Applied to all glyphs in the range */
|
||||
};
|
||||
ASSERT_SIZE (ClassRangeRecord, 6);
|
||||
|
||||
struct ClassDefFormat2 {
|
||||
/* ClassRangeRecords, in sorted numerical start order */
|
||||
|
@ -581,11 +652,13 @@ struct ClassDefFormat2 {
|
|||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
USHORT classFormat; /* Format identifier--format = 2 */
|
||||
USHORT rangeCount; /* Number of Number of ClassRangeRecords */
|
||||
ClassRangeRecord rangeRecord[]; /* Array of glyph ranges--ordered by
|
||||
* Start GlyphID */
|
||||
};
|
||||
ASSERT_SIZE (ClassDefFormat2, 4);
|
||||
|
||||
struct ClassDef {
|
||||
DEFINE_NON_INSTANTIABLE(ClassDef);
|
||||
|
@ -607,6 +680,7 @@ struct ClassDef {
|
|||
}
|
||||
}
|
||||
|
||||
private:
|
||||
union {
|
||||
USHORT classFormat; /* Format identifier */
|
||||
ClassDefFormat1 format1;
|
||||
|
@ -651,11 +725,13 @@ struct Device {
|
|||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
USHORT startSize; /* Smallest size to correct--in ppem */
|
||||
USHORT endSize; /* Largest size to correct--in ppem */
|
||||
USHORT deltaFormat; /* Format of DeltaValue array data: 1, 2, or 3 */
|
||||
USHORT deltaValue[]; /* Array of compressed data */
|
||||
};
|
||||
ASSERT_SIZE (Device, 6);
|
||||
|
||||
|
||||
|
||||
|
@ -673,10 +749,17 @@ struct Device {
|
|||
|
||||
struct GSUBGPOSHeader {
|
||||
|
||||
/*
|
||||
inline unsigned int get_size (void) const {
|
||||
return offsetof (GSUBGPOSHeader, padding);
|
||||
}
|
||||
*/
|
||||
|
||||
DEFINE_LIST_ACCESSOR(Script, script); /* get_script_list and script(i) */
|
||||
DEFINE_LIST_ACCESSOR(Feature, feature);/* get_feature_list and feature(i) */
|
||||
DEFINE_LIST_ACCESSOR(Lookup, lookup); /* get_lookup_list and lookup(i) */
|
||||
|
||||
private:
|
||||
Fixed_Version version; /* Version of the GSUB/GPOS table--initially set
|
||||
* to 0x00010000 */
|
||||
Offset scriptList; /* Offset to ScriptList table--from beginning of
|
||||
|
@ -686,5 +769,6 @@ struct GSUBGPOSHeader {
|
|||
Offset lookupList; /* Offset to LookupList table--from beginning of
|
||||
* GSUB/GPOS table */
|
||||
};
|
||||
ASSERT_SIZE (GSUBGPOSHeader, 10);
|
||||
|
||||
#endif /* HARFBUZZ_OPEN_PRIVATE_H */
|
||||
|
|
|
@ -3,4 +3,10 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
#define _ASSERT_STATIC1(_line, _cond) typedef int _static_assert_on_line_##_line##_failed[(_cond)?1:-1]
|
||||
#define _ASSERT_STATIC0(_line, _cond) _ASSERT_STATIC1 (_line, (_cond))
|
||||
#define ASSERT_STATIC(_cond) _ASSERT_STATIC0 (__LINE__, (_cond))
|
||||
|
||||
#define ASSERT_SIZE(_type, _size) ASSERT_STATIC (sizeof (_type) == (_size))
|
||||
|
||||
#endif /* HARFBUZZ_PRIVATE_H */
|
||||
|
|
12
src/main.cc
12
src/main.cc
|
@ -20,7 +20,7 @@ main (int argc, char **argv)
|
|||
|
||||
const OpenTypeFontFile &ot = OpenTypeFontFile::get (font_data);
|
||||
|
||||
switch (ot.tag) {
|
||||
switch (ot.get_tag()) {
|
||||
case OpenTypeFontFile::TrueTypeTag:
|
||||
printf ("OpenType font with TrueType outlines\n");
|
||||
break;
|
||||
|
@ -45,10 +45,10 @@ main (int argc, char **argv)
|
|||
printf (" %d table(s) found in font\n", num_tables);
|
||||
for (int n_table = 0; n_table < num_tables; n_table++) {
|
||||
const OpenTypeTable &table = font[n_table];
|
||||
printf (" Table %2d of %2d: %.4s (0x%06x+0x%06x)\n", n_table+1, num_tables,
|
||||
(const char *)table.tag, (int)table.offset, (int)table.length);
|
||||
printf (" Table %2d of %2d: %.4s (0x%08lx+0x%08lx)\n", n_table+1, num_tables,
|
||||
(const char *)table.get_tag(), table.get_offset(), table.get_length());
|
||||
|
||||
if (table.tag == "GSUB" || table.tag == "GPOS") {
|
||||
if (table.get_tag() == "GSUB" || table.get_tag() == "GPOS") {
|
||||
const GSUBGPOSHeader &g = (const GSUBGPOSHeader&)*ot[table];
|
||||
|
||||
const ScriptList &scripts = *g.get_script_list();
|
||||
|
@ -80,7 +80,7 @@ main (int argc, char **argv)
|
|||
const Feature &feature = features[n_feature];
|
||||
printf (" Feature %2d of %2d: %.4s; %d lookup(s)\n", n_feature+1, num_features,
|
||||
(const char *)features.get_tag(n_feature),
|
||||
(int)feature.lookupCount);
|
||||
feature.get_len());
|
||||
}
|
||||
|
||||
const LookupList &lookups = *g.get_lookup_list();
|
||||
|
@ -89,7 +89,7 @@ main (int argc, char **argv)
|
|||
for (int n_lookup = 0; n_lookup < num_lookups; n_lookup++) {
|
||||
const Lookup &lookup = lookups[n_lookup];
|
||||
printf (" Lookup %2d of %2d: type %d, flags %04x\n", n_lookup+1, num_lookups,
|
||||
(int)lookup.lookupType, (unsigned int)lookup.lookupFlag);
|
||||
lookup.get_type(), lookup.get_flag());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue