[varc] Implement conditionSets

This commit is contained in:
Behdad Esfahbod committed 2024-04-16 17:10:46 -06:00
1 parent 6608b4578d
commit 7c8743546f
5 files changed
+26 -6

No files matched your search

+15 -4
View File
@@ -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
+3 -2
View File
@@ -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
+8
View File
@@ -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.
Binary file not shown.