[glyphs] Add support for localized font properties#1705
Conversation
meant to match googlefonts/glyphsLib#1108 Fixes #1695
| pub virtual_masters: Vec<BTreeMap<String, OrderedFloat<f64>>>, | ||
| pub features: Vec<FeatureSnippet>, | ||
| pub names: BTreeMap<String, String>, | ||
| pub localized_names: BTreeMap<String, Vec<(String, String)>>, |
There was a problem hiding this comment.
Suggest a comment or two about the relationship between names and localized names. Immediate questions that pop into mind for me:
- is
namesthe english subset oflocalized names(equivalent to localized_names['some key']`?) - Why is the type of
namesnot the same as the value type forlocalized names?
There was a problem hiding this comment.
i'm not super happy about the distinction between bare names and localized_names myself, I did that initially to keep diffs to a minumum but I'll see if we can have one map to for all the names, English or not
There was a problem hiding this comment.
Naively, perhaps it becomes .names() that just returns a value from localized_names? Or does it not fit together that way?
There was a problem hiding this comment.
yeah, I think that should work. thanks
- Refactor assert_fonts_equal_sans_localized_names() for better maintainability - Add test case demonstrating duplicate language code handling (we pick the last matching glyphsLib which uses python dict assignment semantics)
25b9701 to
c7e73b6
Compare
cmyr
left a comment
There was a problem hiding this comment.
looks like this gets us back a bunch of name table matches :)
merge Font.names and Font.localized_names into all_names: BTreeMap<String Vec<(lang, value)>> Add helper methods to extract/iterate over default vs localized names, using consistent dflt > default > ENG > first priority for default names for default names. Use IndexMap when deduplicating inside update_names to preserve insertion order, which is critical for correct no-english-names fallback behavior (added an explicit test for that one).
meant to match googlefonts/glyphsLib#1108
Fixes #1695