Bug 106466

Summary: Graphite font features cannot be activated on Mac OS X if the font also contains AAT tables
Product: LibreOffice Reporter: EricP <livingfield>
Component: graphics stackAssignee: ⁨خالد حسني⁩ <khaled>
Status: VERIFIED FIXED    
Severity: normal CC: khaled, livingfield, martin_hosken, vsfoote
Priority: medium    
Version: 5.3.0.3 release   
Hardware: All   
OS: macOS (All)   
Whiteboard: target:5.4.0 target:5.3.2
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 71732, 103729    
Attachments: Screenshot showing font features settings
Screenshot showing active font features for Charis SIL but not rendering for Khmer Busra Bunong
Test document
Khmer Busra Bunong font

Description EricP 2017-03-10 04:21:22 UTC
Description:
Graphite font features in the "Khmer Busra Bunong" font (attached) work fine in LO 5.3 on Windows and Linux but are not activated on macOS Sierra 10.12.3 (see screenshots). I'm guessing that this is because the font includes both graphite and AAT tables, but I haven't confirmed this.

LO 5.3 includes a new cross-platform text layout engine which supports Graphite and OpenType Font Features on all platforms. (https://wiki.documentfoundation.org/ReleaseNotes/5.3#Text_Layout)

Enabling graphite font features in Charis SIL font works on all platforms. (http://software.sil.org/charis/support/smart-font-features/) as does Libertine G (http://www.numbertext.org/linux/fontfeatures.pdf).

The Khmer Busra Bunong font (attached) contains both graphite and AAT tables. Bug 105516, comment 1 states that Graphite or AAT takes precedence over OpenType but it appears here that AAT is taking precedence over graphite. This is problematic because it causes different rendering on different platforms. I think I would prefer that Graphite take precedence over AAT.





Reproducible: Always

User Profile Reset: Yes

Additional Info:
Related Bugs:
Bug 58941 and bug 105710 are discussions about implementing a GUI control for enabling OpenType or graphite features.
Bug 71732 (Font-Rendering) - [META] Bugs related to text rendering, typography and font features in LO


User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8
Comment 1 EricP 2017-03-10 04:32:59 UTC
Created attachment 131781 [details]
Screenshot showing font features settings

Note font features have been specified with, e.g. ":litr=1" appended to the font name.

LO in macOS on the left and Windows in a VM on the right.
Comment 2 EricP 2017-03-10 04:34:00 UTC
Created attachment 131782 [details]
Screenshot showing active font features for Charis SIL but not rendering for Khmer Busra Bunong

Left side: LibreOffice 5.3.1.1 on macOS shows working graphite features for Charis SIL but not Khmer Busra Bunong

Right side: LibreOffice 5.3.1.1 on Windows 10 in a VM shows working graphite features in both Charts SIL and Khmer Busra Bunong
Comment 3 EricP 2017-03-10 04:40:18 UTC
Created attachment 131783 [details]
Test document

Test document (requires Charis SIL and Khmer Busra Bunong fonts)
Comment 4 EricP 2017-03-10 04:45:27 UTC
Created attachment 131784 [details]
Khmer Busra Bunong font

The Khmer Busra Bunong font is a Khmer font in the Mondulkiri font series (http://scripts.sil.org/mondulkiri), which has not yet been publicly released.

The Charis SIL font is available at http://software.sil.org/charis/. It does not contain AAT tables (http://scripts.sil.org/SILFontList).
Comment 5 martin_hosken 2017-03-10 13:38:22 UTC
In CommonSalLayout, there is a fixed list of shapers, and so an inherent priority order, passed to hb_shape. This is "coretext_aat", "graphite2", "ot", "fallback".

Not sure why coretext comes before graphite. Reordering would fix this bug.

But it would be good to allow this list to be specified via an environment variable for those wishing to test fonts using libo, or to work around font problems.
Comment 6 martin_hosken 2017-03-10 13:39:08 UTC
In CommonSalLayout, there is a fixed list of shapers, and so an inherent priority order, passed to hb_shape. This is "coretext_aat", "graphite2", "ot", "fallback".

Not sure why coretext comes before graphite. Reordering would fix this bug.

But it would be good to allow this list to be overridden by an environment variable for those wishing to test fonts using libo, or to work around font problems.
Comment 7 ⁨خالد حسني⁩ 2017-03-10 14:47:04 UTC
(In reply to martin_hosken from comment #6)
> In CommonSalLayout, there is a fixed list of shapers, and so an inherent
> priority order, passed to hb_shape. This is "coretext_aat", "graphite2",
> "ot", "fallback".
> 
> Not sure why coretext comes before graphite. Reordering would fix this bug.

That should have been the same order used by HarfBuzz itself, but checking now I see HarfBuzz lists graphite2 shaper, so I probably messed it up when I was trying to see if coretext_aat needs to be listed on Mac only or not.
Comment 8 Commit Notification 2017-03-10 18:45:28 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3cee50476e422e3ed84169cdcbe6bd9883fc9316

tdf#106466: Use graphite2 shaper first

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 ⁨خالد حسني⁩ 2017-03-10 22:33:48 UTC
Actually that is not a regression, we did not support Graphite on Mac before.
Comment 10 EricP 2017-03-11 07:38:07 UTC
Yes, it appears to work fine in master~2017-03-11_02.16.23_LibreOfficeDev_5.4.0.0.alpha0_MacOS_x86-64.dmg

Graphite features can be enabled on both Mac, even when the font contains AAT tables.

I don't see a Windows build yet, so I'll assume that this fix doesn't break the functionality on Windows.

Thank you Khaled and Martin
Comment 11 Commit Notification 2017-03-17 10:08:18 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=68b546b17afa0082862f2a20b8f089ae9124a16a&h=libreoffice-5-3

tdf#106466: Use graphite2 shaper first

It will be available in 5.3.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.