1
/* FriBidi - Library of BiDi algorithm
2
* Copyright (C) 1999,2000 Dov Grobgeld, and
3
* Copyright (C) 2001,2002 Behdad Esfahbod.
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public License
16
* along with this library, in a file named COPYING; if not, write to the
17
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18
* Boston, MA 02111-1307, USA
20
* For licensing issues, contact <dov@imagic.weizmann.ac.il> and
24
#include "fribidi_config.h"
25
#ifndef FRIBIDI_NO_CHARSETS
30
#define ISO_HAMZA 0xc1
31
#define ISO_SUKUN 0xf2
33
#define UNI_HAMZA 0x0621
34
#define UNI_SUKUN 0x0652
37
fribidi_iso8859_6_to_unicode_c (char sch)
39
unsigned char ch = (unsigned char) sch;
40
if (ch >= ISO_HAMZA && ch <= ISO_SUKUN)
41
return ch - ISO_HAMZA + UNI_HAMZA;
47
fribidi_iso8859_6_to_unicode (char *s, int len, FriBidiChar *us)
51
for (i = 0; i < len + 1; i++)
52
us[i] = fribidi_iso8859_6_to_unicode_c (s[i]);
58
fribidi_unicode_to_iso8859_6_c (FriBidiChar uch)
60
if (uch >= UNI_HAMZA && uch <= UNI_SUKUN)
61
return (char) (uch - UNI_HAMZA + ISO_HAMZA);
62
/* TODO: handle pre-composed and presentation chars */
65
else if (uch == 0x060c)
67
else if (uch == 0x061b)
69
else if (uch == 0x061f)
76
fribidi_unicode_to_iso8859_6 (FriBidiChar *us, int length, char *s)
80
for (i = 0; i < length; i++)
81
s[i] = fribidi_unicode_to_iso8859_6_c (us[i]);