summaryrefslogtreecommitdiff
path: root/modules/arabic
diff options
context:
space:
mode:
Diffstat (limited to 'modules/arabic')
-rw-r--r--modules/arabic/arabic-x.c40
-rw-r--r--modules/arabic/arabic.c40
-rw-r--r--modules/arabic/arconv.c36
-rw-r--r--modules/arabic/langboxfont.c19
-rw-r--r--modules/arabic/mulefont.c10
5 files changed, 74 insertions, 71 deletions
diff --git a/modules/arabic/arabic-x.c b/modules/arabic/arabic-x.c
index 098799ce..ec598b17 100644
--- a/modules/arabic/arabic-x.c
+++ b/modules/arabic/arabic-x.c
@@ -17,7 +17,7 @@
#include "mulefont.h"
#include "langboxfont.h"
-/* #define DEBUG */
+/* #define DEBUG */
#ifdef DEBUG
#include <stdio.h>
#endif
@@ -161,9 +161,10 @@ find_unic_font (PangoFont *font,char* charsets[],PangoXSubfont* rfonts)
}
static char *default_charset[] = {
- "iso10646-1",
- "iso8859-6.8x",
- "mulearabic-2"
+ "iso10646-1",
+ "iso8859-6.8x",
+ /* "iso8859-6.8x" */
+ "mulearabic-2"
};
@@ -171,7 +172,7 @@ static char *default_charset[] = {
static void
set_glyph (PangoGlyphString *glyphs,
PangoFont *font, PangoXSubfont subfont,
- int i, int cluster_start, int glyph)
+ int i, int cluster_start, int glyph, int is_vowel)
{
PangoRectangle logical_rect;
#ifdef DEBUG
@@ -193,7 +194,7 @@ set_glyph (PangoGlyphString *glyphs,
pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect);
glyphs->log_clusters[i] = cluster_start;
- if (arabic_isvowel(glyph))
+ if (is_vowel)
{
glyphs->glyphs[i].geometry.width = 0;
}
@@ -248,7 +249,7 @@ arabic_engine_shape (PangoFont *font,
{
set_glyph (glyphs, font,
PANGO_X_GLYPH_SUBFONT (unknown_glyph), i,
- p - text, PANGO_X_GLYPH_INDEX (unknown_glyph));
+ p - text, PANGO_X_GLYPH_INDEX (unknown_glyph),0);
p = unicode_next_utf8 (p);
}
return;
@@ -282,6 +283,9 @@ arabic_engine_shape (PangoFont *font,
p = text;
pold = p;
i = n_chars-1;
+#ifdef DEBUG
+ fprintf(stderr,"[ar]: after shaping : %i glyphs ",n_glyph);
+#endif
while(i >= 0)
{
if (wc[i] == 0)
@@ -290,9 +294,11 @@ arabic_engine_shape (PangoFont *font,
i--;
}
else
- {
- int cluster_start = arabic_isvowel (wc[i])
- ? pold - text : p - text;
+ {
+ int cluster_start ;
+ int is_vowel = arabic_isvowel(wc[i]);
+ cluster_start = is_vowel ? pold - text : p - text;
+
if ( lvl == 1 )
{
#ifdef DEBUG
@@ -303,22 +309,10 @@ arabic_engine_shape (PangoFont *font,
}
else if ( lvl == 2 )
{
-#ifdef DEBUG
- fprintf(stderr,"[ar] lbox-recoding char %x",
- wc[i]);
-#endif
if (( i > 0 )&&(wc[i-1] == 0))
{
arabic_lbox_recode(&subfont,&(wc[i]),
&(wc[i-1]), arfonts);
-#ifdef DEBUG
- if (wc[i-1] != 0)
- {
- fprintf(stderr,"[ar] lbox-recoded"
- " special char %x",
- wc[i-1]);
- }
-#endif
}
else
arabic_lbox_recode(&subfont,&(wc[i]),NULL,
@@ -326,7 +320,7 @@ arabic_engine_shape (PangoFont *font,
}
set_glyph(glyphs, font, subfont, n_glyph - 1,
- cluster_start, wc[i]);
+ cluster_start, wc[i], is_vowel);
pold = p;
p = unicode_next_utf8 (p);
diff --git a/modules/arabic/arabic.c b/modules/arabic/arabic.c
index 098799ce..ec598b17 100644
--- a/modules/arabic/arabic.c
+++ b/modules/arabic/arabic.c
@@ -17,7 +17,7 @@
#include "mulefont.h"
#include "langboxfont.h"
-/* #define DEBUG */
+/* #define DEBUG */
#ifdef DEBUG
#include <stdio.h>
#endif
@@ -161,9 +161,10 @@ find_unic_font (PangoFont *font,char* charsets[],PangoXSubfont* rfonts)
}
static char *default_charset[] = {
- "iso10646-1",
- "iso8859-6.8x",
- "mulearabic-2"
+ "iso10646-1",
+ "iso8859-6.8x",
+ /* "iso8859-6.8x" */
+ "mulearabic-2"
};
@@ -171,7 +172,7 @@ static char *default_charset[] = {
static void
set_glyph (PangoGlyphString *glyphs,
PangoFont *font, PangoXSubfont subfont,
- int i, int cluster_start, int glyph)
+ int i, int cluster_start, int glyph, int is_vowel)
{
PangoRectangle logical_rect;
#ifdef DEBUG
@@ -193,7 +194,7 @@ set_glyph (PangoGlyphString *glyphs,
pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect);
glyphs->log_clusters[i] = cluster_start;
- if (arabic_isvowel(glyph))
+ if (is_vowel)
{
glyphs->glyphs[i].geometry.width = 0;
}
@@ -248,7 +249,7 @@ arabic_engine_shape (PangoFont *font,
{
set_glyph (glyphs, font,
PANGO_X_GLYPH_SUBFONT (unknown_glyph), i,
- p - text, PANGO_X_GLYPH_INDEX (unknown_glyph));
+ p - text, PANGO_X_GLYPH_INDEX (unknown_glyph),0);
p = unicode_next_utf8 (p);
}
return;
@@ -282,6 +283,9 @@ arabic_engine_shape (PangoFont *font,
p = text;
pold = p;
i = n_chars-1;
+#ifdef DEBUG
+ fprintf(stderr,"[ar]: after shaping : %i glyphs ",n_glyph);
+#endif
while(i >= 0)
{
if (wc[i] == 0)
@@ -290,9 +294,11 @@ arabic_engine_shape (PangoFont *font,
i--;
}
else
- {
- int cluster_start = arabic_isvowel (wc[i])
- ? pold - text : p - text;
+ {
+ int cluster_start ;
+ int is_vowel = arabic_isvowel(wc[i]);
+ cluster_start = is_vowel ? pold - text : p - text;
+
if ( lvl == 1 )
{
#ifdef DEBUG
@@ -303,22 +309,10 @@ arabic_engine_shape (PangoFont *font,
}
else if ( lvl == 2 )
{
-#ifdef DEBUG
- fprintf(stderr,"[ar] lbox-recoding char %x",
- wc[i]);
-#endif
if (( i > 0 )&&(wc[i-1] == 0))
{
arabic_lbox_recode(&subfont,&(wc[i]),
&(wc[i-1]), arfonts);
-#ifdef DEBUG
- if (wc[i-1] != 0)
- {
- fprintf(stderr,"[ar] lbox-recoded"
- " special char %x",
- wc[i-1]);
- }
-#endif
}
else
arabic_lbox_recode(&subfont,&(wc[i]),NULL,
@@ -326,7 +320,7 @@ arabic_engine_shape (PangoFont *font,
}
set_glyph(glyphs, font, subfont, n_glyph - 1,
- cluster_start, wc[i]);
+ cluster_start, wc[i], is_vowel);
pold = p;
p = unicode_next_utf8 (p);
diff --git a/modules/arabic/arconv.c b/modules/arabic/arconv.c
index 668378fc..94da5a4c 100644
--- a/modules/arabic/arconv.c
+++ b/modules/arabic/arconv.c
@@ -67,7 +67,7 @@ static shapestruct chartable [] =
{0x63D, 0x0000,0}, /* simple */
{0x63E, 0x0000,0}, /* indexing */
{0x63F, 0x0000,0}, /* : */
- {0x640, 0x0640,1}, /* */
+ {0x640, 0x0640,4}, /* tatweel */
{0x641, 0xFED1,4}, /* FA */
{0x642, 0xFED5,4}, /* QAF */
{0x643, 0xFED9,4}, /* KAF */
@@ -89,24 +89,24 @@ static shapestruct chartable [] =
{0x686, 0xFB7A,4}, /* Persian: Tcheh */
{0x687, 0xFB7E,4}, /* Sindhi: */
{0x68C, 0xFB84,2}, /* Sindhi: DAHAL */
- {0x68D, 0xFB82,2}, /* Sindhi */
+ {0x68D, 0xFB82,2}, /* Sindhi */
{0x68E, 0xFB86,2}, /* */
- {0x691, 0xFB8C,2}, /* Urdu */
+ {0x691, 0xFB8C,2}, /* Urdu */
{0x698, 0xFB8A,2}, /* Persian: JEH */
- {0x6A4, 0xFB6A,4}, /* VEH: latin compatibility */
- {0x6A6, 0xFB6E,4}, /* Sindhi */
+ {0x6A4, 0xFB6A,4}, /* VEH: latin compatibility */
+ {0x6A6, 0xFB6E,4}, /* Sindhi */
{0x6A9, 0xFB8E,4}, /* Persan K */
- {0x6AA, 0xFB8E,4}, /* extrawide KAF-> Persian KAF */
- {0x6AF, 0xFB92,4}, /* Persian: GAF */
+ {0x6AA, 0xFB8E,4}, /* extrawide KAF-> Persian KAF */
+ {0x6AF, 0xFB92,4}, /* Persian: GAF */
{0x6B1, 0xFB9A,4}, /* Sindhi: */
{0x6B3, 0xFB97,4}, /* */
{0x6BA, 0xFB9E,2}, /* Urdu:NUN GHUNNA */
- {0x6BB, 0xFBA0,4}, /* Sindhi: */
+ {0x6BB, 0xFBA0,4}, /* Sindhi: */
{0x6BE, 0xFBAA,4}, /* HA special */
- {0x6C0, 0xFBA4,2}, /* izafet: HA HAMZA */
+ {0x6C0, 0xFBA4,2}, /* izafet: HA HAMZA */
{0x6C1, 0xFBA6,4}, /* Urdu: */
{0x6D2, 0xFBAE,2}, /* YA barree */
- {0x6D3, 0xFBB0,2}, /* YA BARREE HAMZA */
+ {0x6D3, 0xFBB0,2}, /* YA BARREE HAMZA */
{0xFEF5, 0xFEF5,2}, /* Lam-Alif Madda */
{0xFEF7, 0xFEF7,2}, /* Lam-Alif Hamza */
@@ -119,8 +119,9 @@ static shapestruct chartable [] =
#define ALIFMADDA 0x622
#define LAM 0x644
#define HAMZA 0x621
+#define TATWEEL 0x640
-/* Hmaza below ( saves Kasra and special cases ), Hamza above ( always joins ).
+/* Hamza below ( saves Kasra and special cases ), Hamza above ( always joins ).
* As I don't know what sHAMZA is good for I don't handle it.
*/
#define iHAMZA 0x654
@@ -221,11 +222,12 @@ static GUChar4
charshape(GUChar4 s,short which)
{ /* which 0=alone 1=end 2=start 3=middle */
int j = 0;
- if ((s >= chartable[1].basechar) && (s <= 0x64A))
+ if ((s >= chartable[1].basechar) && (s <= 0x64A) && ( s != TATWEEL))
{ /* basic character */
return chartable[s-chartable[0].basechar].charstart+which;
}
- else if ( (s >= chartable[1].basechar) && ( s <= 0xFEFB ))
+ else if ( (s >= chartable[1].basechar) && ( s <= 0xFEFB )
+ && (s != TATWEEL))
{ /* special char or Lam-Alif */
while ( chartable[j].basechar < s) j++;
return chartable[j].charstart+which;
@@ -274,6 +276,9 @@ ligature(GUChar4* string,int si,int len,charstruct* oldchar)
if (arabic_isvowel(newchar))
{
retval = 1;
+ if ((oldchar->vowel != 0)&&(newchar != SHADDA)){
+ retval = 2; /* we eliminate the old vowel .. */
+ }
switch(newchar)
{
case SHADDA: oldchar->mark1 = newchar; break;
@@ -436,8 +441,11 @@ shape(int olen,int* len,GUChar4* string,int level)
curchar.lignum++;
}
else if ( ( join == 2 )
- ||((join == 3)&&(level != 2)) )
+ ||((join == 3)&&(level != 2))
+ ||((join == 1)&&(level == 1)
+ && arabic_isvowel(string[si])) )
{ /* Lam-Alif in Langbox-font is no ligature */
+ /* No vowels in Langbox-font */
(*len)--;
}
si--;
diff --git a/modules/arabic/langboxfont.c b/modules/arabic/langboxfont.c
index cdfac60c..3073b539 100644
--- a/modules/arabic/langboxfont.c
+++ b/modules/arabic/langboxfont.c
@@ -153,7 +153,7 @@ static fontentry charmap [] =
{ 0xFEDD,0xE4 }, /* LAM */
{ 0xFEDE,0xE4 },
{ 0xFEDF,0xFA },
- { 0xFEE0,0xA6 },
+ { 0xFEE0,0xFA },
{ 0xFEE1,0xE5 }, /* MIM */
{ 0xFEE2,0xE5 },
{ 0xFEE3,0xFB },
@@ -181,9 +181,10 @@ arabic_lbox_recode(PangoXSubfont* subfont,int* glyph,int* glyph2,
PangoXSubfont* lboxfonts)
{
int letter=*glyph;
+
+ *subfont = lboxfonts[0];
if ((letter >= 0x660)&&(letter <= 0x669)) /* indic numeral */
{
- *subfont = lboxfonts[0];
*glyph = letter - 0x660 + 0xB0;
}
else if ((letter >= 0xFE80)&&(letter <= 0xFEF4))
@@ -196,17 +197,14 @@ arabic_lbox_recode(PangoXSubfont* subfont,int* glyph,int* glyph2,
letter,charmap[letter-0xFE80].unicodechar);
}
#endif
- *subfont = lboxfonts[0];
*glyph = charmap[letter-0xFE80].charindex;
}
else if ((letter >= 0x64B)&&(letter <= 0x652))
{ /* a vowel */
- *subfont = lboxfonts[0];
*glyph = letter - 0x64B + 0xA8;
}
else if ((letter >= 0xFEF5)&&(letter <= 0xFEFC))
{ /* Lam-Alif. Langbox solved the problem in their own way ... */
- *subfont = lboxfonts[0];
#ifdef DEBUG
fprintf(stderr,"[ar] lbox-recoding chars %x",
letter);
@@ -233,17 +231,22 @@ arabic_lbox_recode(PangoXSubfont* subfont,int* glyph,int* glyph2,
}
else if (letter == 0x621)
{
- *subfont = lboxfonts[0];
*glyph = charmap[0].charindex;
}
+ else if (letter == 0x640)
+ { /* tatweel */
+ *glyph = 0xE0;
+ }
+ else if (letter == 0x61F)
+ { /* question mark */
+ *glyph = 0xBF;
+ }
else if (letter < 0xB0 )
{
- *subfont = lboxfonts[0];
*glyph = letter;
}
else
{
- *subfont = lboxfonts[0];
*glyph = 0x20; /* we don't have this thing -- use a space */
/* This has to be something that does not print anything !! */
}
diff --git a/modules/arabic/mulefont.c b/modules/arabic/mulefont.c
index edb440a8..e087ce0d 100644
--- a/modules/arabic/mulefont.c
+++ b/modules/arabic/mulefont.c
@@ -247,11 +247,15 @@ arabic_mule_recode(PangoXSubfont* subfont,int* glyph,PangoXSubfont* mulefonts)
*subfont = mulefonts[charmap[0].fontindex];
*glyph = charmap[0].charindex;
}
+ else if (letter == 0x61F)
+ { /* question mark */
+ *subfont = mulefonts[1];
+ *glyph = 0x29;
+ }
else
{
- *subfont = mulefonts[charmap[1].fontindex];
- *glyph = 0x20; /* we don't have this thing -- use a space */
- /* This has to be something that does not print anything !! */
+ *subfont = mulefonts[1];
+ *glyph = 0x26; /* we don't have this thing -- use a dot */
}
}