Bug 397597. Enable native platform linebreaking for Tibetan and Lao. r=masayuki,a=dbaron

This commit is contained in:
roc+@cs.cmu.edu 2007-09-30 13:30:31 -07:00
parent 62764c09a6
commit d38e95b231
3 changed files with 11 additions and 9 deletions

View File

@ -94,7 +94,7 @@ public:
static inline PRBool IsComplexChar(PRUnichar u)
{
return IsComplexASCIIChar(u) ||
(0x0e01 <= u && u <= 0x0edf) || // Thai & Lao
NS_NeedsPlatformNativeHandling(u) ||
(0x1100 <= u && u <= 0x11ff) || // Hangul Jamo
(0x2000 <= u && u <= 0x21ff) || // Punctuations and Symbols
(0x2e80 <= u && u <= 0xd7ff) || // several CJK blocks

View File

@ -86,4 +86,10 @@ NS_IsSpace(PRUnichar u)
u == 0x3000; // IDEOGRAPHIC SPACE
}
static inline PRBool
NS_NeedsPlatformNativeHandling(PRUnichar aChar)
{
return (0x0e01 <= aChar && aChar <= 0x0fff); // Thai, Lao, Tibetan
}
#endif /* nsILineBreaker_h__ */

View File

@ -415,12 +415,6 @@ IS_CJK_CHAR(PRUnichar u)
(0xff00 <= (u) && (u) <= 0xffef) );
}
static inline int
IS_COMPLEX(PRUnichar u)
{
return (0x0e01 <= (u) && (u) <= 0x0e5b);
}
static inline PRBool
IS_NONBREAKABLE_SPACE(PRUnichar u)
{
@ -447,6 +441,8 @@ GetClass(PRUnichar u)
// Handle 3 range table first
if (0x0000 == h) {
c = GETCLASSFROMTABLE(gLBClass00, l);
} else if (NS_NeedsPlatformNativeHandling(u)) {
c = CLASS_COMPLEX;
} else if (0x0E00 == h) {
c = GETCLASSFROMTABLE(gLBClass0E, l);
} else if (0x2000 == h) {
@ -738,12 +734,12 @@ nsJISx4051LineBreaker::WordMove(const PRUnichar* aText, PRUint32 aLen,
PRInt32 begin, end;
for (begin = aPos; begin > 0 && !NS_IsSpace(aText[begin - 1]); --begin) {
if (IS_CJK_CHAR(aText[begin]) || IS_COMPLEX(aText[begin])) {
if (IS_CJK_CHAR(aText[begin]) || NS_NeedsPlatformNativeHandling(aText[begin])) {
textNeedsJISx4051 = PR_TRUE;
}
}
for (end = aPos + 1; end < PRInt32(aLen) && !NS_IsSpace(aText[end]); ++end) {
if (IS_CJK_CHAR(aText[end]) || IS_COMPLEX(aText[end])) {
if (IS_CJK_CHAR(aText[end]) || NS_NeedsPlatformNativeHandling(aText[end])) {
textNeedsJISx4051 = PR_TRUE;
}
}