Add rules data to .designspace.
Closed this issue · 5 comments
This is a proposal for some xml to record conditional glyph substitutions in designspace.
- I'm not sure if this covers all the conditions allowed by OpenType 1.8
- this is not proposal for feature language.
- just covers single glyphs, not groups.
- does not cover GPOS-like things.
<!-- optional: list of substitution rules -->
<rules>
<rule name="vertical bars" enabled="true">
<sub name="cent" byname="cent.alt"/>
<sub name="dollar" byname="dollar.alt"/>
<condition tag="wght" minimum="250.000000" maximum="750.000000"/>
<condition tag="wdth" minimum="100" maximum="120"/>
<condition tag="opsz" minimum="10" maximum="40"/>
</rule>
</rules>
rules
rules
element: groups all the rules. Contains one or more rule
elements
rule
rule
element: a single rule. Contains one or more sub
elements, and one or more condition
elements. All conditions must evaluate to true
for the rule to be
name
: attribute, optional. String. Descriptive name for this rule.enabled
: attribute, optional. Bool. If this rule should be evaluated or not.
sub
sub
element: a single glyph to glyph substitution.
name
attribute, required. Name of the source glyph.byname
attribute, required. Name of the replacement glyph.
condition
condition
element: a single condition that has to evaluate to true for this rule to be valid.
tag
element: attribute, required. OpenType axis tag.minimum
attribute, required. Number.maximum
attribute, required. Number.
Looks good to me. The one change is that a condition in OpenType sets a range in which the feature is applied, rather than gt or lt a threshold. How about just 'max' and 'min' instead of 'operator' and 'value'.
See "Condition Table" in https://www.microsoft.com/typography/otspec/chapter2.htm.
- Read
lgtm
All done in UFOProcessor and designspaceLib