tlwg / fonts-tlwg

Other
50 stars 6 forks source link

Phintu + Macron below rendered as two copies of phinthu #7

Closed Richard57 closed 6 years ago

Richard57 commented 6 years ago

This happens at least with HarfBuzz as the render (observed with Versions 1.2.7 and 1.8.4 of HarfBuzz), as may be seen for the string กฺ̱ garuda (This image was generated with the command hb-view --font-size 120 -o garuda.png -Opng /usr/share/fonts/truetype/tlwg/Garuda.ttf กฺ̱)

This bug was observed with the plain fonts Garuda, Kinnari, Laksaman, Loma, Norasi, Purisa, Sawasdee, TlwgMono, TlwgTypewriter, TlwgTypist, TlwgTypo, Umpush and Waree

This is not a HarfBuzz bug; it does not occur with the fonts Tahoma or Code2000.

Richard57 commented 6 years ago

I've located the bug in Garuda.sfd. (I'm not fluent in FontForge.) There's a segment of code there:

ChainSub2: glyph "'ccmp' Thai Macron Below Vowel Reordering" 0 0 0 3
 String: 22 macronbelowcmb uni0E38
 BString: 0 
 FString: 0 
 2
  SeqLookup: 0 "Thai Sara U Macron Reordering"
  SeqLookup: 1 "Thai Sara U Macron Reordering"
 String: 22 macronbelowcmb uni0E39
 BString: 0 
 FString: 0 
 2
  SeqLookup: 0 "Thai Sara UU Macron Reordering"
  SeqLookup: 1 "Thai Sara UU Macron Reordering"
 String: 22 macronbelowcmb uni0E3A
 BString: 0 
 FString: 0 
 2
  SeqLookup: 0 "Thai Phinthu Macron Reordering"
  SeqLookup: 1 "Thai Maitaikhu Macron Reordering"
EndFPST

The last SeqLookup should invoke "Thai Phinthu Macron Reordering", not "Thai Maitaikhu Macron Reordering". The incorrect line has no effect, and so we get two phinthus. I believe this bug is present in all the font files.

thep commented 6 years ago

Indeed. I've tried fixing it and the problem is gone. I'll work on all the fonts soon. Thank you very much for your investigation!