summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2016-02-22 11:44:45 +0900
committerBehdad Esfahbod <behdad@behdad.org>2016-02-22 15:38:44 +0900
commit9a13ed453ef96822a47d6e6f58332b87f38d5c59 (patch)
tree76e9b745e8fd81fb2dcb6c359e1dea3db3836917
parent238b943e850ea1ab0093e12c74d2cd7c686f318e (diff)
Make FixedVersion a template
-rw-r--r--src/hb-open-file-private.hh4
-rw-r--r--src/hb-open-type-private.hh9
-rw-r--r--src/hb-ot-head-table.hh4
-rw-r--r--src/hb-ot-hhea-table.hh2
-rw-r--r--src/hb-ot-layout-gdef-table.hh2
-rw-r--r--src/hb-ot-layout-gsubgpos-private.hh2
-rw-r--r--src/hb-ot-layout-jstf-table.hh2
-rw-r--r--src/hb-ot-maxp-table.hh2
8 files changed, 14 insertions, 13 deletions
diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh
index 152230a0..5357ddcf 100644
--- a/src/hb-open-file-private.hh
+++ b/src/hb-open-file-private.hh
@@ -140,7 +140,7 @@ struct TTCHeaderVersion1
protected:
Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
- FixedVersion version; /* Version of the TTC Header (1.0),
+ FixedVersion<>version; /* Version of the TTC Header (1.0),
* 0x00010000u */
ArrayOf<OffsetTo<OffsetTable, ULONG>, ULONG>
table; /* Array of offsets to the OffsetTable for each font
@@ -187,7 +187,7 @@ struct TTCHeader
union {
struct {
Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
- FixedVersion version; /* Version of the TTC Header (1.0 or 2.0),
+ FixedVersion<>version; /* Version of the TTC Header (1.0 or 2.0),
* 0x00010000u or 0x00020000u */
} header;
TTCHeaderVersion1 version1;
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index 6323da8e..6a520008 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -739,9 +739,10 @@ struct CheckSum : ULONG
* Version Numbers
*/
+template <typename FixedType=USHORT>
struct FixedVersion
{
- inline uint32_t to_int (void) const { return (major << 16) + minor; }
+ inline uint32_t to_int (void) const { return (major << sizeof(FixedType)) + minor; }
inline bool sanitize (hb_sanitize_context_t *c) const
{
@@ -749,10 +750,10 @@ struct FixedVersion
return_trace (c->check_struct (this));
}
- USHORT major;
- USHORT minor;
+ FixedType major;
+ FixedType minor;
public:
- DEFINE_SIZE_STATIC (4);
+ DEFINE_SIZE_STATIC (2 * sizeof(FixedType));
};
diff --git a/src/hb-ot-head-table.hh b/src/hb-ot-head-table.hh
index 60644be1..9c3e51eb 100644
--- a/src/hb-ot-head-table.hh
+++ b/src/hb-ot-head-table.hh
@@ -61,9 +61,9 @@ struct head
}
protected:
- FixedVersion version; /* Version of the head table--currently
+ FixedVersion<>version; /* Version of the head table--currently
* 0x00010000u for version 1.0. */
- FixedVersion fontRevision; /* Set by font manufacturer. */
+ FixedVersion<>fontRevision; /* Set by font manufacturer. */
ULONG checkSumAdjustment; /* To compute: set it to 0, sum the
* entire font as ULONG, then store
* 0xB1B0AFBAu - sum. */
diff --git a/src/hb-ot-hhea-table.hh b/src/hb-ot-hhea-table.hh
index 24114534..c8e9536c 100644
--- a/src/hb-ot-hhea-table.hh
+++ b/src/hb-ot-hhea-table.hh
@@ -56,7 +56,7 @@ struct _hea
}
public:
- FixedVersion version; /* 0x00010000u for version 1.0. */
+ FixedVersion<>version; /* 0x00010000u for version 1.0. */
FWORD ascender; /* Typographic ascent. */
FWORD descender; /* Typographic descent. */
FWORD lineGap; /* Typographic line gap. */
diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh
index bc36436b..2b4bc5a0 100644
--- a/src/hb-ot-layout-gdef-table.hh
+++ b/src/hb-ot-layout-gdef-table.hh
@@ -409,7 +409,7 @@ struct GDEF
protected:
- FixedVersion version; /* Version of the GDEF table--currently
+ FixedVersion<>version; /* Version of the GDEF table--currently
* 0x00010002u */
OffsetTo<ClassDef>
glyphClassDef; /* Offset to class definition table
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 3f9d9ca9..691334c9 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -2277,7 +2277,7 @@ struct GSUBGPOS
}
protected:
- FixedVersion version; /* Version of the GSUB/GPOS table--initially set
+ FixedVersion<>version; /* Version of the GSUB/GPOS table--initially set
* to 0x00010000u */
OffsetTo<ScriptList>
scriptList; /* ScriptList table */
diff --git a/src/hb-ot-layout-jstf-table.hh b/src/hb-ot-layout-jstf-table.hh
index 7e199c2e..c3068491 100644
--- a/src/hb-ot-layout-jstf-table.hh
+++ b/src/hb-ot-layout-jstf-table.hh
@@ -218,7 +218,7 @@ struct JSTF
}
protected:
- FixedVersion version; /* Version of the JSTF table--initially set
+ FixedVersion<>version; /* Version of the JSTF table--initially set
* to 0x00010000u */
RecordArrayOf<JstfScript>
scriptList; /* Array of JstfScripts--listed
diff --git a/src/hb-ot-maxp-table.hh b/src/hb-ot-maxp-table.hh
index 27105af1..943e3908 100644
--- a/src/hb-ot-maxp-table.hh
+++ b/src/hb-ot-maxp-table.hh
@@ -58,7 +58,7 @@ struct maxp
/* We only implement version 0.5 as none of the extra fields in version 1.0 are useful. */
protected:
- FixedVersion version; /* Version of the maxp table (0.5 or 1.0),
+ FixedVersion<>version; /* Version of the maxp table (0.5 or 1.0),
* 0x00005000u or 0x00010000u. */
USHORT numGlyphs; /* The number of glyphs in the font. */
public: