Bug 89992 - Bad Rendering For Persian Nastaliq Font
Summary: Bad Rendering For Persian Nastaliq Font
Status: RESOLVED NOTOURBUG
Alias: None
Product: HarfBuzz
Classification: Unclassified
Component: src (show other bugs)
Version: unspecified
Hardware: Other Mac OS X (All)
: medium normal
Assignee: Behdad Esfahbod
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-12 09:04 UTC by sahil
Modified: 2015-05-15 21:29 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Rendering of sample words in Safari on the left (correct), and Chrome on the right (incorrect) (284.53 KB, text/plain)
2015-04-12 09:04 UTC, sahil
Details
Rendering of sample words in Safari on the left (correct), and Chrome on the right (incorrect) (284.53 KB, image/png)
2015-04-12 09:05 UTC, sahil
Details

Description sahil 2015-04-12 09:04:20 UTC
Created attachment 115035 [details]
Rendering of sample words in Safari on the left (correct), and Chrome on the right (incorrect)

Chrome, Firefox, and XeTeX all exhibit a rendering bug with the IranNastaliq Persian font. In these program, glyphs overlap, and context-dependent changes do not happen as they should. The bug is shown in Chrome on the right hand side in the attachment.

Safari (shown on the left) and other native OS X applications do not exhibit these problems. It is therefore likely that the problem lies with HarfBuzz.

To reproduce this bug, visit googledrive.com/host/0B5t7PI2Cb4XIfjBROUhucnBSOUdMcnpwNUlDb2t2eW9JQnBSckpYV04xd0M5anBIeW5pVnc
Comment 1 sahil 2015-04-12 09:05:53 UTC
Created attachment 115036 [details]
Rendering of sample words in Safari on the left (correct), and Chrome on the right (incorrect)
Comment 2 Behdad Esfahbod 2015-04-12 09:48:03 UTC
The IranNastaliq font uses the 'cswh' feature for such ligatures.  'cswh' is default-off according to the OpenType spec.  The font should use 'calt' instead.  It's unfortunate, but I'm under the impression that it doesn't work under Windows either.
Comment 3 sahil 2015-04-12 17:00:19 UTC
Hi Behdad,

Thanks for your response and explanation. I am able to get the preferred behavior in Chrome/Firefox with:


  -webkit-font-feature-settings: "cswh";
  -moz-font-feature-settings: "cswh";

and in XeLaTex with 

  \newfontfamily\nastaliq[Script=Arabic,Scale=1.5,Contextuals=Swash]{IranNastaliq}

So it seems that Apple is not following the spec by enabling the swashes by default? I wonder if this is true for all fonts.
Comment 4 Behdad Esfahbod 2015-04-14 06:28:43 UTC
This feature used to be enabled by default in previous versions of Windows, but disabled in Windows 8 on and the spec was updated.  We followed.  Best to update IranNastaliq to use calt for these, and publish the font somewhere.  Thanks.
Comment 5 Behdad Esfahbod 2015-04-27 13:58:37 UTC
Given the prominence of the IranNastaliq font, I think we need to address this issue somehow.  I'm still thinking about possibilities.  Since this is a feature that used to be on, I like to bring it up with Microsoft first.
Comment 6 Behdad Esfahbod 2015-05-15 00:53:26 UTC
Jonathan,

Since this is something that changed in Windows 8, do you think we should try to do something about older fonts?
Comment 7 Jonathan Kew 2015-05-15 07:50:57 UTC
(In reply to Behdad Esfahbod from comment #6)
> Jonathan,
> 
> Since this is something that changed in Windows 8, do you think we should
> try to do something about older fonts?

Can you envisage an approach that would allow harfbuzz to figure out whether the feature was intended to be applied by default or not? I can't.

The only "solution" I can think of here would involve specifically recognizing this font and special-casing it, and I'd be reluctant to do that -- especially at the harfbuzz library level.

If a client app (such as Chrome, Firefox, XeTeX, etc) wants to special-case the IranNastaliq font and pass the extra feature to harfbuzz, that option is open to them, but IMO it'd be wrong to hard-code such behavior into the library.
Comment 8 Behdad Esfahbod 2015-05-15 21:29:56 UTC
Thanks Jonathan.  I can't think of a good solution either.

If someone wants to either contact IranNastaliq owners and ask them to create a new version, or fix and distribute it themselves, please go ahead and also report here.

Thanks.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.