googlefonts / shaperglot

Test font files for language support
Apache License 2.0
29 stars 4 forks source link

New test request for unencoded glyph variants #8

Closed NeilSureshPatel closed 1 year ago

NeilSureshPatel commented 1 year ago

I think I need a new test for unencoded glyph variants.

These would be the failure modes.

  1. Alternate glyph not in font. Perhaps: Does input glyph have variants in GDEF? e.g. is there an Eng and any Eng.xxxx (imperfect since we don't know what Eng.xxxx is, nor do we know if the default design of Eng happens to be the variant we want. This might more a warn than a fail, since it would require someone to review the font.)
  2. If item1 passes: Is target language tag not used in locl feature?, e.g. "DJR" not used in locl feature
  3. If item1 and item 2 passes, Target language is used in locl feature but target glyph is not changed.

It would be good to also be able test item 3 with other OT features like smcp. Perhaps compare cluster 1 with just smcp on against cluster 2 with locl+smcp on.

I think logic would work.

simoncozens commented 1 year ago

Let me just check I understand what you're asking for:

The profile specifies an input codepoint (e.g. U+014A Ŋ). This maps to "Eng" in the font, and shaperglot looks to see if there are any other "Eng.XXX" unencoded in the font. If there are not, we get a warning.

If there are, we check that they are triggered by a locl feature for the language we are looking for, and that the glyph gets changed.

Actually now I write it out myself, I think that makes sense. Will work on it...

NeilSureshPatel commented 1 year ago
Thanks. That’s exactly it. I think it should be generic since the local Eng form largely only applies to pan-African Latin. The is one case where I will be checking a Bhook form, so ideally I can add this check to specific profiles as needed. The other element to this is that not all languages have corresponding OT language tags so I would only be adding the check to those that do.   From: Simon CozensSent: Monday, November 21, 2022 11:16 AMTo: simoncozens/shaperglotCc: Neil S Patel; AuthorSubject: Re: [simoncozens/shaperglot] New test request for unencoded glyph variants (Issue #8) Let me just check I understand what you're asking for:The profile specifies an input codepoint (e.g. U+014A Ŋ). This maps to "Eng" in the font, and shaperglot looks to see if there are any other "Eng.XXX" unencoded in the font. If there are not, we get a warning.If there are, we check that they are triggered by a locl feature for the language we are looking for, and that the glyph gets changed.Actually now I write it out myself, I think that makes sense. Will work on it...—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***> 
simoncozens commented 1 year ago

OK, I've done this. For now, you specify one codepoint at a time, and use it like this:

- check: unencoded_variants
  input:
    text: Ŋ

Shaperglot will pass the language code of the current language definition to Harfbuzz as a BCP47 tag, and Harfbuzz will magically map that to an OpenType tag. If you want to override the language tag passed to Harfbuzz, do it like this:

- check: unencoded_variants
  input:
    text: Ŋ
    language: cuc # Usila Chinantec
NeilSureshPatel commented 1 year ago

Thanks, I'll give it a try.