summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-06-29 20:36:45 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-06-29 20:36:45 +0000
commit4e005cf17476ee08c73e7a1a2fb1133d9008be15 (patch)
treea516e407fb12f0c397d4acbd25191d93785dd1a3
parent0e6409a158d9dd76a31b9eccf7c4f26c5466d082 (diff)
downloadpango-4e005cf17476ee08c73e7a1a2fb1133d9008be15.tar.gz
New version from Karl Koehler merged with the changes for the GLib unicode
Thu Jun 29 16:35:41 2000 Owen Taylor <otaylor@redhat.com> * modules/arabic/{*.c,Makefile.am}: New version from Karl Koehler merged with the changes for the GLib unicode functions.
-rw-r--r--ChangeLog19
-rw-r--r--ChangeLog.pre-1-019
-rw-r--r--ChangeLog.pre-1-1019
-rw-r--r--ChangeLog.pre-1-219
-rw-r--r--ChangeLog.pre-1-419
-rw-r--r--ChangeLog.pre-1-619
-rw-r--r--ChangeLog.pre-1-819
-rw-r--r--modules/arabic/Makefile.am2
-rw-r--r--modules/arabic/arabic-x.c91
-rw-r--r--modules/arabic/arabic.c91
-rw-r--r--modules/arabic/arconv.c193
-rw-r--r--modules/arabic/arconv.h15
-rw-r--r--modules/arabic/langboxfont.c29
-rw-r--r--modules/arabic/mulefont.c31
14 files changed, 391 insertions, 194 deletions
diff --git a/ChangeLog b/ChangeLog
index a8e1c5ea..7176ff87 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jun 29 16:35:41 2000 Owen Taylor <otaylor@redhat.com>
+
+ * modules/arabic/{*.c,Makefile.am}: New version from Karl
+ Koehler merged with the changes for the GLib unicode functions.
+
Wed Jun 21 12:11:56 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Remove tests for libunicode
@@ -21,17 +26,21 @@ Wed Jun 21 12:11:56 2000 Owen Taylor <otaylor@redhat.com>
2000-06-11 Elliot Lee <sopwith@redhat.com>
- * pango/fonts.c (pango_font_description_compare): g_strcasecmp returns 0 when strings are equal - negate return value.
+ * pango/fonts.c (pango_font_description_compare): g_strcasecmp
+ returns 0 when strings are equal - negate return value.
2000-06-09 Elliot Lee <sopwith@redhat.com>
- * pango/pango-coverage.[ch]: Return 'coverage' from pango_coverage_ref.
+ * pango/pango-coverage.[ch]: Return 'coverage' from
+ pango_coverage_ref.
2000-06-08 Elliot Lee <sopwith@redhat.com>
- * modules/Makefile.am: Add DOTMODULESDIR define to make it easier to change location of .modules files.
- * pango/modules.c: Likewise. Also scan the config directory for multiple config files instead of pango.modules.
- Also fclose() opened files.
+ * modules/Makefile.am: Add DOTMODULESDIR define to make it easier
+ to change location of .modules files.
+ * pango/modules.c: Likewise. Also scan the config directory for
+ multiple config files instead of pango.modules. Also fclose()
+ opened files.
Thu Jun 8 14:43:35 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0
index a8e1c5ea..7176ff87 100644
--- a/ChangeLog.pre-1-0
+++ b/ChangeLog.pre-1-0
@@ -1,3 +1,8 @@
+Thu Jun 29 16:35:41 2000 Owen Taylor <otaylor@redhat.com>
+
+ * modules/arabic/{*.c,Makefile.am}: New version from Karl
+ Koehler merged with the changes for the GLib unicode functions.
+
Wed Jun 21 12:11:56 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Remove tests for libunicode
@@ -21,17 +26,21 @@ Wed Jun 21 12:11:56 2000 Owen Taylor <otaylor@redhat.com>
2000-06-11 Elliot Lee <sopwith@redhat.com>
- * pango/fonts.c (pango_font_description_compare): g_strcasecmp returns 0 when strings are equal - negate return value.
+ * pango/fonts.c (pango_font_description_compare): g_strcasecmp
+ returns 0 when strings are equal - negate return value.
2000-06-09 Elliot Lee <sopwith@redhat.com>
- * pango/pango-coverage.[ch]: Return 'coverage' from pango_coverage_ref.
+ * pango/pango-coverage.[ch]: Return 'coverage' from
+ pango_coverage_ref.
2000-06-08 Elliot Lee <sopwith@redhat.com>
- * modules/Makefile.am: Add DOTMODULESDIR define to make it easier to change location of .modules files.
- * pango/modules.c: Likewise. Also scan the config directory for multiple config files instead of pango.modules.
- Also fclose() opened files.
+ * modules/Makefile.am: Add DOTMODULESDIR define to make it easier
+ to change location of .modules files.
+ * pango/modules.c: Likewise. Also scan the config directory for
+ multiple config files instead of pango.modules. Also fclose()
+ opened files.
Thu Jun 8 14:43:35 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index a8e1c5ea..7176ff87 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,8 @@
+Thu Jun 29 16:35:41 2000 Owen Taylor <otaylor@redhat.com>
+
+ * modules/arabic/{*.c,Makefile.am}: New version from Karl
+ Koehler merged with the changes for the GLib unicode functions.
+
Wed Jun 21 12:11:56 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Remove tests for libunicode
@@ -21,17 +26,21 @@ Wed Jun 21 12:11:56 2000 Owen Taylor <otaylor@redhat.com>
2000-06-11 Elliot Lee <sopwith@redhat.com>
- * pango/fonts.c (pango_font_description_compare): g_strcasecmp returns 0 when strings are equal - negate return value.
+ * pango/fonts.c (pango_font_description_compare): g_strcasecmp
+ returns 0 when strings are equal - negate return value.
2000-06-09 Elliot Lee <sopwith@redhat.com>
- * pango/pango-coverage.[ch]: Return 'coverage' from pango_coverage_ref.
+ * pango/pango-coverage.[ch]: Return 'coverage' from
+ pango_coverage_ref.
2000-06-08 Elliot Lee <sopwith@redhat.com>
- * modules/Makefile.am: Add DOTMODULESDIR define to make it easier to change location of .modules files.
- * pango/modules.c: Likewise. Also scan the config directory for multiple config files instead of pango.modules.
- Also fclose() opened files.
+ * modules/Makefile.am: Add DOTMODULESDIR define to make it easier
+ to change location of .modules files.
+ * pango/modules.c: Likewise. Also scan the config directory for
+ multiple config files instead of pango.modules. Also fclose()
+ opened files.
Thu Jun 8 14:43:35 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index a8e1c5ea..7176ff87 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,8 @@
+Thu Jun 29 16:35:41 2000 Owen Taylor <otaylor@redhat.com>
+
+ * modules/arabic/{*.c,Makefile.am}: New version from Karl
+ Koehler merged with the changes for the GLib unicode functions.
+
Wed Jun 21 12:11:56 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Remove tests for libunicode
@@ -21,17 +26,21 @@ Wed Jun 21 12:11:56 2000 Owen Taylor <otaylor@redhat.com>
2000-06-11 Elliot Lee <sopwith@redhat.com>
- * pango/fonts.c (pango_font_description_compare): g_strcasecmp returns 0 when strings are equal - negate return value.
+ * pango/fonts.c (pango_font_description_compare): g_strcasecmp
+ returns 0 when strings are equal - negate return value.
2000-06-09 Elliot Lee <sopwith@redhat.com>
- * pango/pango-coverage.[ch]: Return 'coverage' from pango_coverage_ref.
+ * pango/pango-coverage.[ch]: Return 'coverage' from
+ pango_coverage_ref.
2000-06-08 Elliot Lee <sopwith@redhat.com>
- * modules/Makefile.am: Add DOTMODULESDIR define to make it easier to change location of .modules files.
- * pango/modules.c: Likewise. Also scan the config directory for multiple config files instead of pango.modules.
- Also fclose() opened files.
+ * modules/Makefile.am: Add DOTMODULESDIR define to make it easier
+ to change location of .modules files.
+ * pango/modules.c: Likewise. Also scan the config directory for
+ multiple config files instead of pango.modules. Also fclose()
+ opened files.
Thu Jun 8 14:43:35 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index a8e1c5ea..7176ff87 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,8 @@
+Thu Jun 29 16:35:41 2000 Owen Taylor <otaylor@redhat.com>
+
+ * modules/arabic/{*.c,Makefile.am}: New version from Karl
+ Koehler merged with the changes for the GLib unicode functions.
+
Wed Jun 21 12:11:56 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Remove tests for libunicode
@@ -21,17 +26,21 @@ Wed Jun 21 12:11:56 2000 Owen Taylor <otaylor@redhat.com>
2000-06-11 Elliot Lee <sopwith@redhat.com>
- * pango/fonts.c (pango_font_description_compare): g_strcasecmp returns 0 when strings are equal - negate return value.
+ * pango/fonts.c (pango_font_description_compare): g_strcasecmp
+ returns 0 when strings are equal - negate return value.
2000-06-09 Elliot Lee <sopwith@redhat.com>
- * pango/pango-coverage.[ch]: Return 'coverage' from pango_coverage_ref.
+ * pango/pango-coverage.[ch]: Return 'coverage' from
+ pango_coverage_ref.
2000-06-08 Elliot Lee <sopwith@redhat.com>
- * modules/Makefile.am: Add DOTMODULESDIR define to make it easier to change location of .modules files.
- * pango/modules.c: Likewise. Also scan the config directory for multiple config files instead of pango.modules.
- Also fclose() opened files.
+ * modules/Makefile.am: Add DOTMODULESDIR define to make it easier
+ to change location of .modules files.
+ * pango/modules.c: Likewise. Also scan the config directory for
+ multiple config files instead of pango.modules. Also fclose()
+ opened files.
Thu Jun 8 14:43:35 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index a8e1c5ea..7176ff87 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,8 @@
+Thu Jun 29 16:35:41 2000 Owen Taylor <otaylor@redhat.com>
+
+ * modules/arabic/{*.c,Makefile.am}: New version from Karl
+ Koehler merged with the changes for the GLib unicode functions.
+
Wed Jun 21 12:11:56 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Remove tests for libunicode
@@ -21,17 +26,21 @@ Wed Jun 21 12:11:56 2000 Owen Taylor <otaylor@redhat.com>
2000-06-11 Elliot Lee <sopwith@redhat.com>
- * pango/fonts.c (pango_font_description_compare): g_strcasecmp returns 0 when strings are equal - negate return value.
+ * pango/fonts.c (pango_font_description_compare): g_strcasecmp
+ returns 0 when strings are equal - negate return value.
2000-06-09 Elliot Lee <sopwith@redhat.com>
- * pango/pango-coverage.[ch]: Return 'coverage' from pango_coverage_ref.
+ * pango/pango-coverage.[ch]: Return 'coverage' from
+ pango_coverage_ref.
2000-06-08 Elliot Lee <sopwith@redhat.com>
- * modules/Makefile.am: Add DOTMODULESDIR define to make it easier to change location of .modules files.
- * pango/modules.c: Likewise. Also scan the config directory for multiple config files instead of pango.modules.
- Also fclose() opened files.
+ * modules/Makefile.am: Add DOTMODULESDIR define to make it easier
+ to change location of .modules files.
+ * pango/modules.c: Likewise. Also scan the config directory for
+ multiple config files instead of pango.modules. Also fclose()
+ opened files.
Thu Jun 8 14:43:35 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index a8e1c5ea..7176ff87 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,8 @@
+Thu Jun 29 16:35:41 2000 Owen Taylor <otaylor@redhat.com>
+
+ * modules/arabic/{*.c,Makefile.am}: New version from Karl
+ Koehler merged with the changes for the GLib unicode functions.
+
Wed Jun 21 12:11:56 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Remove tests for libunicode
@@ -21,17 +26,21 @@ Wed Jun 21 12:11:56 2000 Owen Taylor <otaylor@redhat.com>
2000-06-11 Elliot Lee <sopwith@redhat.com>
- * pango/fonts.c (pango_font_description_compare): g_strcasecmp returns 0 when strings are equal - negate return value.
+ * pango/fonts.c (pango_font_description_compare): g_strcasecmp
+ returns 0 when strings are equal - negate return value.
2000-06-09 Elliot Lee <sopwith@redhat.com>
- * pango/pango-coverage.[ch]: Return 'coverage' from pango_coverage_ref.
+ * pango/pango-coverage.[ch]: Return 'coverage' from
+ pango_coverage_ref.
2000-06-08 Elliot Lee <sopwith@redhat.com>
- * modules/Makefile.am: Add DOTMODULESDIR define to make it easier to change location of .modules files.
- * pango/modules.c: Likewise. Also scan the config directory for multiple config files instead of pango.modules.
- Also fclose() opened files.
+ * modules/Makefile.am: Add DOTMODULESDIR define to make it easier
+ to change location of .modules files.
+ * pango/modules.c: Likewise. Also scan the config directory for
+ multiple config files instead of pango.modules. Also fclose()
+ opened files.
Thu Jun 8 14:43:35 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/modules/arabic/Makefile.am b/modules/arabic/Makefile.am
index f65eaec0..daf50945 100644
--- a/modules/arabic/Makefile.am
+++ b/modules/arabic/Makefile.am
@@ -7,6 +7,8 @@ sources = \
mulefont.h \
langboxfont.c \
langboxfont.h \
+ naqshfont.c \
+ naqshfont.h \
arconv.h
if INCLUDE_ARABIC
diff --git a/modules/arabic/arabic-x.c b/modules/arabic/arabic-x.c
index 807ce793..fa1421f9 100644
--- a/modules/arabic/arabic-x.c
+++ b/modules/arabic/arabic-x.c
@@ -2,7 +2,7 @@
* arabic module
*
* (C) 2000 Karl Koehler<koehler@or.uni-bonn.de>
- * Owen Taylor <otayler@redhat.com>
+ * Owen Taylor <otaylor@redhat.com>
*
*/
@@ -14,8 +14,9 @@
#include "arconv.h"
#include "mulefont.h"
#include "langboxfont.h"
+#include "naqshfont.h"
-/* #define DEBUG */
+/* #define DEBUG */
#ifdef DEBUG
#include <stdio.h>
#endif
@@ -99,7 +100,7 @@ arabic_engine_lang_new ()
* X window system script engine portion
*/
-static int
+static arabic_level
find_unic_font (PangoFont *font,char* charsets[],PangoXSubfont* rfonts)
{
PangoXSubfont *subfonts;
@@ -108,7 +109,7 @@ find_unic_font (PangoFont *font,char* charsets[],PangoXSubfont* rfonts)
int i;
int result = 0;
- n_subfonts = pango_x_list_subfonts (font, charsets, 3,
+ n_subfonts = pango_x_list_subfonts (font, charsets, 4,
&subfonts, &subfont_charsets);
for (i=0; i < n_subfonts; i++)
@@ -116,13 +117,29 @@ find_unic_font (PangoFont *font,char* charsets[],PangoXSubfont* rfonts)
if ( (strcmp (charsets[subfont_charsets[i]], "mulearabic-2") == 0)
&& arabic_muleinit(font,rfonts) )
{
- result = 1; /* we know we have a mulearabic-font ... */
- break;
+ result = ar_mulefont | ar_novowel;
+ /* we know we have a mulearabic-font ... */
+#ifdef DEBUG
+ if (getenv("PANGO_AR_NOMULEFONT") == NULL )
+#endif
+ break;
}
else if ( (strcmp (charsets[subfont_charsets[i]], "iso8859-6.8x") == 0)
&& arabic_lboxinit(font,rfonts) )
{
- result = 2;
+ result = ar_standard | ar_lboxfont;
+#ifdef DEBUG
+ if (getenv("PANGO_AR_NOLBOXFONT") == NULL )
+#endif
+ break;
+ }
+ else if ( (strcmp (charsets[subfont_charsets[i]], "symbol-0") == 0)
+ && urdu_naqshinit(font,rfonts) )
+ {
+ result = ar_standard | ar_naqshfont;
+#ifdef DEBUG
+ if (getenv("PANGO_AR_NONQFONT") == NULL )
+#endif
break;
}
else
@@ -131,21 +148,24 @@ find_unic_font (PangoFont *font,char* charsets[],PangoXSubfont* rfonts)
(font,PANGO_X_MAKE_GLYPH(subfonts[i],0xFE81)))
{
rfonts[0] = subfonts[i];
- result = 12;
- break;
+ result = ar_standard | ar_unifont;
}
if ( pango_x_has_glyph /* Shadda+Kasra */
(font,PANGO_X_MAKE_GLYPH(subfonts[i],0xFC62)))
{
- result = 13; /* extra vowels in font, hopefully */
- break;
+ result |= ar_composedtashkeel;
+ /* extra vowels in font, hopefully */
}
if ( pango_x_has_glyph /* Lam-Min alone */
(font,PANGO_X_MAKE_GLYPH(subfonts[i],0xFC42)))
{
- result = 14; /* extra ligatures in font, hopefully */
- break;
+ result |= ar_lig;
+ /* extra ligatures in font, hopefully */
}
+#ifdef DEBUG
+ if (getenv("PANGO_AR_NOUNIFONT") == NULL )
+#endif
+ if (result) break;
}
}
@@ -158,8 +178,8 @@ find_unic_font (PangoFont *font,char* charsets[],PangoXSubfont* rfonts)
static char *default_charset[] = {
"iso10646-1",
"iso8859-6.8x",
- /* "iso8859-6.8x" */
- "mulearabic-2"
+ "mulearabic-2",
+ "symbol-0"
};
@@ -170,17 +190,6 @@ set_glyph (PangoGlyphString *glyphs,
int i, int cluster_start, int glyph, int is_vowel)
{
PangoRectangle logical_rect;
-#ifdef DEBUG
- if ( i < 0){
- fprintf(stderr,"[ar] setglyph: setting glyph %x at index %i, cluster %i\n",
- glyph,i,cluster_start);
- raise(6);
- } else {
- fprintf(stderr,"[ar] setglyph: setting glyph %x at index %i, "
- "cluster %i ( subfont %x )\n",
- glyph,i,cluster_start,subfont);
- }
-#endif
glyphs->glyphs[i].glyph = PANGO_X_MAKE_GLYPH (subfont, glyph);
@@ -217,16 +226,15 @@ arabic_engine_shape (PangoFont *font,
int i;
const char *p;
const char *pold;
- gunichar *wc;
- int lvl = 1;
+ gunichar *wc;
+ arabic_level lvl;
g_return_if_fail (font != NULL);
g_return_if_fail (text != NULL);
g_return_if_fail (length >= 0);
g_return_if_fail (analysis != NULL);
- /* We assume we have an unicode-font like 10x20 which containes
- ** the needed chars -- or tree mulearabic-coded fonts ...
+ /* We hope there is a suitible font installed ..
*/
n_chars = n_glyph = g_utf8_strlen (text, length);
@@ -277,9 +285,7 @@ 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)
@@ -293,15 +299,11 @@ arabic_engine_shape (PangoFont *font,
int is_vowel = arabic_isvowel(wc[i]);
cluster_start = is_vowel ? pold - text : p - text;
- if ( lvl == 1 )
+ if ( lvl & ar_mulefont )
{
-#ifdef DEBUG
- fprintf(stderr,"[ar] mule-recoding char %x",
- wc[i]);
-#endif
arabic_mule_recode(&subfont,&(wc[i]),arfonts);
}
- else if ( lvl == 2 )
+ else if ( lvl & ar_lboxfont )
{
if (( i > 0 )&&(wc[i-1] == 0))
{
@@ -312,6 +314,17 @@ arabic_engine_shape (PangoFont *font,
arabic_lbox_recode(&subfont,&(wc[i]),NULL,
arfonts);
}
+ else if ( lvl & ar_naqshfont )
+ {
+ if (( i > 0 )&&(wc[i-1] == 0))
+ {
+ urdu_naqsh_recode(&subfont,&(wc[i]),
+ &(wc[i-1]), arfonts);
+ }
+ else
+ urdu_naqsh_recode(&subfont,&(wc[i]),NULL,
+ arfonts);
+ }
set_glyph(glyphs, font, subfont, n_glyph - 1,
cluster_start, wc[i], is_vowel);
diff --git a/modules/arabic/arabic.c b/modules/arabic/arabic.c
index 807ce793..fa1421f9 100644
--- a/modules/arabic/arabic.c
+++ b/modules/arabic/arabic.c
@@ -2,7 +2,7 @@
* arabic module
*
* (C) 2000 Karl Koehler<koehler@or.uni-bonn.de>
- * Owen Taylor <otayler@redhat.com>
+ * Owen Taylor <otaylor@redhat.com>
*
*/
@@ -14,8 +14,9 @@
#include "arconv.h"
#include "mulefont.h"
#include "langboxfont.h"
+#include "naqshfont.h"
-/* #define DEBUG */
+/* #define DEBUG */
#ifdef DEBUG
#include <stdio.h>
#endif
@@ -99,7 +100,7 @@ arabic_engine_lang_new ()
* X window system script engine portion
*/
-static int
+static arabic_level
find_unic_font (PangoFont *font,char* charsets[],PangoXSubfont* rfonts)
{
PangoXSubfont *subfonts;
@@ -108,7 +109,7 @@ find_unic_font (PangoFont *font,char* charsets[],PangoXSubfont* rfonts)
int i;
int result = 0;
- n_subfonts = pango_x_list_subfonts (font, charsets, 3,
+ n_subfonts = pango_x_list_subfonts (font, charsets, 4,
&subfonts, &subfont_charsets);
for (i=0; i < n_subfonts; i++)
@@ -116,13 +117,29 @@ find_unic_font (PangoFont *font,char* charsets[],PangoXSubfont* rfonts)
if ( (strcmp (charsets[subfont_charsets[i]], "mulearabic-2") == 0)
&& arabic_muleinit(font,rfonts) )
{
- result = 1; /* we know we have a mulearabic-font ... */
- break;
+ result = ar_mulefont | ar_novowel;
+ /* we know we have a mulearabic-font ... */
+#ifdef DEBUG
+ if (getenv("PANGO_AR_NOMULEFONT") == NULL )
+#endif
+ break;
}
else if ( (strcmp (charsets[subfont_charsets[i]], "iso8859-6.8x") == 0)
&& arabic_lboxinit(font,rfonts) )
{
- result = 2;
+ result = ar_standard | ar_lboxfont;
+#ifdef DEBUG
+ if (getenv("PANGO_AR_NOLBOXFONT") == NULL )
+#endif
+ break;
+ }
+ else if ( (strcmp (charsets[subfont_charsets[i]], "symbol-0") == 0)
+ && urdu_naqshinit(font,rfonts) )
+ {
+ result = ar_standard | ar_naqshfont;
+#ifdef DEBUG
+ if (getenv("PANGO_AR_NONQFONT") == NULL )
+#endif
break;
}
else
@@ -131,21 +148,24 @@ find_unic_font (PangoFont *font,char* charsets[],PangoXSubfont* rfonts)
(font,PANGO_X_MAKE_GLYPH(subfonts[i],0xFE81)))
{
rfonts[0] = subfonts[i];
- result = 12;
- break;
+ result = ar_standard | ar_unifont;
}
if ( pango_x_has_glyph /* Shadda+Kasra */
(font,PANGO_X_MAKE_GLYPH(subfonts[i],0xFC62)))
{
- result = 13; /* extra vowels in font, hopefully */
- break;
+ result |= ar_composedtashkeel;
+ /* extra vowels in font, hopefully */
}
if ( pango_x_has_glyph /* Lam-Min alone */
(font,PANGO_X_MAKE_GLYPH(subfonts[i],0xFC42)))
{
- result = 14; /* extra ligatures in font, hopefully */
- break;
+ result |= ar_lig;
+ /* extra ligatures in font, hopefully */
}
+#ifdef DEBUG
+ if (getenv("PANGO_AR_NOUNIFONT") == NULL )
+#endif
+ if (result) break;
}
}
@@ -158,8 +178,8 @@ find_unic_font (PangoFont *font,char* charsets[],PangoXSubfont* rfonts)
static char *default_charset[] = {
"iso10646-1",
"iso8859-6.8x",
- /* "iso8859-6.8x" */
- "mulearabic-2"
+ "mulearabic-2",
+ "symbol-0"
};
@@ -170,17 +190,6 @@ set_glyph (PangoGlyphString *glyphs,
int i, int cluster_start, int glyph, int is_vowel)
{
PangoRectangle logical_rect;
-#ifdef DEBUG
- if ( i < 0){
- fprintf(stderr,"[ar] setglyph: setting glyph %x at index %i, cluster %i\n",
- glyph,i,cluster_start);
- raise(6);
- } else {
- fprintf(stderr,"[ar] setglyph: setting glyph %x at index %i, "
- "cluster %i ( subfont %x )\n",
- glyph,i,cluster_start,subfont);
- }
-#endif
glyphs->glyphs[i].glyph = PANGO_X_MAKE_GLYPH (subfont, glyph);
@@ -217,16 +226,15 @@ arabic_engine_shape (PangoFont *font,
int i;
const char *p;
const char *pold;
- gunichar *wc;
- int lvl = 1;
+ gunichar *wc;
+ arabic_level lvl;
g_return_if_fail (font != NULL);
g_return_if_fail (text != NULL);
g_return_if_fail (length >= 0);
g_return_if_fail (analysis != NULL);
- /* We assume we have an unicode-font like 10x20 which containes
- ** the needed chars -- or tree mulearabic-coded fonts ...
+ /* We hope there is a suitible font installed ..
*/
n_chars = n_glyph = g_utf8_strlen (text, length);
@@ -277,9 +285,7 @@ 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)
@@ -293,15 +299,11 @@ arabic_engine_shape (PangoFont *font,
int is_vowel = arabic_isvowel(wc[i]);
cluster_start = is_vowel ? pold - text : p - text;
- if ( lvl == 1 )
+ if ( lvl & ar_mulefont )
{
-#ifdef DEBUG
- fprintf(stderr,"[ar] mule-recoding char %x",
- wc[i]);
-#endif
arabic_mule_recode(&subfont,&(wc[i]),arfonts);
}
- else if ( lvl == 2 )
+ else if ( lvl & ar_lboxfont )
{
if (( i > 0 )&&(wc[i-1] == 0))
{
@@ -312,6 +314,17 @@ arabic_engine_shape (PangoFont *font,
arabic_lbox_recode(&subfont,&(wc[i]),NULL,
arfonts);
}
+ else if ( lvl & ar_naqshfont )
+ {
+ if (( i > 0 )&&(wc[i-1] == 0))
+ {
+ urdu_naqsh_recode(&subfont,&(wc[i]),
+ &(wc[i-1]), arfonts);
+ }
+ else
+ urdu_naqsh_recode(&subfont,&(wc[i]),NULL,
+ arfonts);
+ }
set_glyph(glyphs, font, subfont, n_glyph - 1,
cluster_start, wc[i], is_vowel);
diff --git a/modules/arabic/arconv.c b/modules/arabic/arconv.c
index e722a86d..7f566e0d 100644
--- a/modules/arabic/arconv.c
+++ b/modules/arabic/arconv.c
@@ -24,9 +24,9 @@ typedef struct {
} shapestruct;
typedef struct {
- gunichar basechar;
- gunichar mark1; /* has to be initialized to zero */
- gunichar vowel; /* */
+ gunichar basechar;
+ gunichar mark1; /* has to be initialized to zero */
+ gunichar vowel; /* */
char connecttoleft;
signed char lignum; /* is a ligature with lignum aditional characters */
char numshapes;
@@ -103,11 +103,13 @@ static shapestruct chartable [] =
{0x6BA, 0xFB9E,2}, /* Urdu:NUN GHUNNA */
{0x6BB, 0xFBA0,4}, /* Sindhi: */
{0x6BE, 0xFBAA,4}, /* HA special */
+ {0x6CC, 0xFEF1,4}, /* farsi ya */
{0x6C0, 0xFBA4,2}, /* izafet: HA HAMZA */
{0x6C1, 0xFBA6,4}, /* Urdu: */
{0x6D2, 0xFBAE,2}, /* YA barree */
{0x6D3, 0xFBB0,2}, /* YA BARREE HAMZA */
+ {0x200D, 0x200D,4}, /* Zero-width joiner */
{0xFEF5, 0xFEF5,2}, /* Lam-Alif Madda */
{0xFEF7, 0xFEF7,2}, /* Lam-Alif Hamza */
{0xFEF9, 0xFEF9,2}, /* Lam-Alif iHamza */
@@ -120,6 +122,7 @@ static shapestruct chartable [] =
#define LAM 0x644
#define HAMZA 0x621
#define TATWEEL 0x640
+#define JOINER 0x200D
/* 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.
@@ -135,6 +138,7 @@ static shapestruct chartable [] =
#define KASRA 0x650
#define FATHA 0x64E
#define DAMMA 0x64F
+#define MADDA 0x653
#define LAM_ALIF 0xFEFB
@@ -151,22 +155,29 @@ charstruct_init(charstruct* s)
s->vowel = 0;
s->connecttoleft = 0;
s->lignum = 0;
- s->numshapes = 0;
+ s->numshapes = 1;
}
void
-copycstostring(gunichar* string,int* i,charstruct* s,int level)
+copycstostring(gunichar* string,int* i,charstruct* s,arabic_level level)
{ /* s is a shaped charstruct; i is the index into the string */
if (s->basechar == 0) return;
string[*i] = s->basechar; (*i)--; (s->lignum)--;
if (s->mark1 != 0)
{
- string[*i] = s->mark1; (*i)--; (s->lignum)--;
+ if ( !(level & ar_novowel) )
+ {
+ string[*i] = s->mark1; (*i)--; (s->lignum)--;
+ }
+ else
+ {
+ string[*i] = 0; (*i)--; (s->lignum)--;
+ }
}
if (s->vowel != 0)
{
- if (level > 1)
+ if (! (level & ar_novowel) )
{
string[*i] = s->vowel; (*i)--; (s->lignum)--;
}
@@ -199,7 +210,7 @@ arabic_isvowel(gunichar s)
return 0;
}
-static gunichar
+static gunichar
unshape(gunichar s)
{
int j = 0;
@@ -222,12 +233,12 @@ static gunichar
charshape(gunichar s,short which)
{ /* which 0=alone 1=end 2=start 3=middle */
int j = 0;
- if ((s >= chartable[1].basechar) && (s <= 0x64A) && ( s != TATWEEL))
+ if ((s >= chartable[1].basechar) && (s <= 0x64A) && ( s != TATWEEL) && ( s != JOINER))
{ /* basic character */
return chartable[s-chartable[0].basechar].charstart+which;
}
else if ( (s >= chartable[1].basechar) && ( s <= 0xFEFB )
- && (s != TATWEEL))
+ && (s != TATWEEL) && ( s != JOINER) && ( s!= 0x6CC))
{ /* special char or Lam-Alif */
while ( chartable[j].basechar < s) j++;
return chartable[j].charstart+which;
@@ -237,6 +248,15 @@ charshape(gunichar s,short which)
if (which < 2) return s;
else return 0xFE8B+(which-2); /* The Hamza-'pod' */
}
+ else if (s == 0x6CC)
+ { /* farsi ya --> map to Alif maqsura and Ya, depending on form */
+ switch (which){
+ case 0: return 0xFEEF;
+ case 1: return 0xFEF0;
+ case 2: return 0xFEF3;
+ case 3: return 0xFEF4;
+ }
+ }
else
{
return s;
@@ -273,6 +293,7 @@ ligature(gunichar* string,int si,int len,charstruct* oldchar)
{ /* no ligature possible --> return 0; 1 == vowel; 2 = two chars */
int retval = 0;
gunichar newchar = string[si];
+ if (!(oldchar->basechar)) return 0;
if (arabic_isvowel(newchar))
{
retval = 1;
@@ -281,7 +302,16 @@ ligature(gunichar* string,int si,int len,charstruct* oldchar)
}
switch(newchar)
{
- case SHADDA: oldchar->mark1 = newchar; break;
+ case SHADDA:
+ if (oldchar->mark1 == 0)
+ {
+ oldchar->mark1 = newchar;
+ }
+ else
+ {
+ return 0; /* no ligature possible */
+ }
+ break;
case iHAMZA:
switch(oldchar->basechar)
{
@@ -310,6 +340,15 @@ ligature(gunichar* string,int si,int len,charstruct* oldchar)
oldchar->mark1 = newchar; break;
}
break;
+ case MADDA:
+ switch(oldchar->basechar)
+ {
+ case ALIFHAMZA:
+ case ALIF:
+ oldchar->basechar = ALIFMADDA;
+ retval = 2; break;
+ }
+ break;
case KASRA:
switch(oldchar->basechar)
{
@@ -395,7 +434,7 @@ ligature(gunichar* string,int si,int len,charstruct* oldchar)
}
static void
-shape(int olen,int* len,gunichar* string,int level)
+shape(int olen,int* len,gunichar* string,arabic_level level)
{
/* The string must be in visual order already.
** This routine does the basic arabic reshaping.
@@ -424,7 +463,18 @@ shape(int olen,int* len,gunichar* string,int level)
{
which = 2; /* middle or beginning */
}
- if (oldchar.connecttoleft) which++;
+ if (oldchar.connecttoleft)
+ {
+ which++;
+ }
+ else if (curchar.basechar == HAMZA)
+ { /* normally, a Hamza hangs loose after an Alif.
+ * Use the form Ya-Hamza if you want a Hamza
+ * on a pod !
+ */
+ curchar.numshapes = 1;
+ }
+
which = which % (curchar.numshapes);
curchar.basechar = charshape(curchar.basechar,which);
if (curchar.numshapes > 2)
@@ -441,11 +491,11 @@ shape(int olen,int* len,gunichar* string,int level)
curchar.lignum++;
}
else if ( ( join == 2 )
- ||((join == 3)&&(level != 2))
- ||((join == 1)&&(level == 1)
+ ||((join == 3)&&(! (level & ar_lboxfont) ))
+ ||((join == 1)&&(level & ar_novowel )
&& arabic_isvowel(string[si])) )
{ /* Lam-Alif in Langbox-font is no ligature */
- /* No vowels in Langbox-font */
+ /* No vowels in Mulearabic-font */
(*len)--;
}
si--;
@@ -468,37 +518,43 @@ shape(int olen,int* len,gunichar* string,int level)
}
static void
-doublelig(int olen,int* len,gunichar* string,int level)
+doublelig(int olen,int* len,gunichar* string,arabic_level level)
{ /* Ok. We have presentation ligatures in our font. */
int si = (olen)-1;
- gunichar lapresult;
+ gunichar lapresult;
while (si > 0)
{
lapresult = 0;
- switch(string[si])
- {
- case SHADDA:
- switch(string[si-1])
- {
- case KASRA: lapresult = 0xFC62; break;
- case FATHA: lapresult = 0xFC60; break;
- case DAMMA: lapresult = 0xFC61; break;
- case 0x64C: lapresult = 0xFC5E; break;
- case 0x64D: lapresult = 0xFC5F; break;
- }
- break;
- case KASRA:
- if (string[si-1]==SHADDA) lapresult = 0xFC62;
- break;
- case FATHA:
- if (string[si-1]==SHADDA) lapresult = 0xFC60;
- break;
- case DAMMA:
- if (string[si-1]==SHADDA) lapresult = 0xFC61;
- break;
- case 0xFEDF: /* LAM initial */
- if (level > 13){
+ if ( level & ar_composedtashkeel ){
+ switch(string[si])
+ {
+ case SHADDA:
+ switch(string[si-1])
+ {
+ case KASRA: lapresult = 0xFC62; break;
+ case FATHA: lapresult = 0xFC60; break;
+ case DAMMA: lapresult = 0xFC61; break;
+ case 0x64C: lapresult = 0xFC5E; break;
+ case 0x64D: lapresult = 0xFC5F; break;
+ }
+ break;
+ case KASRA:
+ if (string[si-1]==SHADDA) lapresult = 0xFC62;
+ break;
+ case FATHA:
+ if (string[si-1]==SHADDA) lapresult = 0xFC60;
+ break;
+ case DAMMA:
+ if (string[si-1]==SHADDA) lapresult = 0xFC61;
+ break;
+ }
+ }
+
+ if ( level & ar_lig ){
+ switch(string[si])
+ {
+ case 0xFEDF: /* LAM initial */
switch(string[si-1]){
case 0xFE9E : lapresult = 0xFC3F; break; /* DJEEM final*/
case 0xFEA0 : lapresult = 0xFCC9; break;
@@ -509,38 +565,55 @@ doublelig(int olen,int* len,gunichar* string,int level)
case 0xFEE2 : lapresult = 0xFC42; break; /* MIM final */
case 0xFEE4 : lapresult = 0xFCCC; break;
}
- }
- break;
- case 0xFE97: /* TA inital */
- if (level > 13){
+ break;
+ case 0xFE97: /* TA inital */
switch(string[si-1]){
case 0xFEA0 : lapresult = 0xFCA1; break; /* DJ init */
case 0xFEA4 : lapresult = 0xFCA2; break; /* .HA */
case 0xFEA8 : lapresult = 0xFCA3; break; /* CHA */
}
- }
- break;
- case 0xFE91: /* BA inital */
- if (level > 13){
+ break;
+ case 0xFE91: /* BA inital */
switch(string[si-1]){
case 0xFEA0 : lapresult = 0xFC9C; break; /* DJ init */
case 0xFEA4 : lapresult = 0xFC9D; break; /* .HA */
case 0xFEA8 : lapresult = 0xFC9E; break; /* CHA */
}
- }
- break;
- case 0xFEE7: /* NUN inital */
- if (level > 13) {
+ break;
+ case 0xFEE7: /* NUN inital */
switch(string[si-1]){
case 0xFEA0 : lapresult = 0xFCD2; break; /* DJ init */
case 0xFEA4 : lapresult = 0xFCD3; break; /* .HA */
case 0xFEA8 : lapresult = 0xFCD4; break; /* CHA */
}
- }
- break;
- default:
- break;
- } /* end switch string[si] */
+ break;
+
+ case 0xFEE8: /* NUN medial */
+ switch(string[si-1]){
+ /* missing : nun-ra : FC8A und nun-sai : FC8B */
+ case 0xFEAE : lapresult = 0xFC8A; break; /* nun-ra */
+ case 0xFEB0 : lapresult = 0xFC8B; break; /* nun-sai */
+ }
+ break;
+ case 0xFEE3: /* Mim initial */
+ switch(string[si-1]){
+ case 0xFEA0 : lapresult = 0xFCCE ; break; /* DJ init */
+ case 0xFEA4 : lapresult = 0xFCCF ; break; /* .HA init */
+ case 0xFEA8 : lapresult = 0xFCD0 ; break; /* CHA init */
+ case 0xFEE4 : lapresult = 0xFCD1 ; break; /* Mim init */
+ }
+ break;
+
+ case 0xFED3: /* Fa initial */
+ switch(string[si-1]){
+ case 0xFEF2 : lapresult = 0xFC32 ; break; /* fi-ligature (!) */
+ }
+ break;
+
+ default:
+ break;
+ } /* end switch string[si] */
+ }
if (lapresult != 0)
{
string[si] = lapresult; (*len)--; string[si-1] = 0x0;
@@ -550,7 +623,7 @@ doublelig(int olen,int* len,gunichar* string,int level)
}
void
-arabic_reshape(int* len,gunichar* string,int level)
+arabic_reshape(int* len,gunichar* string,arabic_level level)
{
int i;
int olen = *len;
@@ -558,7 +631,7 @@ arabic_reshape(int* len,gunichar* string,int level)
string[i] = unshape(string[i]);
}
shape(olen,len,string,level);
- if (level > 10)
+ if ( level & ( ar_composedtashkeel | ar_lig ) )
doublelig(olen,len,string,level);
}
diff --git a/modules/arabic/arconv.h b/modules/arabic/arconv.h
index 2e3416d9..04fb135c 100644
--- a/modules/arabic/arconv.h
+++ b/modules/arabic/arconv.h
@@ -14,13 +14,18 @@
* arabic_reshape: reshapes string ( ordered left-to right visual order )
* len : before: is the length of the string
* after : number of nun-NULL characters
- * level: 1 : font with basic arabic characters, no vowels
- * 2 : with vowels
- * 3 : with composed vowels : Shadda+(Fatha,Damma,Kasra)
- * 4 : with some extra Ligatures
*
*/
-void arabic_reshape(int* len,gunichar* string,int level);
+typedef enum
+{
+ ar_nothing = 0x0, ar_novowel = 0x1,
+ ar_standard = 0x2, ar_composedtashkeel = 0x4,
+ ar_lig = 0x8,
+ ar_mulefont = 0x10, ar_lboxfont = 0x20,
+ ar_unifont = 0x40, ar_naqshfont = 0x80
+} arabic_level;
+
+void arabic_reshape(int* len,gunichar* string,arabic_level level);
int arabic_isvowel(gunichar s);
#endif
diff --git a/modules/arabic/langboxfont.c b/modules/arabic/langboxfont.c
index 784fdd0b..8a92b51b 100644
--- a/modules/arabic/langboxfont.c
+++ b/modules/arabic/langboxfont.c
@@ -227,26 +227,27 @@ arabic_lbox_recode(PangoXSubfont* subfont,int* glyph,int* glyph2,
case 0xFEFC : *glyph2 = 0xA1; break; /* Lam-Alif */
}
}
- else if (letter == 0x621)
- {
- *glyph = charmap[0].charindex;
- }
- else if (letter == 0x640)
- { /* tatweel */
- *glyph = 0xE0;
- }
- else if (letter == 0x61F)
- { /* question mark */
- *glyph = 0xBF;
- }
else if (letter < 0xB0 )
{
*glyph = letter;
}
- else
- {
+ else switch(letter)
+ {
+ /* extra vowels */
+ case 0xFC5E: *glyph = 0x82; break;
+ case 0xFC5F: *glyph = 0x83; break;
+ case 0xFC60: *glyph = 0x84; break;
+ case 0xFC61: *glyph = 0x85; break;
+ case 0xFC62: *glyph = 0x86; break;
+ case 0xFC63: *glyph = 0xAE; break; /* This is not in the font */
+
+ case 0x621: *glyph = charmap[0].charindex; break; /* hamza */
+ case 0x640: *glyph = 0xE0; break; /* tatweel */
+ case 0x61F: *glyph = 0xBF; break; /* question mark */
+ default:
*glyph = 0x20; /* we don't have this thing -- use a space */
/* This has to be something that does not print anything !! */
+ break;
}
}
diff --git a/modules/arabic/mulefont.c b/modules/arabic/mulefont.c
index 6766b7c1..6bfc6b0b 100644
--- a/modules/arabic/mulefont.c
+++ b/modules/arabic/mulefont.c
@@ -252,8 +252,35 @@ arabic_mule_recode(PangoXSubfont* subfont,int* glyph,PangoXSubfont* mulefonts)
}
else
{
- *subfont = mulefonts[1];
- *glyph = 0x26; /* we don't have this thing -- use a dot */
+ switch(letter){
+ /* Gaf */
+ case 0xFB92: *subfont = mulefonts[2]; *glyph = 0x6B; break;
+ case 0xFB93: *subfont = mulefonts[2]; *glyph = 0x6E; break;
+ case 0xFB94: *subfont = mulefonts[2]; *glyph = 0x6C; break;
+ case 0xFB95: *subfont = mulefonts[2]; *glyph = 0x6D; break;
+ /* persian Kaf -- the first to forms are wrong ... */
+ case 0xFB8E: *subfont = mulefonts[2]; *glyph = 0x55; break;
+ case 0xFB8F: *subfont = mulefonts[2]; *glyph = 0x58; break;
+ case 0xFB90: *subfont = mulefonts[2]; *glyph = 0x56; break;
+ case 0xFB91: *subfont = mulefonts[2]; *glyph = 0x57; break;
+ /* Tcheh */
+ case 0xFB7A: *subfont = mulefonts[2]; *glyph = 0x67; break;
+ case 0xFB7B: *subfont = mulefonts[2]; *glyph = 0x6A; break;
+ case 0xFB7C: *subfont = mulefonts[2]; *glyph = 0x68; break;
+ case 0xFB7D: *subfont = mulefonts[2]; *glyph = 0x69; break;
+ /* Pe */
+ case 0xFB56: *subfont = mulefonts[2]; *glyph = 0x65; break;
+ case 0xFB57: *subfont = mulefonts[2]; *glyph = 0x66; break;
+ case 0xFB58: *subfont = mulefonts[1]; *glyph = 0x66; break;
+ case 0xFB59: *subfont = mulefonts[1]; *glyph = 0x67; break;
+ /* farsi Jeh */
+ case 0xFB8A: *subfont = mulefonts[1]; *glyph = 0x68; break;
+ case 0xFB8B: *subfont = mulefonts[1]; *glyph = 0x69; break;
+ default:
+ *subfont = mulefonts[1];
+ *glyph = 0x26; /* we don't have this thing -- use a dot */
+ break;
+ }
}
}