Closed Bug 603879 Opened 14 years ago Closed 14 years ago

update harfbuzz to v0.2

Categories

(Core :: Graphics, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- betaN+

People

(Reporter: jfkthame, Assigned: jfkthame)

References

Details

Attachments

(3 files)

Behdad has pushed a significant update to the harfbuzz-ng code, including the first complex-script shaper (for Arabic/Syriac/N'Ko), as well as various bug-fixes etc.

We should update our copy, and start using HB for shaping Arabic etc. (In particular, this will re-enable downloadable Arabic OpenType fonts on OS X, which have just been broken by the landing of OTS.)
Code from the harfbuzz-ng repository, as of 2010-11-01.
Attachment #487448 - Flags: review?(jdaggett)
This enables harfbuzz rendering by default for Arabic (and related scripts), now that it supports the necessary shaping. With this patch, gfx.font_rendering.harfbuzz.level supports four levels:
0 - don't use harfbuzz for any scripts
1 - "simple" scripts only
2 [default] - also Arabic/Syriac/N'ko
3 - all scripts (even though Indic etc will not be shaped properly)

This enables downloadable OpenType fonts to work correctly for Arabic even on OS X - good testcases include http://webfonts.fonts.com/en-US/Project/ChooseFonts?fontQuery=arabic and the Nastaliq font example at http://pakdata.com/firefox-complex-script-font-rendering-problem. (Note that the latter does NOT render correctly via Core Text - some glyphs get mispositioned. But harfbuzz appears to handle it fine.)
Attachment #487453 - Flags: review?(jdaggett)
Attachment #487448 - Flags: review?(jdaggett) → review+
Attachment #487453 - Flags: review?(jdaggett) → review+
Note: I think we should add reftests for OT Arabic handling.  And the lack of automated tests for harfbuzz code is still a concern in my mind.
(In reply to comment #3)
> Note: I think we should add reftests for OT Arabic handling.

Good point. That shouldn't be hard to do - I'll work up something.

>  And the lack of
> automated tests for harfbuzz code is still a concern in my mind.

Yes, that would also be good. I think it should be done as part of the upstream harfbuzz project rather than within our tree - though we may well want to contribute anyway, regardless of where it happens.
Nominating this for blocking-2.0 as I think it's important to have the harfbuzz update that includes Arabic shaping support - this will re-enable Arabic-script downloadable fonts on OS X, which were effectively broken by the landing of OTS (bug 527276). There are enough Arabic webfonts out there (e.g. see http://webfonts.fonts.com/en-US/Project/ChooseFonts?fontQuery=arabic) that disabling them is a serious regression, and I don't think we should ship a final release that way.

(On non-Mac platforms, the OTS landing doesn't break Arabic webfonts because we allow the OpenType layout tables to be passed through to the platform; we don't allow this by default on OS X because we've seen too many crashes in OS X font code due to bad OpenType tables.)
blocking2.0: --- → ?
But wait, won't all other shaped fonts also have been disabled on OS X?

And, as a separate, less important question, does this shaper also support Persian?
blocking2.0: ? → betaN+
(In reply to comment #6)
> But wait, won't all other shaped fonts also have been disabled on OS X?

Only for *downloaded* fonts.  Shaping of platform fonts, both OpenType and AAT, will still happen as usual.
(In reply to comment #7)
> (In reply to comment #6)
> > But wait, won't all other shaped fonts also have been disabled on OS X?
> 
> Only for *downloaded* fonts.  Shaping of platform fonts, both OpenType and AAT,
> will still happen as usual.

Right. And note that OS X has never supported shaping for Indic OpenType fonts (only Indic AAT); but there are very few Indic AAT fonts in circulation besides those that ship with the OS, as hardly anyone else makes AAT fonts. The only "complex" script where OS X supports *OpenType* shaping is Arabic, so that's the one that is important for @font-face deployment. There may well be sites deploying Indic OpenType fonts as well, but those have never shaped correctly on OS X (e.g. http://webfonts.fonts.com/en-US/Project/ChooseFonts?fontQuery=hindi doesn't shape correctly in Safari, either) and so there isn't the same regression issue.

(In reply to comment #6)

> And, as a separate, less important question, does this shaper also support
> Persian?

Yes.
This is a simple testcase that checks the rendering of an Arabic word using DejaVu via @font-face, by comparing with a reference that uses the "pre-shaped" compatibility characters. It currently fails on OS X but should pass once we enable harfbuzz Arabic shaping.
Attachment #489427 - Flags: review?(jdaggett)
Attachment #489427 - Flags: review?(jdaggett) → review+
Refreshed, tryserver-tested and pushed:
http://hg.mozilla.org/mozilla-central/rev/af5a5452cda4 (pt 1 - harfbuzz)
http://hg.mozilla.org/mozilla-central/rev/566c74963913 (workaround for gcc4.3 optimizer bug causing build failure on tryserver)
http://hg.mozilla.org/mozilla-central/rev/11ca3cd81864 (pt 2 - gfx integration)
http://hg.mozilla.org/mozilla-central/rev/7cf596b44baf (arabic shaping reftest)
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Depends on: 614903
Depends on: 1146859
You need to log in before you can comment on or make changes to this bug.