harfbuzz / harfbuzz/harfbuzz

Lookup flags in fonts with no GDEF table

Open
#2,647 35 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
6.1k
Forks
779
Avg merge
14h 26m
Merged PRs (30d)
76

Description

Someone reports [an issue](https://bugs.documentfoundation.org/show_bug.cgi?id=135778) in LibreOffice about some Iranian fonts like B Nazanin (fonts attached in the LIbreOffice issue).

Basically the font has mark ligatures for shadda and the lookups has ignore base and ignore ligatures set (which makes no sense), which causes HarfBuzz to correctly skip bases and make ligature between shadda and fathatan in strings like:
```
$ hb-view "B Nazanin.TTF" اتّفاقاً
```
![HarfBuzz](https://user-images.githubusercontent.com/93914/90577567-9ac8a580-e1c1-11ea-807e-767504e88006.png)
Oddly enough, both Uniscribe and Core Text ignore the lookup flags and don’t for the ligatures.
```
$ hb-view "B Nazanin.TTF" اتّفاقاً --shaper=coretext
```
![Core Text](https://user-images.githubusercontent.com/93914/90577550-871d3f00-e1c1-11ea-84f2-f5866deb706e.png)

As it turns out, the font has no `GDEF` table, so HarfBuzz synthesizes one and use it here.

It is a rather odd font, and I HarfBuzz synthesis of a GDEF table actually matches what [the spec](https://docs.microsoft.com/en-us/typography/opentype/spec/gdef#glyph-class-definition-table-overview) is saying (emphasis mine):
> In addition, a client uses class definitions to apply GSUB and GPOS LookupFlag data correctly. For example, a LookupFlag may specify ignoring ligatures and marks during a glyph operation. **If the font does not include a GlyphClassDef table, the client must define and maintain this information when using the GSUB and GPOS tables**.

But it might be an interoperability issue that we might want to consider (my 2¢ is to 🤷🏽 and declare it working as designed).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.