[Interest] Enabling Harfbuzz on Mac

Joshua Grauman jnfo-c at grauman.com
Thu Feb 23 19:32:05 CET 2012


Thanks. I found out that the issue is that Harfbuzz is only used on Mac 
(even when enabled) for fonts that have GSUB and GPOS tables. I assumed 
that it was used for all TTF fonts (which Harfbuzz can shape). But 
apparently Qt can't/doesn't distinguish between AAT fonts and TTF fonts 
except for noting the presence of the GSUB and GPOS tables... So my font 
was TTF and should be able to be shaped by Harfbuzz, but since it didn't 
have GSUB and GPOS tables, it wasn't shaped by Harfbuzz. The main issue 
here is that the Mac text renderer has a bug so rendered my text 
incorrectly and thus I want to use Harfbuzz... Anyway, I realize now it's 
not anything I'm doing wrong but a design decision of Qt. I'll work to see 
if there is a way to use Harfbuzz for all TTF fonts on Mac, but it would 
take a change to the Qt source... Thanks again!

Josh

> Joshua Grauman wrote:
>
>> According to this page, it is now possible to enable Harfbuzz on Mac by setting
>> an environment variable:
>> https://bugreports.qt-project.org/browse/QTBUG-17728
>>
>> However, unless I'm missing something I haven't been able to enable
>> Harfbuzz on Mac. I'm using Qt 4.8, which according to the sources should
>> have this feature enabled. It should be as simple as setting the
>> environment variable: QT_ENABLE_HARFBUZZ which I have done. However, after
>> doing this, my text output still looks drastically different on Mac than
>> on Windows/Linux.
>
> Are you using the DirectWrite engine on Windows? If not, then text will 
> still look quite different on the two platforms because of the hinting 
> applied by GDI, the lack of subpixel positioning on Windows and the fact 
> that the GDI font backend in some cases uses different glyph metrics to 
> the CoreText backend.
>
> Otherwise you should find a pretty close correspondence. We haven't 
> switched to Harfbuzz on Mac yet as we've not had any reason to do so but 
> I suppose you could verify which one's actually in use by stepping 
> through the code. I wouldn't necessarily expect the shaping engine to 
> make a radical difference to the output in simple cases anyway - as I 
> say we have a pretty good Windows/Mac correspondence without using a 
> common shaping engine.
>
> Note that there are quite a few bugs in the DirectWrite font engine as 
> shipped with Qt 4.8 leading to incorrect metrics in some cases - I 
> logged all the ones I found when we switched to DirectWrite in the 
> public bug database. The fixes are mostly straightforward.
>
> James
>



More information about the Interest mailing list