diff --git a/src/OT/Var/VARC/VARC.cc b/src/OT/Var/VARC/VARC.cc index 428d9568f..db5259321 100644 --- a/src/OT/Var/VARC/VARC.cc +++ b/src/OT/Var/VARC/VARC.cc @@ -173,6 +173,16 @@ VarComponent::get_path_at (hb_font_t *font, record += HBGlyphID16::static_size; } + // ConditionSet + bool show = true; + if (flags & (unsigned) flags_t::HAVE_CONDITION) + { + unsigned conditionSetIndex; + READ_UINT32VAR (conditionSetIndex); + const auto &conditionSet = (&VARC+VARC.conditionSetList)[conditionSetIndex]; + show = conditionSet.evaluate (coords.arrayZ, coords.length); + } + // Axis values hb_vector_t axisIndices; @@ -296,10 +306,11 @@ VarComponent::get_path_at (hb_font_t *font, &draw_session.st}; hb_draw_session_t transformer_session {transformer_funcs, &context}; - VARC.get_path_at (font, gid, - transformer_session, component_coords, - parent_gid, - visited, edges_left, depth_left - 1); + if (show) + VARC.get_path_at (font, gid, + transformer_session, component_coords, + parent_gid, + visited, edges_left, depth_left - 1); #undef PROCESS_TRANSFORM_COMPONENTS diff --git a/src/OT/Var/VARC/VARC.hh b/src/OT/Var/VARC/VARC.hh index a96b1cf7c..3931e842e 100644 --- a/src/OT/Var/VARC/VARC.hh +++ b/src/OT/Var/VARC/VARC.hh @@ -30,7 +30,7 @@ struct VarComponent HAVE_TRANSLATE_X = 1u << 4, HAVE_TRANSLATE_Y = 1u << 5, HAVE_ROTATION = 1u << 6, - USE_MY_METRICS = 1u << 7, + HAVE_CONDITION = 1u << 7, HAVE_SCALE_X = 1u << 8, HAVE_SCALE_Y = 1u << 9, HAVE_TCENTER_X = 1u << 10, @@ -166,10 +166,11 @@ struct VARC FixedVersion<> version; /* Version identifier */ Offset32To coverage; Offset32To varStore; + Offset32To conditionSetList; Offset32To axisIndicesList; Offset32To*/> glyphRecords; public: - DEFINE_SIZE_STATIC (20); + DEFINE_SIZE_STATIC (24); }; #endif diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 5be09dbb7..e9194fb12 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -3795,6 +3795,14 @@ struct ConditionSet DEFINE_SIZE_ARRAY (2, conditions); }; +struct ConditionSetList +{ + const ConditionSet& operator[] (unsigned i) const + { return this+conditionSets[i]; } + + Array32OfOffset32To conditionSets; +}; + struct FeatureTableSubstitutionRecord { friend struct FeatureTableSubstitution; diff --git a/test/fuzzing/fonts/varc-6868.ttf b/test/fuzzing/fonts/varc-6868.ttf index bb2c518b7..6041d6cc1 100644 Binary files a/test/fuzzing/fonts/varc-6868.ttf and b/test/fuzzing/fonts/varc-6868.ttf differ diff --git a/test/fuzzing/fonts/varc-ac00-ac01.ttf b/test/fuzzing/fonts/varc-ac00-ac01.ttf index 3134c0ad3..fb3a08780 100644 Binary files a/test/fuzzing/fonts/varc-ac00-ac01.ttf and b/test/fuzzing/fonts/varc-ac00-ac01.ttf differ