Patched version of Mozilla Firefox to improve complex-layout and right-to-left languages

Email Stephen Blackheath 1 - Updated 26 Jan 2006

This page contains a modified version of Mozilla Firefox to work better with languages that require a complex layout, especially right-to-left languages. These changes should make Firefox render text correctly in the following languages, especially in "justify" mode (please tell me your test results!):
Arabic2
Bangla/Bengali
Devanagari
Farsi
Gujarati
Gurmukhi
Hangul
Hebrew2
Kannada2
Khmer
Malayalam
Oriya
Sinhala
Syriac
Tamil
Telugu
Thai
Tibetan
Urdu

1 This link allows you to email me, but you must request my email address through a web form. This is an anti-spam measure - sorry for the inconvenience.

2 I have done some testing with this language.


NEWS/NOTE!:
27 Nov 2006 - I am not maintaining this page or this patch, but you can find out the latest on the new Thebes text renderer at [Bug 333659] Move nsTextFrame over to Thebes APIs

Frequently asked question: When will these changes be integrated into the Mozilla build?

ANSWER: The short answer is around the beginning of 2007. In the meantime, the patches on this page will have to do.

The patch on this page is extremely unlikely to be integrated by Mozilla. The reason is that Mozilla and Firefox are switching from their existing graphics rendering layer to a new implementation, and the patches here apply to the old implementation (used in existing Firefox versions).

The new implementation is called Thebes, which uses the new Cairo cross-platform graphics rendering library. Cairo is a community project. I will be contributing to Mozilla in this work. It will be my job to make sure the complex layout rendering works correctly. I will use this page to co-ordinate testing, and you will be able to help me test.

Take a look at my thebes work (in progress) here.


Linux note: These changes include the patch to be found on the TA Linux site. Unlike the TA Linux patch, this patch turns pango on by default (overridden by environment setting MOZ_ENABLE_PANGO=0). Note that Fedora Linux ships a version of Firefox with Pango support (switch on with 'export MOZ_ENABLE_PANGO=1'), but this version works better for complex layout languages.

Hebrew note: Here are some screenshots of Hebrew rendered by this version. See Mechon Mamre for your Biblical texts and help on getting your (Windows) system set up for Hebrew. See Dov Grobgeld's page (author of the Pango Hebrew module) for Linux help.


Here are the files:
Microsoft Windows
firefox-1.0.4.en-US.rtl-v3.win32.installer.exe Modified version of Firefox for Windows (with version 3 patch).
firefox-1.0.6.en-US.rtl-v4.8.win32.installer.exe Modified version of Firefox for Windows (with version 4.8 patch).

Note: This version doesn't work properly on Windows 98!

firefox-1.0.6.en-US.rtl-v4.9.win32.installer.exe Modified version of Firefox for Windows (with version 4.9 patch).
Fixes Windows 98 brokenness - no other changes. Note Arabic is broken.
firefox-1.0.6.en-US.rtl-v4.10.win32.installer.exe ** NEWEST! (stable) ** Modified version of Firefox for Windows (with version 4.10 patch). Note: 4.10 patch is functionally equivalent to 4.12 patch on Windows.
firefox-1.6a1.en-US.rtl-v4.12.win32.installer.exe ** NEWEST! (unstable) ** Modified version of DeerPark for Windows (with version 4.12 patch).
Note that this is an unstable version of Firefox, built from the very latest CVS. Use the 1.0.6 version if you want a stable one.

Install issues:
  • It sometimes fails saying it can't find the "quality feedback agent". Cancel and re-start the installation, and it will work the second time.
  • Ensure you have the correct fonts installed. You may have to tell Firefox explicitly to use your chosen font through the "Fonts and Colors" Preference.
  • Be aware that there are still issues on Windows 98 - see Bug #8 below.
  • You have to enable your desired language in the Regional Options under the Control Panel, otherwise Windows will not render your text properly.
msvcp71.dll
msvcr71.dll
  • You may see an error that MSVCR71.DLL is missing, or that some DLL fails to load. If you do, then download these two files, and put them into C:\WINNT\SYSTEM32 (on Windows 2000) or C:\WINDOWS (on Windows 98). I have not yet figured out how to automate this process.

Debian GNU/Linux - Sarge
mozilla-firefox_1.0.4-2_i386.deb
mozilla-firefox-dom-inspector_1.0.4-2_i386.deb
mozilla-firefox-gnome-support_1.0.4-2_i386.deb
** NEWEST! ** Modified packages for Debian Linux (with version 4.12 patch). Fixes Linux bug #30.
libpango1.0-0_1.8.1-1_i386.deb
libpango1.0-common_1.8.1-1_i386.deb
Patched version of Pango that fixes Bug #21.
Debian GNU/Linux - Sid
i386 architecture:
mozilla-firefox_1.0.6-4_i386.deb
mozilla-firefox-dom-inspector_1.0.6-4_i386.deb
mozilla-firefox-gnome-support_1.0.6-4_i386.deb
amd64 architecture:
mozilla-firefox_1.0.7-1_amd64.deb
mozilla-firefox-dom-inspector_1.0.7-1_amd64.deb
mozilla-firefox-gnome-support_1.0.7-1_amd64.deb
** NEWEST! ** Modified packages for Debian Linux (with version 4.12 patch). Fixes Linux bug #30.
libpango1.0-0_1.8.2-1_i386.deb
libpango1.0-common_1.8.2-1_i386.deb
Patched version of Pango that fixes Bug #21.

Gentoo Linux
Instructions (Gentoo experts might know a better way):
  1. Install the dependencies for Mozilla Firefox (This does not install Mozilla Firefox itself):
    emerge --onlydeps mozilla-firefox
  2. Copy the downloaded mozilla-firefox-???.ebuild file to the following directory, overwriting an existing file of the same name:
    /usr/portage/www-client/mozilla-firefox/
  3. Make it re-calculate file digests so it treats the new ebuild file as valid:
    cd /usr/portage/www-client/mozilla-firefox
    ebuild mozilla-firefox-???.ebuild digest
  4. Build and install patched version:
    cd /usr/portage/www-client/mozilla-firefox
    ebuild mozilla-firefox-???.ebuild merge
  5. (Alternatively the ebuild .. merge can be replaced by three steps, compile, install, then qmerge)

As for the Pango problems in bug #21:

  1. Bug #21 is fixed in pango-1.10.0, which you can install with this command:
    cd /usr/portage/x11-libs/pango
    ebuild pango-1.10.0.ebuild merge
mozilla-firefox-1.0.6-r6.ebuild Gentoo ebuild for version 4.11 patch
mozilla-firefox-1.0.6-r6.ebuild Gentoo ebuild for version 4.12 patch

Source code (all platforms)
firefox-1.0.4-rtl-v2.patch Patch version 2 against Firefox 1.0.4
firefox-1.0.4-rtl-v3.patch Patch version 3 against Firefox 1.0.4
deerpark-cvs-rtl-v4.4.patch Patch version 4.4 against the CVS trunk version, which is called Deer Park.
This is still a work in progress, but it fixes most of our issues on Linux, and all but bug #20 on Windows.
deerpark-cvs-rtl-v4.5.patch Patch version 4.5 against the CVS trunk version (Deer Park).
Work in progress.
deerpark-cvs-rtl-v4.6.patch Patch version 4.6 against the CVS trunk version (Deer Park).
deerpark-cvs-rtl-v4.7.patch Patch version 4.7 against the CVS trunk version (Deer Park).
deerpark-cvs-rtl-v4.8.patch Patch version 4.8 against the CVS trunk version (Deer Park).
firefox-1.0.6-rtl-v4.8.patch Patch version 4.8 against Firefox 1.0.6
deerpark-cvs-rtl-v4.9.patch Patch version 4.9 against the CVS trunk version (Deer Park).
Fixes brokenness on Windows 98 - no other changes.
firefox-1.0.6-rtl-v4.9.patch Patch version 4.9 against Firefox 1.0.6
Fixes brokenness on Windows 98 - no other changes.
deerpark-cvs-rtl-v4.10.patch Patch version 4.10 against the CVS trunk version (Deer Park).
Fixes Arabic issues (bug #25).
firefox-1.0.6-rtl-v4.10.patch Patch version 4.10 against Firefox 1.0.6
Fixes Arabic issues (bug #25).
deerpark-cvs-rtl-v4.11.patch Patch version 4.11 against the CVS trunk version (Deer Park).
Fixes Indic languages on Linux bug #27.
Submitted for discussion for bug 297074
firefox-1.0.6-rtl-v4.11.patch Patch version 4.11 against Firefox 1.0.6
Fixes Indic languages on Linux bug #27.
deerpark-cvs-rtl-v4.12.patch ** NEWEST! ** Patch version 4.12 against the CVS trunk version (Deer Park).
Just brought up to date with latest CVS.
Submitted for discussion for bug 297074
firefox-1.0.6-rtl-v4.12.patch ** NEWEST! ** Patch version 4.12 against Firefox 1.0.6
Fixes Linux bug #30.
pango-1.8.2-rtl.patch Pango patch that fixes (a very annoying) bug #21.

If you want it pre-built on another platform, let me know and I'll see what I can do.

To build on Linux, add --enable-pango to the 'configure' command.

Bugs fixed:

Outstanding bugs:

Bugs I won't fix:


Test pages:
Hebrew: Here is the Mechon-Mamre text Brashit (the page in my screenshots).
Hebrew: Here is my mish-mash Hebrew test page.
Arabic: The Cow (right-aligned).
Arabic: The Cow (justified)
Arabic: Iraq4allnews.dk news item This shows bug #13 quite well.
Omnibus test case at Bug 297074
Hugo's Arabic test page


Links:
Context-dependent and Directional Text - Complex-Text Languages - a really good article on how the various complex-layout languages are complexly laid out.
Hebrew: The TanakhML project - biblical texts
Hebrew: Mechon-Mamre - biblical texts
Hebrew: Hebrew Today - news for Hebrew learners
Arabic: One Ummah Network Qur'an
Indic: Newspapers in Indic languages I cannot make the Hindi ones work at all (font? encoding?)
Multiple languages: Wikipedia


Firefox bugzilla bugs:
Bug 60546 - [BiDi] Unicode Hebrew/Yiddish Diacritics do not correctly align in some fonts.
Bug 297074 - Make nsRenderingContext::GetWidth optionally return an array of glyph widths
Bug 157967 - Make Gecko interoperate better with advanced typography systems such as ATSUI, Uniscribe, Pango & STSF
Bug 121540 - Use ATSUI for text rendering on Mac OS X (Macintosh)
Bug 240914 - Unicode combining characters (e.g. Devanagari, Tamil, Malayalam ) ruined with text-align: justify

Pango bugzilla bugs:
Bug 313781: Hebrew vowels rendered wrong because shaper font cache gets polluted (My bug report for bug #21 - CLOSED because it's fixed in pango-1.10.0)


This page is brought to you from Waikanae, New Zealand. Haere mai!