[varc] Implement conditionSets

pull/4578/head
Behdad Esfahbod 11 months ago
parent 6608b4578d
commit 7c8743546f
  1. 19
      src/OT/Var/VARC/VARC.cc
  2. 5
      src/OT/Var/VARC/VARC.hh
  3. 8
      src/hb-ot-layout-common.hh
  4. BIN
      test/fuzzing/fonts/varc-6868.ttf
  5. BIN
      test/fuzzing/fonts/varc-ac00-ac01.ttf

@ -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<unsigned> 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

@ -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> coverage;
Offset32To<MultiItemVariationStore> varStore;
Offset32To<ConditionSetList> conditionSetList;
Offset32To<TupleList> axisIndicesList;
Offset32To<CFF2Index/*Of<VarCompositeGlyph>*/> glyphRecords;
public:
DEFINE_SIZE_STATIC (20);
DEFINE_SIZE_STATIC (24);
};
#endif

@ -3795,6 +3795,14 @@ struct ConditionSet
DEFINE_SIZE_ARRAY (2, conditions);
};
struct ConditionSetList
{
const ConditionSet& operator[] (unsigned i) const
{ return this+conditionSets[i]; }
Array32OfOffset32To<ConditionSet> conditionSets;
};
struct FeatureTableSubstitutionRecord
{
friend struct FeatureTableSubstitution;

Binary file not shown.
Loading…
Cancel
Save