Minor
This commit is contained in:
parent
aefaafe5bc
commit
7586089c6f
|
@ -53,6 +53,10 @@ struct GlyphClassDef : ClassDef {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct AttachPoint {
|
struct AttachPoint {
|
||||||
|
|
||||||
|
friend struct AttachList;
|
||||||
|
|
||||||
|
private:
|
||||||
/* countour point indices, in increasing numerical order */
|
/* countour point indices, in increasing numerical order */
|
||||||
DEFINE_ARRAY_TYPE (USHORT, pointIndex, pointCount);
|
DEFINE_ARRAY_TYPE (USHORT, pointIndex, pointCount);
|
||||||
|
|
||||||
|
@ -65,6 +69,10 @@ struct AttachPoint {
|
||||||
DEFINE_NULL_ASSERT_SIZE (AttachPoint, 2);
|
DEFINE_NULL_ASSERT_SIZE (AttachPoint, 2);
|
||||||
|
|
||||||
struct AttachList {
|
struct AttachList {
|
||||||
|
|
||||||
|
friend struct GDEF;
|
||||||
|
|
||||||
|
private:
|
||||||
/* const AttachPoint& get_attach_points (uint16_t glyph_id); */
|
/* const AttachPoint& get_attach_points (uint16_t glyph_id); */
|
||||||
DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP (AttachPoint, get_attach_points);
|
DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP (AttachPoint, get_attach_points);
|
||||||
|
|
||||||
|
@ -90,6 +98,9 @@ DEFINE_NULL_ASSERT_SIZE (AttachList, 4);
|
||||||
|
|
||||||
struct CaretValueFormat1 {
|
struct CaretValueFormat1 {
|
||||||
|
|
||||||
|
friend struct CaretValue;
|
||||||
|
|
||||||
|
private:
|
||||||
inline int get_caret_value (int ppem) const {
|
inline int get_caret_value (int ppem) const {
|
||||||
return /* TODO garbage */ coordinate / ppem;
|
return /* TODO garbage */ coordinate / ppem;
|
||||||
}
|
}
|
||||||
|
@ -102,6 +113,9 @@ ASSERT_SIZE (CaretValueFormat1, 4);
|
||||||
|
|
||||||
struct CaretValueFormat2 {
|
struct CaretValueFormat2 {
|
||||||
|
|
||||||
|
friend struct CaretValue;
|
||||||
|
|
||||||
|
private:
|
||||||
inline int get_caret_value (int ppem) const {
|
inline int get_caret_value (int ppem) const {
|
||||||
return /* TODO garbage */ 0 / ppem;
|
return /* TODO garbage */ 0 / ppem;
|
||||||
}
|
}
|
||||||
|
@ -114,6 +128,9 @@ ASSERT_SIZE (CaretValueFormat2, 4);
|
||||||
|
|
||||||
struct CaretValueFormat3 {
|
struct CaretValueFormat3 {
|
||||||
|
|
||||||
|
friend struct CaretValue;
|
||||||
|
|
||||||
|
private:
|
||||||
inline const Device& get_device (void) const {
|
inline const Device& get_device (void) const {
|
||||||
if (HB_UNLIKELY (!deviceTable)) return NullDevice;
|
if (HB_UNLIKELY (!deviceTable)) return NullDevice;
|
||||||
return *(const Device*)((const char*)this + deviceTable);
|
return *(const Device*)((const char*)this + deviceTable);
|
||||||
|
@ -135,7 +152,7 @@ ASSERT_SIZE (CaretValueFormat3, 6);
|
||||||
struct CaretValue {
|
struct CaretValue {
|
||||||
DEFINE_NON_INSTANTIABLE(CaretValue);
|
DEFINE_NON_INSTANTIABLE(CaretValue);
|
||||||
|
|
||||||
inline unsigned int get_size (void) const {
|
unsigned int get_size (void) const {
|
||||||
switch (u.caretValueFormat) {
|
switch (u.caretValueFormat) {
|
||||||
case 1: return sizeof (u.format1);
|
case 1: return sizeof (u.format1);
|
||||||
case 2: return sizeof (u.format2);
|
case 2: return sizeof (u.format2);
|
||||||
|
@ -145,7 +162,7 @@ struct CaretValue {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX we need access to a load-contour-point vfunc here */
|
/* XXX we need access to a load-contour-point vfunc here */
|
||||||
inline int get_caret_value (int ppem) const {
|
int get_caret_value (int ppem) const {
|
||||||
switch (u.caretValueFormat) {
|
switch (u.caretValueFormat) {
|
||||||
case 1: return u.format1.get_caret_value(ppem);
|
case 1: return u.format1.get_caret_value(ppem);
|
||||||
case 2: return u.format2.get_caret_value(ppem);
|
case 2: return u.format2.get_caret_value(ppem);
|
||||||
|
@ -166,6 +183,10 @@ struct CaretValue {
|
||||||
DEFINE_NULL (CaretValue, 2);
|
DEFINE_NULL (CaretValue, 2);
|
||||||
|
|
||||||
struct LigGlyph {
|
struct LigGlyph {
|
||||||
|
|
||||||
|
friend struct LigCaretList;
|
||||||
|
|
||||||
|
private:
|
||||||
/* Caret value tables, in increasing coordinate order */
|
/* Caret value tables, in increasing coordinate order */
|
||||||
DEFINE_OFFSET_ARRAY_TYPE (CaretValue, caretValue, caretCount);
|
DEFINE_OFFSET_ARRAY_TYPE (CaretValue, caretValue, caretCount);
|
||||||
/* TODO */
|
/* TODO */
|
||||||
|
@ -181,6 +202,10 @@ struct LigGlyph {
|
||||||
DEFINE_NULL_ASSERT_SIZE (LigGlyph, 2);
|
DEFINE_NULL_ASSERT_SIZE (LigGlyph, 2);
|
||||||
|
|
||||||
struct LigCaretList {
|
struct LigCaretList {
|
||||||
|
|
||||||
|
friend struct GDEF;
|
||||||
|
|
||||||
|
private:
|
||||||
/* const LigGlyph& get_lig_glyph (uint16_t glyph_id); */
|
/* const LigGlyph& get_lig_glyph (uint16_t glyph_id); */
|
||||||
DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP (LigGlyph, get_lig_glyph);
|
DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP (LigGlyph, get_lig_glyph);
|
||||||
|
|
||||||
|
@ -205,7 +230,7 @@ DEFINE_NULL_ASSERT_SIZE (LigCaretList, 4);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct GDEF {
|
struct GDEF {
|
||||||
static const hb_tag_t GDEFTag = HB_TAG ('G','D','E','F');
|
static const hb_tag_t Tag = HB_TAG ('G','D','E','F');
|
||||||
|
|
||||||
STATIC_DEFINE_GET_FOR_DATA (GDEF);
|
STATIC_DEFINE_GET_FOR_DATA (GDEF);
|
||||||
/* XXX check version here? */
|
/* XXX check version here? */
|
||||||
|
@ -217,14 +242,12 @@ struct GDEF {
|
||||||
|
|
||||||
/* Returns 0 if not found. */
|
/* Returns 0 if not found. */
|
||||||
inline int get_glyph_class (uint16_t glyph_id) const {
|
inline int get_glyph_class (uint16_t glyph_id) const {
|
||||||
const ClassDef &class_def = get_glyph_class_def ();
|
return get_glyph_class_def ().get_class (glyph_id);
|
||||||
return class_def.get_class (glyph_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns 0 if not found. */
|
/* Returns 0 if not found. */
|
||||||
inline int get_mark_attachment_type (uint16_t glyph_id) const {
|
inline int get_mark_attachment_type (uint16_t glyph_id) const {
|
||||||
const ClassDef &class_def = get_mark_attach_class_def ();
|
return get_mark_attach_class_def ().get_class (glyph_id);
|
||||||
return class_def.get_class (glyph_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO get_glyph_property */
|
/* TODO get_glyph_property */
|
||||||
|
|
|
@ -450,4 +450,17 @@ struct ReverseChainSingleSubstFormat1 {
|
||||||
};
|
};
|
||||||
ASSERT_SIZE (ReverseChainSingleSubstFormat1, 10);
|
ASSERT_SIZE (ReverseChainSingleSubstFormat1, 10);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* GSUB
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct GSUB : GSUBGPOS {
|
||||||
|
static const hb_tag_t Tag = HB_TAG ('G','S','U','B');
|
||||||
|
|
||||||
|
STATIC_DEFINE_GET_FOR_DATA (GSUB);
|
||||||
|
/* XXX check version here? */
|
||||||
|
};
|
||||||
|
DEFINE_NULL_ALIAS (GSUB, GSUBGPOS);
|
||||||
|
|
||||||
|
|
||||||
#endif /* HB_OT_LAYOUT_GSUB_PRIVATE_H */
|
#endif /* HB_OT_LAYOUT_GSUB_PRIVATE_H */
|
||||||
|
|
|
@ -314,6 +314,12 @@ typedef struct TableDirectory {
|
||||||
DEFINE_NULL_ASSERT_SIZE (TableDirectory, 16);
|
DEFINE_NULL_ASSERT_SIZE (TableDirectory, 16);
|
||||||
|
|
||||||
typedef struct OffsetTable {
|
typedef struct OffsetTable {
|
||||||
|
|
||||||
|
friend struct OpenTypeFontFile;
|
||||||
|
friend struct TTCHeader;
|
||||||
|
|
||||||
|
// XXX private:
|
||||||
|
// Add get_num_tables and get_table...
|
||||||
/* OpenTypeTables, in no particular order */
|
/* OpenTypeTables, in no particular order */
|
||||||
DEFINE_ARRAY_TYPE (TableDirectory, tableDir, numTables);
|
DEFINE_ARRAY_TYPE (TableDirectory, tableDir, numTables);
|
||||||
// TODO: Implement find_table
|
// TODO: Implement find_table
|
||||||
|
@ -334,6 +340,10 @@ DEFINE_NULL_ALIAS (OpenTypeFontFace, OffsetTable);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct TTCHeader {
|
struct TTCHeader {
|
||||||
|
|
||||||
|
friend struct OpenTypeFontFile;
|
||||||
|
|
||||||
|
private:
|
||||||
/* OpenTypeFontFaces, in no particular order */
|
/* OpenTypeFontFaces, in no particular order */
|
||||||
DEFINE_OFFSET_ARRAY_TYPE (OffsetTable, offsetTable, numFonts);
|
DEFINE_OFFSET_ARRAY_TYPE (OffsetTable, offsetTable, numFonts);
|
||||||
/* XXX check version here? */
|
/* XXX check version here? */
|
||||||
|
@ -376,14 +386,14 @@ struct OpenTypeFontFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Array interface sans get_size() */
|
/* Array interface sans get_size() */
|
||||||
inline unsigned int get_len (void) const {
|
unsigned int get_len (void) const {
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
default: return 0;
|
default: return 0;
|
||||||
case TrueTypeTag: case CFFTag: return 1;
|
case TrueTypeTag: case CFFTag: return 1;
|
||||||
case TTCTag: return ((const TTCHeader&)*this).get_len();
|
case TTCTag: return ((const TTCHeader&)*this).get_len();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inline const OpenTypeFontFace& operator[] (unsigned int i) const {
|
const OpenTypeFontFace& operator[] (unsigned int i) const {
|
||||||
if (HB_UNLIKELY (i >= get_len ())) return NullOpenTypeFontFace;
|
if (HB_UNLIKELY (i >= get_len ())) return NullOpenTypeFontFace;
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
default: case TrueTypeTag: case CFFTag: return (const OffsetTable&)*this;
|
default: case TrueTypeTag: case CFFTag: return (const OffsetTable&)*this;
|
||||||
|
@ -566,6 +576,10 @@ DEFINE_NULL_ASSERT_SIZE (LookupList, 2);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct CoverageFormat1 {
|
struct CoverageFormat1 {
|
||||||
|
|
||||||
|
friend struct Coverage;
|
||||||
|
|
||||||
|
private:
|
||||||
/* GlyphIDs, in sorted numerical order */
|
/* GlyphIDs, in sorted numerical order */
|
||||||
DEFINE_ARRAY_TYPE (GlyphID, glyphArray, glyphCount);
|
DEFINE_ARRAY_TYPE (GlyphID, glyphArray, glyphCount);
|
||||||
|
|
||||||
|
@ -588,6 +602,9 @@ ASSERT_SIZE (CoverageFormat1, 4);
|
||||||
|
|
||||||
struct CoverageRangeRecord {
|
struct CoverageRangeRecord {
|
||||||
|
|
||||||
|
friend struct CoverageFormat2;
|
||||||
|
|
||||||
|
private:
|
||||||
inline int get_coverage (uint16_t glyph_id) const {
|
inline int get_coverage (uint16_t glyph_id) const {
|
||||||
if (glyph_id >= start && glyph_id <= end)
|
if (glyph_id >= start && glyph_id <= end)
|
||||||
return startCoverageIndex + (glyph_id - start);
|
return startCoverageIndex + (glyph_id - start);
|
||||||
|
@ -603,6 +620,10 @@ struct CoverageRangeRecord {
|
||||||
DEFINE_NULL_ASSERT_SIZE_DATA (CoverageRangeRecord, 6, "\001");
|
DEFINE_NULL_ASSERT_SIZE_DATA (CoverageRangeRecord, 6, "\001");
|
||||||
|
|
||||||
struct CoverageFormat2 {
|
struct CoverageFormat2 {
|
||||||
|
|
||||||
|
friend struct Coverage;
|
||||||
|
|
||||||
|
private:
|
||||||
/* CoverageRangeRecords, in sorted numerical start order */
|
/* CoverageRangeRecords, in sorted numerical start order */
|
||||||
DEFINE_ARRAY_TYPE (CoverageRangeRecord, rangeRecord, rangeCount);
|
DEFINE_ARRAY_TYPE (CoverageRangeRecord, rangeRecord, rangeCount);
|
||||||
|
|
||||||
|
@ -628,7 +649,7 @@ ASSERT_SIZE (CoverageFormat2, 4);
|
||||||
struct Coverage {
|
struct Coverage {
|
||||||
DEFINE_NON_INSTANTIABLE(Coverage);
|
DEFINE_NON_INSTANTIABLE(Coverage);
|
||||||
|
|
||||||
inline unsigned int get_size (void) const {
|
unsigned int get_size (void) const {
|
||||||
switch (u.coverageFormat) {
|
switch (u.coverageFormat) {
|
||||||
case 1: return u.format1.get_size ();
|
case 1: return u.format1.get_size ();
|
||||||
case 2: return u.format2.get_size ();
|
case 2: return u.format2.get_size ();
|
||||||
|
@ -637,7 +658,7 @@ struct Coverage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns -1 if not covered. */
|
/* Returns -1 if not covered. */
|
||||||
inline int get_coverage (uint16_t glyph_id) const {
|
int get_coverage (uint16_t glyph_id) const {
|
||||||
switch (u.coverageFormat) {
|
switch (u.coverageFormat) {
|
||||||
case 1: return u.format1.get_coverage(glyph_id);
|
case 1: return u.format1.get_coverage(glyph_id);
|
||||||
case 2: return u.format2.get_coverage(glyph_id);
|
case 2: return u.format2.get_coverage(glyph_id);
|
||||||
|
@ -659,6 +680,10 @@ DEFINE_NULL (Coverage, 2);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct ClassDefFormat1 {
|
struct ClassDefFormat1 {
|
||||||
|
|
||||||
|
friend struct ClassDef;
|
||||||
|
|
||||||
|
private:
|
||||||
/* GlyphIDs, in sorted numerical order */
|
/* GlyphIDs, in sorted numerical order */
|
||||||
DEFINE_ARRAY_TYPE (USHORT, classValueArray, glyphCount);
|
DEFINE_ARRAY_TYPE (USHORT, classValueArray, glyphCount);
|
||||||
|
|
||||||
|
@ -678,6 +703,9 @@ ASSERT_SIZE (ClassDefFormat1, 6);
|
||||||
|
|
||||||
struct ClassRangeRecord {
|
struct ClassRangeRecord {
|
||||||
|
|
||||||
|
friend struct ClassDefFormat2;
|
||||||
|
|
||||||
|
private:
|
||||||
inline int get_class (uint16_t glyph_id) const {
|
inline int get_class (uint16_t glyph_id) const {
|
||||||
if (glyph_id >= start && glyph_id <= end)
|
if (glyph_id >= start && glyph_id <= end)
|
||||||
return classValue;
|
return classValue;
|
||||||
|
@ -692,6 +720,10 @@ struct ClassRangeRecord {
|
||||||
DEFINE_NULL_ASSERT_SIZE_DATA (ClassRangeRecord, 6, "\001");
|
DEFINE_NULL_ASSERT_SIZE_DATA (ClassRangeRecord, 6, "\001");
|
||||||
|
|
||||||
struct ClassDefFormat2 {
|
struct ClassDefFormat2 {
|
||||||
|
|
||||||
|
friend struct ClassDef;
|
||||||
|
|
||||||
|
private:
|
||||||
/* ClassRangeRecords, in sorted numerical start order */
|
/* ClassRangeRecords, in sorted numerical start order */
|
||||||
DEFINE_ARRAY_TYPE (ClassRangeRecord, rangeRecord, rangeCount);
|
DEFINE_ARRAY_TYPE (ClassRangeRecord, rangeRecord, rangeCount);
|
||||||
|
|
||||||
|
@ -716,7 +748,7 @@ ASSERT_SIZE (ClassDefFormat2, 4);
|
||||||
struct ClassDef {
|
struct ClassDef {
|
||||||
DEFINE_NON_INSTANTIABLE(ClassDef);
|
DEFINE_NON_INSTANTIABLE(ClassDef);
|
||||||
|
|
||||||
inline unsigned int get_size (void) const {
|
unsigned int get_size (void) const {
|
||||||
switch (u.classFormat) {
|
switch (u.classFormat) {
|
||||||
case 1: return u.format1.get_size ();
|
case 1: return u.format1.get_size ();
|
||||||
case 2: return u.format2.get_size ();
|
case 2: return u.format2.get_size ();
|
||||||
|
@ -725,7 +757,7 @@ struct ClassDef {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns 0 if not found. */
|
/* Returns 0 if not found. */
|
||||||
inline int get_class (uint16_t glyph_id) const {
|
int get_class (uint16_t glyph_id) const {
|
||||||
switch (u.classFormat) {
|
switch (u.classFormat) {
|
||||||
case 1: return u.format1.get_class(glyph_id);
|
case 1: return u.format1.get_class(glyph_id);
|
||||||
case 2: return u.format2.get_class(glyph_id);
|
case 2: return u.format2.get_class(glyph_id);
|
||||||
|
@ -747,8 +779,9 @@ DEFINE_NULL (ClassDef, 2);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct Device {
|
struct Device {
|
||||||
|
DEFINE_NON_INSTANTIABLE(Device);
|
||||||
|
|
||||||
inline unsigned int get_size (void) const {
|
unsigned int get_size (void) const {
|
||||||
int count = endSize - startSize + 1;
|
int count = endSize - startSize + 1;
|
||||||
if (count < 0) count = 0;
|
if (count < 0) count = 0;
|
||||||
switch (deltaFormat) {
|
switch (deltaFormat) {
|
||||||
|
@ -759,7 +792,7 @@ struct Device {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int get_delta (int ppem_size) const {
|
int get_delta (int ppem_size) const {
|
||||||
if (ppem_size >= startSize && ppem_size <= endSize &&
|
if (ppem_size >= startSize && ppem_size <= endSize &&
|
||||||
deltaFormat >= 1 && deltaFormat <= 3) {
|
deltaFormat >= 1 && deltaFormat <= 3) {
|
||||||
int s = ppem_size - startSize;
|
int s = ppem_size - startSize;
|
||||||
|
|
|
@ -41,6 +41,8 @@
|
||||||
|
|
||||||
#define HB_LIKELY G_LIKEYLY
|
#define HB_LIKELY G_LIKEYLY
|
||||||
#define HB_UNLIKELY G_UNLIKELY
|
#define HB_UNLIKELY G_UNLIKELY
|
||||||
|
#define HB_UNUSED(arg) ((arg) = (arg))
|
||||||
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue