From 7586089c6fa8185cad8387869d3703c637e5cbb1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 23 Jan 2008 18:02:28 -0500 Subject: [PATCH] Minor --- src/hb-ot-layout-gdef-private.h | 37 +++++++++++++++++++++++++------ src/hb-ot-layout-gsub-private.h | 13 +++++++++++ src/hb-ot-layout-open-private.h | 49 ++++++++++++++++++++++++++++++++++------- src/hb-private.h | 2 ++ 4 files changed, 86 insertions(+), 15 deletions(-) diff --git a/src/hb-ot-layout-gdef-private.h b/src/hb-ot-layout-gdef-private.h index 8b20fd5..6442221 100644 --- a/src/hb-ot-layout-gdef-private.h +++ b/src/hb-ot-layout-gdef-private.h @@ -53,6 +53,10 @@ struct GlyphClassDef : ClassDef { */ struct AttachPoint { + + friend struct AttachList; + + private: /* countour point indices, in increasing numerical order */ DEFINE_ARRAY_TYPE (USHORT, pointIndex, pointCount); @@ -65,6 +69,10 @@ struct AttachPoint { DEFINE_NULL_ASSERT_SIZE (AttachPoint, 2); struct AttachList { + + friend struct GDEF; + + private: /* const AttachPoint& get_attach_points (uint16_t glyph_id); */ DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP (AttachPoint, get_attach_points); @@ -90,6 +98,9 @@ DEFINE_NULL_ASSERT_SIZE (AttachList, 4); struct CaretValueFormat1 { + friend struct CaretValue; + + private: inline int get_caret_value (int ppem) const { return /* TODO garbage */ coordinate / ppem; } @@ -102,6 +113,9 @@ ASSERT_SIZE (CaretValueFormat1, 4); struct CaretValueFormat2 { + friend struct CaretValue; + + private: inline int get_caret_value (int ppem) const { return /* TODO garbage */ 0 / ppem; } @@ -114,6 +128,9 @@ ASSERT_SIZE (CaretValueFormat2, 4); struct CaretValueFormat3 { + friend struct CaretValue; + + private: inline const Device& get_device (void) const { if (HB_UNLIKELY (!deviceTable)) return NullDevice; return *(const Device*)((const char*)this + deviceTable); @@ -135,7 +152,7 @@ ASSERT_SIZE (CaretValueFormat3, 6); struct CaretValue { DEFINE_NON_INSTANTIABLE(CaretValue); - inline unsigned int get_size (void) const { + unsigned int get_size (void) const { switch (u.caretValueFormat) { case 1: return sizeof (u.format1); case 2: return sizeof (u.format2); @@ -145,7 +162,7 @@ struct CaretValue { } /* 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) { case 1: return u.format1.get_caret_value(ppem); case 2: return u.format2.get_caret_value(ppem); @@ -166,6 +183,10 @@ struct CaretValue { DEFINE_NULL (CaretValue, 2); struct LigGlyph { + + friend struct LigCaretList; + + private: /* Caret value tables, in increasing coordinate order */ DEFINE_OFFSET_ARRAY_TYPE (CaretValue, caretValue, caretCount); /* TODO */ @@ -181,6 +202,10 @@ struct LigGlyph { DEFINE_NULL_ASSERT_SIZE (LigGlyph, 2); struct LigCaretList { + + friend struct GDEF; + + private: /* const LigGlyph& get_lig_glyph (uint16_t glyph_id); */ DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP (LigGlyph, get_lig_glyph); @@ -205,7 +230,7 @@ DEFINE_NULL_ASSERT_SIZE (LigCaretList, 4); */ 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); /* XXX check version here? */ @@ -217,14 +242,12 @@ struct GDEF { /* Returns 0 if not found. */ inline int get_glyph_class (uint16_t glyph_id) const { - const ClassDef &class_def = get_glyph_class_def (); - return class_def.get_class (glyph_id); + return get_glyph_class_def ().get_class (glyph_id); } /* Returns 0 if not found. */ inline int get_mark_attachment_type (uint16_t glyph_id) const { - const ClassDef &class_def = get_mark_attach_class_def (); - return class_def.get_class (glyph_id); + return get_mark_attach_class_def ().get_class (glyph_id); } /* TODO get_glyph_property */ diff --git a/src/hb-ot-layout-gsub-private.h b/src/hb-ot-layout-gsub-private.h index c8a1900..46b538e 100644 --- a/src/hb-ot-layout-gsub-private.h +++ b/src/hb-ot-layout-gsub-private.h @@ -450,4 +450,17 @@ struct ReverseChainSingleSubstFormat1 { }; 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 */ diff --git a/src/hb-ot-layout-open-private.h b/src/hb-ot-layout-open-private.h index a88808e..04054df 100644 --- a/src/hb-ot-layout-open-private.h +++ b/src/hb-ot-layout-open-private.h @@ -314,6 +314,12 @@ typedef struct TableDirectory { DEFINE_NULL_ASSERT_SIZE (TableDirectory, 16); typedef struct OffsetTable { + + friend struct OpenTypeFontFile; + friend struct TTCHeader; + + // XXX private: + // Add get_num_tables and get_table... /* OpenTypeTables, in no particular order */ DEFINE_ARRAY_TYPE (TableDirectory, tableDir, numTables); // TODO: Implement find_table @@ -334,6 +340,10 @@ DEFINE_NULL_ALIAS (OpenTypeFontFace, OffsetTable); */ struct TTCHeader { + + friend struct OpenTypeFontFile; + + private: /* OpenTypeFontFaces, in no particular order */ DEFINE_OFFSET_ARRAY_TYPE (OffsetTable, offsetTable, numFonts); /* XXX check version here? */ @@ -376,14 +386,14 @@ struct OpenTypeFontFile { } /* Array interface sans get_size() */ - inline unsigned int get_len (void) const { + unsigned int get_len (void) const { switch (tag) { default: return 0; case TrueTypeTag: case CFFTag: return 1; 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; switch (tag) { default: case TrueTypeTag: case CFFTag: return (const OffsetTable&)*this; @@ -566,6 +576,10 @@ DEFINE_NULL_ASSERT_SIZE (LookupList, 2); */ struct CoverageFormat1 { + + friend struct Coverage; + + private: /* GlyphIDs, in sorted numerical order */ DEFINE_ARRAY_TYPE (GlyphID, glyphArray, glyphCount); @@ -588,6 +602,9 @@ ASSERT_SIZE (CoverageFormat1, 4); struct CoverageRangeRecord { + friend struct CoverageFormat2; + + private: inline int get_coverage (uint16_t glyph_id) const { if (glyph_id >= start && glyph_id <= end) return startCoverageIndex + (glyph_id - start); @@ -603,6 +620,10 @@ struct CoverageRangeRecord { DEFINE_NULL_ASSERT_SIZE_DATA (CoverageRangeRecord, 6, "\001"); struct CoverageFormat2 { + + friend struct Coverage; + + private: /* CoverageRangeRecords, in sorted numerical start order */ DEFINE_ARRAY_TYPE (CoverageRangeRecord, rangeRecord, rangeCount); @@ -628,7 +649,7 @@ ASSERT_SIZE (CoverageFormat2, 4); struct Coverage { DEFINE_NON_INSTANTIABLE(Coverage); - inline unsigned int get_size (void) const { + unsigned int get_size (void) const { switch (u.coverageFormat) { case 1: return u.format1.get_size (); case 2: return u.format2.get_size (); @@ -637,7 +658,7 @@ struct Coverage { } /* 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) { case 1: return u.format1.get_coverage(glyph_id); case 2: return u.format2.get_coverage(glyph_id); @@ -659,6 +680,10 @@ DEFINE_NULL (Coverage, 2); */ struct ClassDefFormat1 { + + friend struct ClassDef; + + private: /* GlyphIDs, in sorted numerical order */ DEFINE_ARRAY_TYPE (USHORT, classValueArray, glyphCount); @@ -678,6 +703,9 @@ ASSERT_SIZE (ClassDefFormat1, 6); struct ClassRangeRecord { + friend struct ClassDefFormat2; + + private: inline int get_class (uint16_t glyph_id) const { if (glyph_id >= start && glyph_id <= end) return classValue; @@ -692,6 +720,10 @@ struct ClassRangeRecord { DEFINE_NULL_ASSERT_SIZE_DATA (ClassRangeRecord, 6, "\001"); struct ClassDefFormat2 { + + friend struct ClassDef; + + private: /* ClassRangeRecords, in sorted numerical start order */ DEFINE_ARRAY_TYPE (ClassRangeRecord, rangeRecord, rangeCount); @@ -716,7 +748,7 @@ ASSERT_SIZE (ClassDefFormat2, 4); struct ClassDef { DEFINE_NON_INSTANTIABLE(ClassDef); - inline unsigned int get_size (void) const { + unsigned int get_size (void) const { switch (u.classFormat) { case 1: return u.format1.get_size (); case 2: return u.format2.get_size (); @@ -725,7 +757,7 @@ struct ClassDef { } /* 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) { case 1: return u.format1.get_class(glyph_id); case 2: return u.format2.get_class(glyph_id); @@ -747,8 +779,9 @@ DEFINE_NULL (ClassDef, 2); */ struct Device { + DEFINE_NON_INSTANTIABLE(Device); - inline unsigned int get_size (void) const { + unsigned int get_size (void) const { int count = endSize - startSize + 1; if (count < 0) count = 0; 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 && deltaFormat >= 1 && deltaFormat <= 3) { int s = ppem_size - startSize; diff --git a/src/hb-private.h b/src/hb-private.h index eb5a26a..f67bd57 100644 --- a/src/hb-private.h +++ b/src/hb-private.h @@ -41,6 +41,8 @@ #define HB_LIKELY G_LIKEYLY #define HB_UNLIKELY G_UNLIKELY +#define HB_UNUSED(arg) ((arg) = (arg)) + #include -- 2.7.4