Skip to content

Commit

Permalink
Expose and fix name processing discrepency
Browse files Browse the repository at this point in the history
  • Loading branch information
rsheeter committed Oct 8, 2024
1 parent ab711bf commit 9eb9ab9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion glyphs-reader/src/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2133,14 +2133,16 @@ impl TryFrom<RawFont> for Font {

let mut names = BTreeMap::new();
for name in from.properties {
// TODO: we only support dflt, .glyphs l10n names are ignored
// We don't support full l10n of names, just the limited capability of glyphsLib
// See <https://github.com/googlefonts/fontc/issues/1011>
name.value
.or_else(|| {
name.values
.iter()
.find(|v| v.language == "dflt")
.map(|v| v.value.clone())
})
.or_else(|| name.values.first().map(|v| v.value.clone()))
.and_then(|value| names.insert(name.key, value));
}
names.insert("familyNames".into(), from.family_name);
Expand Down
10 changes: 9 additions & 1 deletion resources/testdata/glyphs3/TheBestNames.glyphs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ value = "A trade in marks";
key = manufacturers;
values = (
{
language = ENG;
value = "Who made you?!";
},
{
language = dflt;
value = "Who made you?!";
}
Expand All @@ -307,8 +311,12 @@ value = "https://example.com/manufacturer";
key = designers;
values = (
{
language = dflt;
language = IT_CAN_BE_ANYTHING;
value = "Designed by me!";
},
{
language = NOT_THIS_ONE;
value = "Designed by ... you?!";
}
);
},
Expand Down

0 comments on commit 9eb9ab9

Please sign in to comment.