[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 */
@ -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))