bug 293301 : rendering of text in non-Western encoding is broken (r=sfraser, mano, sr=sfraser, a1.8b2/a1.1a = asa)

This commit is contained in:
jshin%mailaps.org 2005-05-13 22:50:23 +00:00
Родитель cd24225b89
Коммит 573f7a7ea8
3 изменённых файлов: 57 добавлений и 111 удалений

Просмотреть файл

@ -1,91 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsUnicodeBlock_h__
#define nsUnicodeBlock_h__
#include <Script.h>
enum
{
smPseudoUnicode = smUninterp + 0,
smPseudoUserDef = smUninterp + 1,
smPseudoTotalScripts = smUninterp + 2
};
typedef enum {
// blocks which always use the same script to render, regardless of the order of fonts
kGreek = 0,
kCyrillic,
kArmenian,
kHebrew,
kArabic,
kDevanagari,
kBengali,
kGurmukhi,
kGujarati,
kOriya,
kTamil,
kTelugu,
kKannada,
kMalayalam,
kThai,
kLao,
kTibetan,
kGeorgian,
kHangul,
kBopomofo,
kEthiopic,
kCanadian,
kUserDefinedEncoding,
kUnicodeBlockFixedScriptMax,
// blocks which may use different script to render, depend on the order of fonts
kBasicLatin = kUnicodeBlockFixedScriptMax,
kLatin ,
kCJKMisc,
kHiraganaKatakana,
kCJKIdeographs,
kOthers,
kUnicodeBlockSize,
kUnicodeBlockVarScriptMax = kUnicodeBlockSize - kUnicodeBlockFixedScriptMax
} nsUnicodeBlock;
#endif nsUnicodeBlock_h__

Просмотреть файл

@ -587,9 +587,12 @@ static nsUnicodeBlock GetBlockU1XXX(PRUnichar aChar)
case 0x0e00: return kLatin;
case 0x0f00: return kGreek;
default:
{
if ((0x0200 <= aChar) && ( aChar <= 0x037c)) return kEthiopic;
else if ((0x0400 <= aChar) && ( aChar <= 0x0676)) return kCanadian;
else return kOthers;
if ((0x0400 <= aChar) && ( aChar <= 0x0676)) return kCanadian;
if ((0x0780 <= aChar) && ( aChar <= 0x07ff)) return kKhmer;
return kOthers;
}
}
}
//--------------------------------------------------------------------------

Просмотреть файл

@ -207,53 +207,86 @@ ScriptCode nsUnicodeMappingUtil::MapLangGroupToScriptCode(const char* aLangGroup
{
if(0==nsCRT::strcmp(aLangGroup, "x-western")) {
return smRoman;
} else
}
if(0==nsCRT::strcmp(aLangGroup, "x-central-euro")) {
return smCentralEuroRoman;
} else
}
if(0==nsCRT::strcmp(aLangGroup, "x-cyrillic")) {
return smCyrillic;
} else
}
if(0==nsCRT::strcmp(aLangGroup, "el")) {
return smGreek;
} else
}
if(0==nsCRT::strcmp(aLangGroup, "tr")) {
return smRoman;
} else
}
if(0==nsCRT::strcmp(aLangGroup, "he")) {
return smHebrew;
} else
}
if(0==nsCRT::strcmp(aLangGroup, "ar")) {
return smArabic;
} else
}
if(0==nsCRT::strcmp(aLangGroup, "x-baltic")) {
return smRoman;
} else
}
if(0==nsCRT::strcmp(aLangGroup, "th")) {
return smThai;
} else
}
if(0==nsCRT::strcmp(aLangGroup, "ja")) {
return smJapanese;
} else
}
if(0==nsCRT::strcmp(aLangGroup, "zh-CN")) {
return smSimpChinese;
} else
}
if(0==nsCRT::strcmp(aLangGroup, "ko")) {
return smKorean;
} else
}
if(0==nsCRT::strcmp(aLangGroup, "zh-TW")) {
return smTradChinese;
} else
// No separate script code for zh-HK. Use smTradChinese.
}
// No separate script code for zh-HK. Use smTradChinese.
if(0==nsCRT::strcmp(aLangGroup, "zh-HK")) {
return smTradChinese;
} else
}
if(0==nsCRT::strcmp(aLangGroup, "x-devanag")) {
return smDevanagari;
}
if(0==nsCRT::strcmp(aLangGroup, "x-tamil")) {
return smTamil;
}
if(0==nsCRT::strcmp(aLangGroup, "x-beng")) {
return smBengali;;
}
if(0==nsCRT::strcmp(aLangGroup, "x-armn")) {
return smArmenian;
}
if(0==nsCRT::strcmp(aLangGroup, "x-geor")) {
return smGeorgian;;
}
if(0==nsCRT::strcmp(aLangGroup, "x-gujr")) {
return smGujarati;
}
if(0==nsCRT::strcmp(aLangGroup, "x-guru")) {
return smGurmukhi;
}
if(0==nsCRT::strcmp(aLangGroup, "x-mlym")) {
return smMalayalam;
}
if(0==nsCRT::strcmp(aLangGroup, "x-khmr")) {
return smKhmer;
}
if(0==nsCRT::strcmp(aLangGroup, "x-ethi")) {
return smEthiopic;
}
if(0==nsCRT::strcmp(aLangGroup, "x-cans")) {
return (smPseudoUnicode); // XXX : no script code for UCA
}
if(0==nsCRT::strcmp(aLangGroup, "x-unicode")) {
return (smPseudoUnicode);
} else
}
if(0==nsCRT::strcmp(aLangGroup, "x-user-def")) {
return (smPseudoUserDef);
} else
}
{
return smRoman;
}
@ -409,7 +442,8 @@ void nsUnicodeMappingUtil::InitBlockToScriptMapping()
smGurmukhi, smGujarati, smOriya, smTamil,
smTelugu, smKannada, smMalayalam, smThai,
smLao, smTibetan, smGeorgian, smKorean,
smTradChinese,
smTradChinese, smEthiopic, smKhmer,
smPseudoUnicode, // for Unified Canadian Syllable
smPseudoUserDef,
// start the variable section