mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +00:00
Update special arabic support to UCS4
* src/encoding.C (arabic_table): Delete (this was used for fonts in iso8859-6 encoding) (arabic_table2): Rename to arabic_table and update code points to UCS4. The old code points in this table where a custom encoding: Some ASCII positions and some unused positions of the iso8859-6 encoding where used to encode the shaped forms. Example: The character hamza was encoded with 0x41. The iso8859-6 encoding in lib/encodings contained ithe value 0xfe80 at position 0x41 before the transition to unicode => Change the value 0x41 to 0xfe80 in the table. This old custom encoding was needed because the transformed characters needed to be transported through 8bit characters. (Encodings::is_arabic_special): Change code points from iso8859-6 to UCS4 (Encodings::isComposeChar_arabic): Ditto (Encodings::is_arabic): Ditto (Encodings::transformChar): Always use arabic_table git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17532 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c27dce2b16
commit
6862d3f972
209
src/encoding.C
209
src/encoding.C
@ -42,147 +42,65 @@ Encodings encodings;
|
||||
|
||||
namespace {
|
||||
|
||||
char_type arabic_table2[63][4] = {
|
||||
{0x41, 0x41, 0x41, 0x41}, // 0xc1 = hamza
|
||||
{0x42, 0xa1, 0x42, 0xa1}, // 0xc2 = ligature madda on alef
|
||||
{0x43, 0xa2, 0x43, 0xa2}, // 0xc3 = ligature hamza on alef
|
||||
{0x44, 0xa3, 0x44, 0xa3}, // 0xc4 = ligature hamza on waw
|
||||
{0x45, 0xa4, 0x45, 0xa4}, // 0xc5 = ligature hamza under alef
|
||||
{0x46, 0xf9, 0xf8, 0xa0}, // 0xc6 = ligature hamza on ya
|
||||
{0x47, 0xa5, 0x47, 0xa5}, // 0xc7 = alef
|
||||
{0x48, 0xae, 0xac, 0xad}, // 0xc8 = baa
|
||||
{0x49, 0xb1, 0x49, 0xb1}, // 0xc9 = taa marbuta
|
||||
{0x4a, 0xb4, 0xb2, 0xb3}, // 0xca = taa
|
||||
{0x4b, 0xb7, 0xb5, 0xb6}, // 0xcb = thaa
|
||||
{0x4c, 0xba, 0xb8, 0xb9}, // 0xcc = jeem
|
||||
{0x4d, 0xbd, 0xbb, 0xbc}, // 0xcd = haa
|
||||
{0x4e, 0xc0, 0xbe, 0xbf}, // 0xce = khaa
|
||||
{0x4f, 0xa6, 0x4f, 0xa6}, // 0xcf = dal
|
||||
char_type arabic_table[50][4] = {
|
||||
{0xfe80, 0xfe80, 0xfe80, 0xfe80}, // 0x0621 = hamza
|
||||
{0xfe81, 0xfe82, 0xfe81, 0xfe82}, // 0x0622 = ligature madda on alef
|
||||
{0xfe83, 0xfe84, 0xfe83, 0xfe84}, // 0x0623 = ligature hamza on alef
|
||||
{0xfe85, 0xfe86, 0xfe85, 0xfe86}, // 0x0624 = ligature hamza on waw
|
||||
{0xfe87, 0xfe88, 0xfe87, 0xfe88}, // 0x0625 = ligature hamza under alef
|
||||
{0xfe89, 0xfe8a, 0xfe8b, 0xfe8c}, // 0x0626 = ligature hamza on ya
|
||||
{0xfe8d, 0xfe8e, 0xfe8d, 0xfe8e}, // 0x0627 = alef
|
||||
{0xfe8f, 0xfe90, 0xfe91, 0xfe92}, // 0x0628 = baa
|
||||
{0xfe93, 0xfe94, 0xfe93, 0xfe94}, // 0x0629 = taa marbuta
|
||||
{0xfe95, 0xfe96, 0xfe97, 0xfe98}, // 0x062a = taa
|
||||
{0xfe99, 0xfe9a, 0xfe9b, 0xfe9c}, // 0x062b = thaa
|
||||
{0xfe9d, 0xfe9e, 0xfe9f, 0xfea0}, // 0x062c = jeem
|
||||
{0xfea1, 0xfea2, 0xfea3, 0xfea4}, // 0x062d = haa
|
||||
{0xfea5, 0xfea6, 0xfea7, 0xfea8}, // 0x062e = khaa
|
||||
{0xfea9, 0xfeaa, 0xfea9, 0xfeaa}, // 0x062f = dal
|
||||
|
||||
{0x50, 0xa7, 0x50, 0xa7}, // 0xd0 = thal
|
||||
{0x51, 0xa8, 0x51, 0xa8}, // 0xd1 = ra
|
||||
{0x52, 0xa9, 0x52, 0xa9}, // 0xd2 = zain
|
||||
{0x53, 0xc3, 0xc1, 0xc2}, // 0xd3 = seen
|
||||
{0x54, 0xc6, 0xc4, 0xc5}, // 0xd4 = sheen
|
||||
{0x55, 0xc9, 0xc7, 0xc8}, // 0xd5 = sad
|
||||
{0x56, 0xcc, 0xca, 0xcb}, // 0xd6 = dad
|
||||
{0x57, 0xcf, 0xcd, 0xce}, // 0xd7 = tah
|
||||
{0x58, 0xd2, 0xd0, 0xd1}, // 0xd8 = zah
|
||||
{0x59, 0xd5, 0xd3, 0xd4}, // 0xd9 = ain
|
||||
{0x5a, 0xd8, 0xd6, 0xd7}, // 0xda = ghain
|
||||
{0,0,0,0}, // 0xdb
|
||||
{0,0,0,0}, // 0xdc
|
||||
{0,0,0,0}, // 0xdd
|
||||
{0,0,0,0}, // 0xde
|
||||
{0,0,0,0}, // 0xdf
|
||||
{0xfeab, 0xfeac, 0xfeab, 0xfeac}, // 0x0630 = thal
|
||||
{0xfead, 0xfeae, 0xfead, 0xfeae}, // 0x0631 = ra
|
||||
{0xfeaf, 0xfeb0, 0xfeaf, 0xfeb0}, // 0x0632 = zain
|
||||
{0xfeb1, 0xfeb2, 0xfeb3, 0xfeb4}, // 0x0633 = seen
|
||||
{0xfeb5, 0xfeb6, 0xfeb7, 0xfeb8}, // 0x0634 = sheen
|
||||
{0xfeb9, 0xfeba, 0xfebb, 0xfebc}, // 0x0635 = sad
|
||||
{0xfebd, 0xfebe, 0xfebf, 0xfec0}, // 0x0636 = dad
|
||||
{0xfec1, 0xfec2, 0xfec3, 0xfec4}, // 0x0637 = tah
|
||||
{0xfec5, 0xfec6, 0xfec7, 0xfec8}, // 0x0638 = zah
|
||||
{0xfec9, 0xfeca, 0xfecb, 0xfecc}, // 0x0639 = ain
|
||||
{0xfecd, 0xfece, 0xfecf, 0xfed0}, // 0x063a = ghain
|
||||
{0, 0, 0, 0}, // 0x063b
|
||||
{0, 0, 0, 0}, // 0x063c
|
||||
{0, 0, 0, 0}, // 0x063d
|
||||
{0, 0, 0, 0}, // 0x063e
|
||||
{0, 0, 0, 0}, // 0x063f
|
||||
|
||||
{0,0,0,0}, // 0xe0
|
||||
{0x61, 0xdb, 0xd9, 0xda}, // 0xe1 = fa
|
||||
{0x62, 0xde, 0xdc, 0xdd}, // 0xe2 = qaf
|
||||
{0x63, 0xe1, 0xdf, 0xe0}, // 0xe3 = kaf
|
||||
{0x64, 0xe4, 0xe2, 0xe3}, // 0xe4 = lam
|
||||
{0x65, 0xe7, 0xe5, 0xe6}, // 0xe5 = meem
|
||||
{0x66, 0xea, 0xe8, 0xe9}, // 0xe6 = noon
|
||||
{0x67, 0xed, 0xeb, 0xec}, // 0xe7 = ha
|
||||
{0x68, 0xaa, 0x68, 0xaa}, // 0xe8 = waw
|
||||
{0x69, 0xab, 0x69, 0xab}, // 0xe9 = alef maksura
|
||||
{0x6a, 0xf0, 0xee, 0xef}, // 0xea = ya
|
||||
{0x6b, 0x6b, 0x6b, 0x6b}, // 0xeb = fathatan
|
||||
{0x6c, 0x6c, 0x6c, 0x6c}, // 0xec = dammatan
|
||||
{0x6d, 0x6d, 0x6d, 0x6d}, // 0xed = kasratan
|
||||
{0x6e, 0x6e, 0x6e, 0x6e}, // 0xee = fatha
|
||||
{0x6f, 0x6f, 0x6f, 0x6f}, // 0xef = damma
|
||||
{0, 0, 0, 0}, // 0x0640
|
||||
{0xfed1, 0xfed2, 0xfed3, 0xfed4}, // 0x0641 = fa
|
||||
{0xfed5, 0xfed6, 0xfed7, 0xfed8}, // 0x0642 = qaf
|
||||
{0xfed9, 0xfeda, 0xfedb, 0xfedc}, // 0x0643 = kaf
|
||||
{0xfedd, 0xfede, 0xfedf, 0xfee0}, // 0x0644 = lam
|
||||
{0xfee1, 0xfee2, 0xfee3, 0xfee4}, // 0x0645 = meem
|
||||
{0xfee5, 0xfee6, 0xfee7, 0xfee8}, // 0x0646 = noon
|
||||
{0xfee9, 0xfeea, 0xfeeb, 0xfeec}, // 0x0647 = ha
|
||||
{0xfeed, 0xfeee, 0xfeed, 0xfeee}, // 0x0648 = waw
|
||||
{0xfeef, 0xfef0, 0xfeef, 0xfef0}, // 0x0649 = alef maksura
|
||||
{0xfef1, 0xfef2, 0xfef3, 0xfef4}, // 0x064a = ya
|
||||
{0x065b, 0x065b, 0x065b, 0x065b}, // 0x064b = fathatan
|
||||
{0x065c, 0x065c, 0x065c, 0x065c}, // 0x064c = dammatan
|
||||
{0x064d, 0x064d, 0x064d, 0x064d}, // 0x064d = kasratan
|
||||
{0x064e, 0x064e, 0x064e, 0x064e}, // 0x064e = fatha
|
||||
{0x064f, 0x064f, 0x064f, 0x064f}, // 0x064f = damma
|
||||
|
||||
{0x70, 0x70, 0x70, 0x70}, // 0xf0 = kasra
|
||||
{0x71, 0x71, 0x71, 0x71}, // 0xf1 = shadda
|
||||
{0x72, 0x72, 0x72, 0x72}, // 0xf2 = sukun
|
||||
{0,0,0,0}, // 0xf3
|
||||
{0,0,0,0}, // 0xf4
|
||||
{0,0,0,0}, // 0xf5
|
||||
{0,0,0,0}, // 0xf6
|
||||
{0,0,0,0}, // 0xf7
|
||||
{0,0,0,0}, // 0xf8
|
||||
{0,0,0,0}, // 0xf9
|
||||
{0,0,0,0}, // 0xfa
|
||||
{0,0,0,0}, // 0xfb
|
||||
{0,0,0,0}, // 0xfc
|
||||
{0,0,0,0}, // 0xfd
|
||||
{0,0,0,0}, // 0xfe
|
||||
{0,0,0,0}, // 0xff
|
||||
{0x0650, 0x0650, 0x0650, 0x0650}, // 0x0650 = kasra
|
||||
{0x0651, 0x0651, 0x0651, 0x0651}, // 0x0651 = shadda
|
||||
{0x0652, 0x0652, 0x0652, 0x0652}, // 0x0652 = sukun
|
||||
};
|
||||
|
||||
|
||||
char_type arabic_table[63][2] = {
|
||||
{0xc1, 0xc1}, // 0xc1 = hamza
|
||||
{0xc2, 0xc2}, // 0xc2 = ligature madda on alef
|
||||
{0xc3, 0xc3}, // 0xc3 = ligature hamza on alef
|
||||
{0xc4, 0xc4}, // 0xc4 = ligature hamza on waw
|
||||
{0xc5, 0xc5}, // 0xc5 = ligature hamza under alef
|
||||
{0xc6, 0xc0}, // 0xc6 = ligature hamza on ya
|
||||
{0xc7, 0xc7}, // 0xc7 = alef
|
||||
{0xc8, 0xeb}, // 0xc8 = baa
|
||||
{0xc9, 0xc9}, // 0xc9 = taa marbuta
|
||||
{0xca, 0xec}, // 0xca = taa
|
||||
{0xcb, 0xed}, // 0xcb = thaa
|
||||
{0xcc, 0xee}, // 0xcc = jeem
|
||||
{0xcd, 0xef}, // 0xcd = haa
|
||||
{0xce, 0xf0}, // 0xce = khaa
|
||||
{0xcf, 0xcf}, // 0xcf = dal
|
||||
|
||||
{0xd0, 0xd0}, // 0xd0 = thal
|
||||
{0xd1, 0xd1}, // 0xd1 = ra
|
||||
{0xd2, 0xd2}, // 0xd2 = zain
|
||||
{0xd3, 0xf1}, // 0xd3 = seen
|
||||
{0xd4, 0xf2}, // 0xd4 = sheen
|
||||
{0xd5, 0xf3}, // 0xd5 = sad
|
||||
{0xd6, 0xf4}, // 0xd6 = dad
|
||||
{0xd7, 0xd7}, // 0xd7 = tah
|
||||
{0xd8, 0xd8}, // 0xd8 = zah
|
||||
{0xd9, 0xf5}, // 0xd9 = ain
|
||||
{0xda, 0xf6}, // 0xda = ghain
|
||||
{0,0}, // 0xdb
|
||||
{0,0}, // 0xdc
|
||||
{0,0}, // 0xdd
|
||||
{0,0}, // 0xde
|
||||
{0,0}, // 0xdf
|
||||
|
||||
{0,0}, // 0xe0
|
||||
{0xe1, 0xf7}, // 0xe1 = fa
|
||||
{0xe2, 0xf8}, // 0xe2 = qaf
|
||||
{0xe3, 0xf9}, // 0xe3 = kaf
|
||||
{0xe4, 0xfa}, // 0xe4 = lam
|
||||
{0xe5, 0xfb}, // 0xe5 = meem
|
||||
{0xe6, 0xfc}, // 0xe6 = noon
|
||||
{0xe7, 0xfd}, // 0xe7 = ha
|
||||
{0xe8, 0xe8}, // 0xe8 = waw
|
||||
{0xe9, 0xe9}, // 0xe9 = alef maksura
|
||||
{0xea, 0xfe}, // 0xea = ya
|
||||
{0xa8, 0xa8}, // 0xeb = fathatan
|
||||
{0xa9, 0xa9}, // 0xec = dammatan
|
||||
{0xaa, 0xaa}, // 0xed = kasratan
|
||||
{0xab, 0xab}, // 0xee = fatha
|
||||
{0xac, 0xac}, // 0xef = damma
|
||||
|
||||
{0xad, 0xad}, // 0xf0 = kasra
|
||||
{0xae, 0xae}, // 0xf1 = shadda
|
||||
{0xaf, 0xaf}, // 0xf2 = sukun
|
||||
{0,0}, // 0xf3
|
||||
{0,0}, // 0xf4
|
||||
{0,0}, // 0xf5
|
||||
{0,0}, // 0xf6
|
||||
{0,0}, // 0xf7
|
||||
{0,0}, // 0xf8
|
||||
{0,0}, // 0xf9
|
||||
{0,0}, // 0xfa
|
||||
{0,0}, // 0xfb
|
||||
{0,0}, // 0xfc
|
||||
{0,0}, // 0xfd
|
||||
{0,0}, // 0xfe
|
||||
{0,0} // 0xff
|
||||
};
|
||||
|
||||
|
||||
char_type const arabic_start = 0xc1;
|
||||
char_type const arabic_start = 0x0621;
|
||||
char_type const arabic_end = 0x0652;
|
||||
|
||||
|
||||
/// Information about a single UCS4 character
|
||||
@ -288,22 +206,24 @@ bool Encodings::isComposeChar_hebrew(char_type c)
|
||||
|
||||
bool Encodings::is_arabic_special(char_type c)
|
||||
{
|
||||
return (c >= 0xc1 && c <= 0xc5) ||
|
||||
c == 0xc7 || c == 0xc9 ||
|
||||
c == 0xcf || c == 0xe8 ||
|
||||
(c >= 0xd0 && c <= 0xd2) ||
|
||||
c == 0xe9;
|
||||
return (c >= 0x0621 && c <= 0x0625) ||
|
||||
c == 0x0627 || c == 0x0629 ||
|
||||
c == 0x062f || c == 0x0648 ||
|
||||
(c >= 0x0630 && c <= 0x0632) ||
|
||||
c == 0x0649;
|
||||
}
|
||||
|
||||
|
||||
bool Encodings::isComposeChar_arabic(char_type c)
|
||||
{
|
||||
return c >= 0xeb && c <= 0xf2;
|
||||
return c >= 0x064b && c <= 0x0652;
|
||||
}
|
||||
|
||||
|
||||
bool Encodings::is_arabic(char_type c)
|
||||
{
|
||||
return c >= arabic_start && arabic_table[c-arabic_start][0];
|
||||
return c >= arabic_start && c <= arabic_end &&
|
||||
arabic_table[c-arabic_start][0];
|
||||
}
|
||||
|
||||
|
||||
@ -313,10 +233,7 @@ char_type Encodings::transformChar(char_type c,
|
||||
if (!is_arabic(c))
|
||||
return c;
|
||||
|
||||
if (lyxrc.font_norm_type == LyXRC::ISO_10646_1)
|
||||
return arabic_table2[c-arabic_start][form];
|
||||
else
|
||||
return arabic_table[c-arabic_start][form >> 1];
|
||||
return arabic_table[c-arabic_start][form];
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user