[HarfBuzz] HB-NG and Qt
Behdad Esfahbod
behdad at behdad.org
Thu Nov 6 09:32:26 PST 2014
On 14-11-05 11:50 PM, Khaled Hosny wrote:
> Tahoma (at least the version shipped in Windows 7) has a kern table,
> but no kern feature in its GPOS table, so HarfBuzz will not apply the
> kern table as Behdad described. Uniscribe does not apply the kern
> table here either AFAICT, so I think the font is working as intended.
That was indeed my thinking before. From what I remember, Uniscribe *never*
applied the TrueType 'kern' table; it was left to applications to do that.
So I think what I like to see is: on versions of Windows that ship with such
fonts, does notepad apply kerning? If it does, we should do in HarfBuzz.
Otherwise I'm leaning towards keeping HarfBuzz as is.
That said, "fixing" this is about three lines of code. If Konstantin wants it
badly, I don't mind doing it.
Jonathan, what do you think?
behdad
> On Tue, Nov 4, 2014 at 9:18 AM, Konstantin Ritt <ritt.ks at gmail.com> wrote:
>> The issue appears on Windows indeed. The problematic font was "Tahoma".
>> See more details at https://bugreports.qt-project.org/browse/QTBUG-41931
>> (not that many, though).
>> The proposed `fontEngine->doKerning(..)` is used either in the HB-old path
>> in case the shaper item's `kerning_applied` flag appears to be unset after
>> shaping, though there is no similar thing in HB-NG, so I don't think
>> applying additional kerning blindly is a good solution in general.
>> All `doKerning()` method does is loads the kerning pairs from the font's
>> ('k', 'e', 'r', 'n') table and applies kerning metrics. I believe it is
>> quite the same HB does.
>>
>> Regards,
>> Konstantin
>>
>> 2014-11-04 10:51 GMT+04:00 Behdad Esfahbod <behdad at behdad.org>:
>>>
>>> Hi Konstantin?
>>>
>>> Which font exactly?
>>>
>>> The rule in HarfBuzz-ng is, if the font has *any* GPOS, then the old-style
>>> kern table is not applied. This is not exactly what OpenType recommends,
>>> but
>>> is a cleaner approach than applying old-style kern if the GPOS table has
>>> no
>>> 'kern' feature.
>>>
>>> At any rate, we need to see what font exactly this is happening with, and
>>> what
>>> Uniscribe does.
>>>
>>> IIRC, some fonts shipped with Windows XP or 7 could hit this problem, but
>>> hardly any other font we know about.
>>>
>>> Cheers,
>>> behdad
>>>
>>> PS. If you write to the list, others can chime in. Specifically,
>>> Jonathan
>>> knows a lot about these as they highly care about Windows experience.
>>>
>>> On 14-11-03 10:43 PM, Konstantin Ritt wrote:
>>>> Hi Behdad,
>>>>
>>>>
>>>> As you may know, we've switched to HB-NG as of Qt 5.4 alpha, which is a
>>>> good
>>>> news, of course.
>>>> However we didn't drop the HB-old path and it is possible to switch to
>>>> it,
>>>> which is very handy for comparing the shaping/rendering results between
>>>> HB-NG
>>>> and HB-old, BTW.
>>>>
>>>> Now, here is a bug report
>>>> https://bugreports.qt-project.org/browse/QTBUG-41931
>>>> about kerning issue with some fonts.
>>>> I was proposing a quick possible solution w/o expecting it to help...
>>>> but it
>>>> helped, so I'm in doubts:
>>>> ~2 years ago you answered that NG supports both old and new style
>>>> kerning
>>>> just fine (even better than HB-old) by enabling the kern feature, so my
>>>> code
>>>> currently is:
>>>> {code}
>>>> const hb_feature_t features[1] = {
>>>> { HB_TAG('k','e','r','n'), !!kerningEnabled, 0, uint(-1) }
>>>> };
>>>> const int num_features = 1;
>>>> shapedOk = hb_shape_full(hb_font, buffer, features, num_features, 0);
>>>> {code}
>>>> but then, I don't understand why applying the old-style kerning manually
>>>> on
>>>> top of HB's results solves the raised issue. Am I missing something?
>>>>
>>>> Best regards,
>>>> Konstantin
>>>
>>> --
>>> behdad
>>> http://behdad.org/
>>
>>
>>
>> _______________________________________________
>> HarfBuzz mailing list
>> HarfBuzz at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/harfbuzz
>>
>
--
behdad
http://behdad.org/
More information about the HarfBuzz
mailing list