[HarfBuzz] Shaping Thai text

Peter Hunter phunter at atex.com
Thu Feb 3 14:48:30 PST 2011


On 2/3/11 7:41 PM Lars Knoll wrote

>>
>>On Thu, Feb 3, 2011 at 2:35 PM, Theppitak Karoonboonyanan
><thep at linux.thai.net> wrote:
>>> On Thu, Feb 3, 2011 at 1:39 PM, Peter Hunter <phunter at atex.com> wrote:
>>>> I'm using Harfbuzz (not Harfbuzz-ng) for shaping Thai text (using
>>>>HB_BasicShape/HB_HeuristicPosition)
>>>>
>>>> Not being familiar with the Thai language, I've been told that the
>>>>vowels/marks are positioned "too high", (particularly compared to MS
>>>>wordPad/Notepad)
>>>> At least with the fonts I have access to, the vowels/marks are already
>>>>configured to an appropriate height for most situations and do not
>>>>require the extra adjustment provided in "positionCluster"
>>>>
>>>> Disabling the extra adjustment however causes a problem with the
>>>>positioning of the combining above marks when used in conjunction with
>>>>0xe1b,0xe1d,0xe1f characters( PO PLA, PO FA and PO FAN). (These
>>>>characters all have a trailing vertical stem that overlaps the
>>>>combining above marks when left at their default position)
>>>> In wordpad/notepad these marks are left at their design height, but
>>>>positioned left aligned with the base character.
>>>> (The fonts appear to have been designed for this situation, but I
>>>>don't know if that is true for Thai fonts in general)
>
>The heuristic positioning code should not get used when the font has a
>GPOS table. The heuristic positioning code is there as a fallback to
>provide readable results. I don't think we can expect any good
>typographical results from it in the general case (even though it does
>deliver quite ok results in many cases).
>
>>>
>>> I also see this weird rendering on Qt applications, and confirm that
>>>this is
>>> considered sub-optimal typography. Pango, on the other hand, positions
>>> the glyphs more elegantly, either by the aids of PUA glyphs or OpenType
>>> GPOS feature.
>
>The GPOS features would get used by Qt and harfbuzz.old as well if they
>are available in the font. So either Pango has some hand tuned code for
>positioning thai diacritics or it uses some extensions for ligated glyphs
>in the PUA. Patches to make use of the PUA glyphs are welcome (the hebrew
>shaper can act as an example, it also tries to ligate certain glyphs if
>the font supports it).
>
>>>
>>> (The PUA solution is still retained for compatibility with Windows,
>>>where
>>> the lack of OpenType feature is a norm for Thai fonts, so users can
>>>still
>>> use fonts designed for Windows on it.)
>>>

That is the case with these fonts, there is no GPOS table but alternate glyphs
are available in the PUA area
Also a brief examination of the Thai module in Pango shows references to these PUA glyphs

>>>> So, I'd like to know if this issue has been resolved in "-ng" or if
>>>>anyone else has experienced and/or resolved this problem
>>>
>>> I wonder how to test HarfBuzz-ng per se to find it out. To my
>>>understanding,
>>> HarfBuzz-ng is being used in Pango, but the shaping engine which
>>> provides the proper positioning is in Pango layer, not HarfBuzz-ng.
>>>
>>> Regards,
>>> --
>>> Theppitak Karoonboonyanan
>>> http://linux.thai.net/~thep/
>>>

Thanks for your responses
Peter Hunter
phunter at atex.com




More information about the HarfBuzz mailing list