linebender / norad

Rust crate for working with Unified Font Object files
Apache License 2.0
44 stars 12 forks source link

Designspaces: handle localization #323

Open madig opened 10 months ago

madig commented 10 months ago

The spec describes e.g. https://fonttools.readthedocs.io/en/latest/designspaceLib/xml.html#stylename-familyname-stylemapstylename-stylemapfamilyname-elements-localised-names-for-instances to assign localized names. Norad may want to handle that.

cmyr commented 10 months ago

Yes we will definitely want to handle this, and I can't really imagine doing it without custom serde impls. I wish that the spec were a bit clearer on expectations here; in particular, is it possible to have only localized names, or should there only be localized names if there is also a default name?

My first thought is to replace the use of Option<String> for this type with an Option<LocalizedString> that is some custom type that wraps some sort of collection..

madig commented 10 months ago

My understanding last time is that the normal attribute for e.g. family name is lang "en", unless there's an explicit "en" entry in localized family name, but I haven't thought about it too hard. designspaceLib uses a dict[str, str] for these localized attributes.