[GSUB] Start ChainContextSubst

This commit is contained in:
Behdad Esfahbod 2009-05-16 19:59:15 -04:00
parent 7fca9e5245
commit 9f721cf380
1 changed files with 39 additions and 11 deletions

View File

@ -127,9 +127,6 @@ struct SingleSubst {
inline bool substitute (SUBTABLE_SUBSTITUTE_ARGS_DEF) const { inline bool substitute (SUBTABLE_SUBSTITUTE_ARGS_DEF) const {
if (HB_UNLIKELY (context_length < 1))
return false;
unsigned int property; unsigned int property;
if (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM (), lookup_flag, &property)) if (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM (), lookup_flag, &property))
return false; return false;
@ -217,9 +214,6 @@ struct MultipleSubstFormat1 {
inline bool substitute (SUBTABLE_SUBSTITUTE_ARGS_DEF) const { inline bool substitute (SUBTABLE_SUBSTITUTE_ARGS_DEF) const {
if (HB_UNLIKELY (context_length < 1))
return false;
unsigned int property; unsigned int property;
if (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM (), lookup_flag, &property)) if (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM (), lookup_flag, &property))
return false; return false;
@ -292,9 +286,6 @@ struct AlternateSubstFormat1 {
inline bool substitute (SUBTABLE_SUBSTITUTE_ARGS_DEF) const { inline bool substitute (SUBTABLE_SUBSTITUTE_ARGS_DEF) const {
if (HB_UNLIKELY (context_length < 1))
return false;
unsigned int property; unsigned int property;
if (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM (), lookup_flag, &property)) if (!_hb_ot_layout_check_glyph_property (layout, IN_CURITEM (), lookup_flag, &property))
return false; return false;
@ -983,6 +974,9 @@ DEFINE_NULL_ASSERT_SIZE (ChainSubRuleSet, 2);
struct ChainContextSubstFormat1 { struct ChainContextSubstFormat1 {
/* TODO */ /* TODO */
inline bool substitute (SUBTABLE_SUBSTITUTE_ARGS_DEF) const {
return false;
}
private: private:
USHORT substFormat; /* Format identifier--format = 1 */ USHORT substFormat; /* Format identifier--format = 1 */
@ -1006,7 +1000,7 @@ struct ChainSubClassRule {
* backtrack sequence (number of * backtrack sequence (number of
* glyphs to be matched before the * glyphs to be matched before the
* first glyph) */ * first glyph) */
USHORT backtrack[]; /* Array of backtracking classes(to be USHORT backtrack[]; /* Array of backtracking classes (to be
* matched before the input sequence) */ * matched before the input sequence) */
USHORT inputGlyphCount; /* Total number of classes in the input USHORT inputGlyphCount; /* Total number of classes in the input
* sequence (includes the first class) */ * sequence (includes the first class) */
@ -1017,7 +1011,7 @@ struct ChainSubClassRule {
* look ahead sequence (number of * look ahead sequence (number of
* classes to be matched after the * classes to be matched after the
* input sequence) */ * input sequence) */
USHORT lookAhead[]; /* Array of lookahead classes(to be USHORT lookAhead[]; /* Array of lookahead classes (to be
* matched after the input sequence) */ * matched after the input sequence) */
USHORT substCount; /* Number of SubstLookupRecords */ USHORT substCount; /* Number of SubstLookupRecords */
SubstLookupRecord substLookupRecord[];/* Array of SubstLookupRecords--in SubstLookupRecord substLookupRecord[];/* Array of SubstLookupRecords--in
@ -1040,6 +1034,9 @@ DEFINE_NULL_ASSERT_SIZE (ChainSubClassSet, 2);
struct ChainContextSubstFormat2 { struct ChainContextSubstFormat2 {
/* TODO */ /* TODO */
inline bool substitute (SUBTABLE_SUBSTITUTE_ARGS_DEF) const {
return false;
}
private: private:
USHORT substFormat; /* Format identifier--format = 2 */ USHORT substFormat; /* Format identifier--format = 2 */
@ -1067,6 +1064,9 @@ ASSERT_SIZE (ChainContextSubstFormat2, 12);
struct ChainContextSubstFormat3 { struct ChainContextSubstFormat3 {
/* TODO */ /* TODO */
inline bool substitute (SUBTABLE_SUBSTITUTE_ARGS_DEF) const {
return false;
}
private: private:
USHORT substFormat; /* Format identifier--format = 3 */ USHORT substFormat; /* Format identifier--format = 3 */
@ -1090,6 +1090,31 @@ struct ChainContextSubstFormat3 {
}; };
ASSERT_SIZE (ChainContextSubstFormat3, 10); ASSERT_SIZE (ChainContextSubstFormat3, 10);
struct ChainContextSubst {
friend struct SubstLookupSubTable;
private:
inline bool substitute (SUBTABLE_SUBSTITUTE_ARGS_DEF) const {
switch (u.substFormat) {
case 1: return u.format1.substitute (SUBTABLE_SUBSTITUTE_ARGS);
case 2: return u.format2.substitute (SUBTABLE_SUBSTITUTE_ARGS);
case 3: return u.format3.substitute (SUBTABLE_SUBSTITUTE_ARGS);
default:return false;
}
}
private:
union {
USHORT substFormat; /* Format identifier */
ChainContextSubstFormat1 format1;
ChainContextSubstFormat2 format2;
ChainContextSubstFormat3 format3;
} u;
};
DEFINE_NULL (ChainContextSubst, 2);
struct ExtensionSubstFormat1 { struct ExtensionSubstFormat1 {
@ -1261,6 +1286,9 @@ struct SubstLookup : Lookup {
return false; return false;
nesting_level_left--; nesting_level_left--;
if (HB_UNLIKELY (context_length < 1))
return false;
for (unsigned int i = 0; i < get_subtable_count (); i++) for (unsigned int i = 0; i < get_subtable_count (); i++)
if (get_subtable (i).substitute (SUBTABLE_SUBSTITUTE_ARGS, if (get_subtable (i).substitute (SUBTABLE_SUBSTITUTE_ARGS,
lookup_type)) lookup_type))