« Simplified Chinese font is much better in Opera 8.02 | Main | Mail.app crashed with Flash Player 8 »

August 16, 2005

Patch for missing Chinese characters issue of Firefox on Mac OS X

Here's a simple workaround.

I disabled TEC fallback rendering, because I found it caused Chinese characters missing.
I also changed the script for CJKIdeographs to smSimpChinese to let Firefox use better font for Simplified Chinese characters in UTF-8 encoding.

Here's the result. (I use font Kai to emphasize the change.)

Fx-Simpchinese

If you browse Traditional Chinese pages most often, you can use smTradChinese instead.
If you use smSimpChinese, Traditional Chinese pages in UTF-8 encoding may have some regressions.

See screenshot. (The font Kai emphasized the regression.)
Fx-Tradchinese

The final solution should be to use ASTUI totally instead of QuickDraw, because QuickDraw can't support Unicode.
To use ASTUI can also solve Nepal's issue.

BTW: Some gfx/src/mac code look strange to me. For example, in nsUnicodeFontMappingMac::GetFontID(), entry->GetCCMap() never return a void pointer. Does it only work for MathML?

Technorati Tags: ,

My Patch:

Index: nsUnicodeRenderingToolkit.cpp
===================================================================
RCS file: /cvsroot/mozilla/gfx/src/mac/nsUnicodeRenderingToolkit.cpp,v
retrieving revision 1.46
diff -u -p -8 -r1.46 nsUnicodeRenderingToolkit.cpp
--- nsUnicodeRenderingToolkit.cpp 19 Jul 2005 21:13:18 -0000 1.46
+++ nsUnicodeRenderingToolkit.cpp 16 Aug 2005 02:43:13 -0000
@@ -55,17 +55,17 @@
#include <FixMath.h>

#define BAD_FONT_NUM -1
#define BAD_SCRIPT 0x7F
#define STACK_TRESHOLD 1000

static NS_DEFINE_CID(kSaveAsCharsetCID, NS_SAVEASCHARSET_CID);

-//#define DISABLE_TEC_FALLBACK
+#define DISABLE_TEC_FALLBACK
//#define DISABLE_PRECOMPOSEHANGUL_FALLBACK
//#define DISABLE_LATINL_FALLBACK
//#define DISABLE_ATSUI_FALLBACK
//#define DISABLE_TRANSLITERATE_FALLBACK
//#define DISABLE_UPLUS_FALLBACK

#define IS_FORMAT_CONTROL_CHARS(c) ((0x2000==((c)&0xFFF0))||(0x2028==((c)&0xFFF8)))
#define IS_CONTEXTUAL_CHARS(c) ((0x0600<=(c))&&((c)<0x1000))
Index: nsUnicodeMappingUtil.cpp
===================================================================
RCS file: /cvsroot/mozilla/gfx/src/mac/nsUnicodeMappingUtil.cpp,v
retrieving revision 1.36
diff -u -p -8 -r1.36 nsUnicodeMappingUtil.cpp
--- nsUnicodeMappingUtil.cpp 13 May 2005 22:50:23 -0000 1.36
+++ nsUnicodeMappingUtil.cpp 16 Aug 2005 02:43:13 -0000
@@ -442,17 +442,17 @@ void nsUnicodeMappingUtil::InitBlockToSc
smGurmukhi, smGujarati, smOriya, smTamil,
smTelugu, smKannada, smMalayalam, smThai,
smLao, smTibetan, smGeorgian, smKorean,
smTradChinese, smEthiopic, smKhmer,
smPseudoUnicode, // for Unified Canadian Syllable
smPseudoUserDef,

// start the variable section
- smRoman, smRoman, smJapanese, smJapanese, smJapanese,
+ smRoman, smRoman, smJapanese, smJapanese, smSimpChinese, // for CJKIdeographs
smRoman
};
for(PRUint32 i= 0; i < kUnicodeBlockSize; i++)
{
mBlockToScriptMapping[i] = prebuildMapping[i];
}
}

Posted by ginn at August 16, 2005 11:07 AM

Trackback Pings

TrackBack URL for this entry:
http://www.chenqi.org/mt/mt-tb.cgi/33

Comments

Post a comment




Remember Me?