summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbehdad <behdad>2008-04-22 19:50:46 +0000
committerbehdad <behdad>2008-04-22 19:50:46 +0000
commitd60a4546004df012871348b00be28f57baca28a8 (patch)
treec59eac6a682ea0d5b0b64ab66a27bd70b44c5c4b
parent4b8dde2be6c0ed0a28ba54e0fe204f821dd5a88f (diff)
downloadfribidi-d60a4546004df012871348b00be28f57baca28a8.tar.gz
Handle RLM/LRM in CP1255 charset converter. (#15328, Artyom)
-rw-r--r--charset/fribidi-char-sets-cp1255.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/charset/fribidi-char-sets-cp1255.c b/charset/fribidi-char-sets-cp1255.c
index 3dc19c9..8d339ed 100644
--- a/charset/fribidi-char-sets-cp1255.c
+++ b/charset/fribidi-char-sets-cp1255.c
@@ -1,10 +1,10 @@
/* FriBidi
* fribidi-char-sets-cp1255.c - CP1255 character set conversion routines
*
- * $Id: fribidi-char-sets-cp1255.c,v 1.2 2004-05-03 22:05:19 behdad Exp $
+ * $Id: fribidi-char-sets-cp1255.c,v 1.3 2008-04-22 19:50:46 behdad Exp $
* $Author: behdad $
- * $Date: 2004-05-03 22:05:19 $
- * $Revision: 1.2 $
+ * $Date: 2008-04-22 19:50:46 $
+ * $Revision: 1.3 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-cp1255.c,v $
*
* Authors:
@@ -43,6 +43,8 @@
#define CP1255_SOF_PASUQ 0xD3
#define CP1255_DOUBLE_VAV 0xD4
#define CP1255_GERSHAYIM 0xD8
+#define CP1255_LRM 0xFD
+#define CP1255_RLM 0xFE
#define UNI_ALEF 0x05D0
#define UNI_TAV 0x05EA
@@ -50,6 +52,8 @@
#define UNI_SOF_PASUQ 0x05C3
#define UNI_DOUBLE_VAV 0x05F0
#define UNI_GERSHAYIM 0x05F4
+#define UNI_LRM 0x200E
+#define UNI_RLM 0x200F
static FriBidiChar fribidi_cp1255_to_unicode_tab[] = { /* 0x80-0xBF */
0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
@@ -78,7 +82,10 @@ fribidi_cp1255_to_unicode_c (
/* cp1256 specific chars */
else if (ch >= 0x80 && ch <= 0xbf)
return fribidi_cp1255_to_unicode_tab[ch - 0x80];
- else
+ else if (ch == CP1255_LRM || ch == CP1255_RLM)
+ return ch - CP1255_LRM + UNI_LRM;
+ /* treat LRM/LRM charrectes correctly */
+ else
return ch;
}
@@ -95,6 +102,9 @@ fribidi_unicode_to_cp1255_c (
if (uch >= UNI_DOUBLE_VAV && uch <= UNI_GERSHAYIM)
return (char) (uch - UNI_DOUBLE_VAV + CP1255_DOUBLE_VAV);
/* TODO: handle pre-composed and presentation chars */
+ if (uch == UNI_LRM || uch==UNI_RLM)
+ return (char) (uch - UNI_LRM + CP1255_LRM);
+ /* Treat LRM/RLM charrecters correctly */
else if (uch < 256)
return (char) uch;
else