From f5a23a517f1c8d886603f3401a1dba9ab9f0767f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 12 Oct 2010 19:51:40 -0400 Subject: [PATCH] Remove Arabic and Syriac shapers, require harfbuzz >= 0.2 --- configure.in | 14 +- modules/Makefile.am | 1 - modules/arabic/Makefile.am | 22 --- modules/arabic/arabic-fc.c | 226 ---------------------- modules/arabic/arabic-ot.c | 461 --------------------------------------------- modules/arabic/arabic-ot.h | 80 -------- modules/syriac/Makefile.am | 25 --- modules/syriac/syriac-fc.c | 212 --------------------- modules/syriac/syriac-ot.c | 361 ----------------------------------- modules/syriac/syriac-ot.h | 69 ------- 10 files changed, 4 insertions(+), 1467 deletions(-) delete mode 100644 modules/arabic/arabic-fc.c delete mode 100644 modules/arabic/arabic-ot.c delete mode 100644 modules/arabic/arabic-ot.h delete mode 100644 modules/syriac/Makefile.am delete mode 100644 modules/syriac/syriac-fc.c delete mode 100644 modules/syriac/syriac-ot.c delete mode 100644 modules/syriac/syriac-ot.h diff --git a/configure.in b/configure.in index 8445bc2..f88d5c8 100644 --- a/configure.in +++ b/configure.in @@ -433,7 +433,7 @@ AM_CONDITIONAL(HAVE_CAIRO_FREETYPE, $have_cairo_freetype) AM_CONDITIONAL(HAVE_CAIRO_ATSUI, $have_cairo_atsui) -harfbuzz_required=0.1 +harfbuzz_required=0.2 PKG_CHECK_MODULES(HARFBUZZ, harfbuzz >= $harfbuzz_required, have_harfbuzz=true, have_harfbuzz=false) AM_CONDITIONAL(HAVE_HARFBUZZ, $have_harfbuzz) @@ -491,13 +491,12 @@ GOBJECT_INTROSPECTION_CHECK([0.6.14]) # # Modules to build # -arabic_modules="arabic-fc,arabic-lang" +arabic_modules="arabic-lang" basic_modules="basic-fc,basic-win32,basic-x,basic-atsui" hangul_modules="hangul-fc" hebrew_modules="hebrew-fc" indic_modules="indic-fc,indic-lang" khmer_modules="khmer-fc" -syriac_modules="syriac-fc" thai_modules="thai-fc" tibetan_modules="tibetan-fc" @@ -505,7 +504,7 @@ if $have_libthai ; then thai_modules="$thai_modules,thai-lang" fi -all_modules="$arabic_modules,$basic_modules,$hangul_modules,$hebrew_modules,$indic_modules,$khmer_modules,$syriac_modules,$thai_modules,$tibetan_modules" +all_modules="$arabic_modules,$basic_modules,$hangul_modules,$hebrew_modules,$indic_modules,$khmer_modules,$thai_modules,$tibetan_modules" # # Allow building some or all modules included @@ -575,7 +574,6 @@ for module in $included_modules; do done IFS="$pango_save_ifs" -AM_CONDITIONAL(INCLUDE_ARABIC_FC, echo $included_modules | egrep '(^|,)arabic-fc($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_ARABIC_LANG, echo $included_modules | egrep '(^|,)arabic-lang($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_BASIC_FC, echo $included_modules | egrep '(^|,)basic-fc($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_BASIC_WIN32, echo $included_modules | egrep '(^|,)basic-win32($|,)' > /dev/null) @@ -586,12 +584,10 @@ AM_CONDITIONAL(INCLUDE_HEBREW_FC, echo $included_modules | egrep '(^|,)hebrew-fc AM_CONDITIONAL(INCLUDE_INDIC_FC, echo $included_modules | egrep '(^|,)indic-fc($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_INDIC_LANG, echo $included_modules | egrep '(^|,)indic-lang($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_KHMER_FC, echo $included_modules | egrep '(^|,)khmer-fc($|,)' > /dev/null) -AM_CONDITIONAL(INCLUDE_SYRIAC_FC, echo $included_modules | egrep '(^|,)syriac-fc($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_THAI_FC, echo $included_modules | egrep '(^|,)thai-fc($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_THAI_LANG, echo $included_modules | egrep '(^|,)thai-lang($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_TIBETAN_FC, echo $included_modules | egrep '(^|,)tibetan-fc($|,)' > /dev/null) -AM_CONDITIONAL(DYNAMIC_ARABIC_FC, echo $dynamic_modules | egrep '(^|,)arabic-fc($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_ARABIC_LANG, echo $dynamic_modules | egrep '(^|,)arabic-lang($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_BASIC_FC, echo $dynamic_modules | egrep '(^|,)basic-fc($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_BASIC_WIN32, echo $dynamic_modules | egrep '(^|,)basic-win32($|,)' > /dev/null) @@ -602,7 +598,6 @@ AM_CONDITIONAL(DYNAMIC_HEBREW_FC, echo $dynamic_modules | egrep '(^|,)hebrew-fc( AM_CONDITIONAL(DYNAMIC_INDIC_FC, echo $dynamic_modules | egrep '(^|,)indic-fc($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_INDIC_LANG, echo $dynamic_modules | egrep '(^|,)indic-lang($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_KHMER_FC, echo $dynamic_modules | egrep '(^|,)khmer-fc($|,)' > /dev/null) -AM_CONDITIONAL(DYNAMIC_SYRIAC_FC, echo $dynamic_modules | egrep '(^|,)syriac-fc($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_THAI_FC, echo $dynamic_modules | egrep '(^|,)thai-fc($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_THAI_LANG, echo $dynamic_modules | egrep '(^|,)thai-lang($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_TIBETAN_FC, echo $dynamic_modules | egrep '(^|,)tibetan-fc($|,)' > /dev/null) @@ -671,7 +666,7 @@ dnl * Options to pass to libtool dnl ******************************************************** # Note that -module isn't included here since automake needs to see it to know -# that something like pango-arabic-fc.la is a valid libtool archive +# that something like pango-basic-fc.la is a valid libtool archive # LIBRARY_LIBTOOL_OPTIONS="-version-info $VERSION_INFO" MODULE_LIBTOOL_OPTIONS="-export-dynamic -avoid-version" @@ -978,7 +973,6 @@ modules/hangul/Makefile modules/hebrew/Makefile modules/indic/Makefile modules/khmer/Makefile -modules/syriac/Makefile modules/thai/Makefile modules/tibetan/Makefile examples/Makefile diff --git a/modules/Makefile.am b/modules/Makefile.am index dc8a2c8..802c8b5 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -7,7 +7,6 @@ SUBDIRS = \ hebrew \ indic \ khmer \ - syriac \ thai \ tibetan diff --git a/modules/arabic/Makefile.am b/modules/arabic/Makefile.am index 935eb03..2a20532 100644 --- a/modules/arabic/Makefile.am +++ b/modules/arabic/Makefile.am @@ -1,27 +1,5 @@ include $(top_srcdir)/modules/Module.mk -if HAVE_FREETYPE -INCLUDES += $(FREETYPE_CFLAGS) -if INCLUDE_ARABIC_FC -noinst_LTLIBRARIES += libpango-arabic-fc.la -else -if DYNAMIC_ARABIC_FC -module_LTLIBRARIES += pango-arabic-fc.la -endif -endif -endif - -fc_sources = \ - arabic-fc.c \ - arabic-ot.c \ - arabic-ot.h - -pango_arabic_fc_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS) -pango_arabic_fc_la_LIBADD = $(pangoft2libs) -pango_arabic_fc_la_SOURCES = $(fc_sources) -libpango_arabic_fc_la_SOURCES = $(fc_sources) -libpango_arabic_fc_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_arabic_fc - if INCLUDE_ARABIC_LANG noinst_LTLIBRARIES += libpango-arabic-lang.la diff --git a/modules/arabic/arabic-fc.c b/modules/arabic/arabic-fc.c deleted file mode 100644 index 4b024e1..0000000 --- a/modules/arabic/arabic-fc.c +++ /dev/null @@ -1,226 +0,0 @@ -/* Pango - * arabic-fc.c: Arabic shaper for FreeType-based backends - * - * Copyright (C) 2000, 2003, 2007 Red Hat Software - * Authors: - * Owen Taylor - * Behdad Esfahbod - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" -#include - -#include "arabic-ot.h" - -#include "pango-engine.h" -#include "pango-utils.h" -#include "pangofc-font.h" - -/* No extra fields needed */ -typedef PangoEngineShape ArabicEngineFc; -typedef PangoEngineShapeClass ArabicEngineFcClass ; - -#define SCRIPT_ENGINE_NAME "ArabicScriptEngineFc" -#define RENDER_TYPE PANGO_RENDER_TYPE_FC - -static PangoEngineScriptInfo arabic_scripts[] = { - { PANGO_SCRIPT_ARABIC, "*" }, - { PANGO_SCRIPT_NKO, "*" } -}; - -static PangoEngineInfo script_engines[] = { - { - SCRIPT_ENGINE_NAME, - PANGO_ENGINE_TYPE_SHAPE, - RENDER_TYPE, - arabic_scripts, G_N_ELEMENTS(arabic_scripts) - } -}; - -static const PangoOTFeatureMap gsub_features[] = -{ - {"ccmp", PANGO_OT_ALL_GLYPHS}, - {"locl", PANGO_OT_ALL_GLYPHS}, - {"isol", isolated}, - {"fina", final}, - {"medi", medial}, - {"init", initial}, - {"rlig", PANGO_OT_ALL_GLYPHS}, - {"calt", PANGO_OT_ALL_GLYPHS}, - {"liga", PANGO_OT_ALL_GLYPHS}, - /* 'dlig' should be turned-on/off-able. lets turn off for now. */ - /* {"dlig", PANGO_OT_ALL_GLYPHS}, */ - {"cswh", PANGO_OT_ALL_GLYPHS}, - {"mset", PANGO_OT_ALL_GLYPHS} -}; - -static const PangoOTFeatureMap gpos_features[] = -{ - {"curs", PANGO_OT_ALL_GLYPHS}, - {"kern", PANGO_OT_ALL_GLYPHS}, - {"mark", PANGO_OT_ALL_GLYPHS}, - {"mkmk", PANGO_OT_ALL_GLYPHS} -}; - -static void -arabic_engine_shape (PangoEngineShape *engine G_GNUC_UNUSED, - PangoFont *font, - const char *text, - gint length, - const PangoAnalysis *analysis, - PangoGlyphString *glyphs) -{ - PangoFcFont *fc_font; - FT_Face face; - PangoOTRulesetDescription desc; - const PangoOTRuleset *ruleset; - PangoOTBuffer *buffer; - gulong *properties = NULL; - glong n_chars; - gunichar *wcs; - const char *p; - int cluster = 0; - gboolean rtl = analysis->level % 2 != 0; - gboolean reverse; - int i; - - g_return_if_fail (font != NULL); - g_return_if_fail (text != NULL); - g_return_if_fail (length >= 0); - g_return_if_fail (analysis != NULL); - - fc_font = PANGO_FC_FONT (font); - face = pango_fc_font_lock_face (fc_font); - if (!face) - return; - - buffer = pango_ot_buffer_new (fc_font); - pango_ot_buffer_set_rtl (buffer, rtl); - pango_ot_buffer_set_zero_width_marks (buffer, TRUE); - - wcs = g_utf8_to_ucs4_fast (text, length, &n_chars); - properties = g_new0 (gulong, n_chars); - - reverse = !rtl ^ (analysis->gravity == PANGO_GRAVITY_NORTH || analysis->gravity == PANGO_GRAVITY_WEST); - Arabic_Assign_Properties (wcs, properties, n_chars, reverse); - - g_free (wcs); - - p = text; - for (i=0; i < n_chars; i++) - { - gunichar wc; - PangoGlyph glyph; - - wc = g_utf8_get_char (p); - - if (g_unichar_type (wc) != G_UNICODE_NON_SPACING_MARK) - cluster = p - text; - - if (pango_is_zero_width (wc)) - glyph = PANGO_GLYPH_EMPTY; - else - { - gunichar c = wc; - - if (analysis->level % 2) - g_unichar_get_mirror_char (c, &c); - - /* Hack - Microsoft fonts are strange and don't contain the - * correct rules to shape ARABIC LETTER FARSI YEH in - * medial/initial position. It looks identical to ARABIC LETTER - * YEH in these positions, so we substitute if the font contains - * ARABIC LETTER YEH - */ - if (c == 0x6cc && - ((properties[i] & (initial | medial)) != (initial | medial)) && - pango_fc_font_has_char (fc_font, 0x64a)) - c = 0x64a; - - glyph = pango_fc_font_get_glyph (fc_font, c); - } - - if (!glyph) - glyph = PANGO_GET_UNKNOWN_GLYPH (wc); - - pango_ot_buffer_add_glyph (buffer, glyph, properties[i], cluster); - - p = g_utf8_next_char (p); - } - - g_free (properties); - - desc.script = analysis->script; - desc.language = analysis->language; - - desc.n_static_gsub_features = G_N_ELEMENTS (gsub_features); - desc.static_gsub_features = gsub_features; - desc.n_static_gpos_features = G_N_ELEMENTS (gpos_features); - desc.static_gpos_features = gpos_features; - - /* TODO populate other_features from analysis->extra_attrs */ - desc.n_other_features = 0; - desc.other_features = NULL; - - ruleset = pango_ot_ruleset_get_for_description (pango_ot_info_get (face), &desc); - - pango_ot_ruleset_substitute (ruleset, buffer); - pango_ot_ruleset_position (ruleset, buffer); - pango_ot_buffer_output (buffer, glyphs); - - pango_ot_buffer_destroy (buffer); - - pango_fc_font_unlock_face (fc_font); -} - -static void -arabic_engine_fc_class_init (PangoEngineShapeClass *class) -{ - class->script_shape = arabic_engine_shape; -} - -PANGO_ENGINE_SHAPE_DEFINE_TYPE (ArabicEngineFc, arabic_engine_fc, - arabic_engine_fc_class_init, NULL) - -void -PANGO_MODULE_ENTRY(init) (GTypeModule *module) -{ - arabic_engine_fc_register_type (module); -} - -void -PANGO_MODULE_ENTRY(exit) (void) -{ -} - -void -PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines, - int *n_engines) -{ - *engines = script_engines; - *n_engines = G_N_ELEMENTS (script_engines); -} - -PangoEngine * -PANGO_MODULE_ENTRY(create) (const char *id) -{ - if (!strcmp (id, SCRIPT_ENGINE_NAME)) - return g_object_new (arabic_engine_fc_type, NULL); - else - return NULL; -} diff --git a/modules/arabic/arabic-ot.c b/modules/arabic/arabic-ot.c deleted file mode 100644 index ca8e700..0000000 --- a/modules/arabic/arabic-ot.c +++ /dev/null @@ -1,461 +0,0 @@ -/* This file is taken from the FreeType (1) tree. It's been reindented - * to roughly match Pango guidelines (in anticipation of future changes), - * but not otherwise much altered. - */ - -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 1996-2000 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* arabic -- An implementation of the contextual algorithm given in the */ -/* Unicode 2.0 book to assign the `isolated', `initial', `medial', and */ -/* `final' properties to an input string of character codes for the Arabic */ -/* script. */ -/* */ -/* This file is part of the FreeType project, and may only be used */ -/* modified and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/* The code, like the FreeType code it is derived from is dual-licensed */ -/* under the GNU General Public License and the FreeType license. See */ -/* pango/opentype/COPYING for full details of this licensing scheme. */ -/****************************************************************************/ - -#include "config.h" - -#include "arabic-ot.h" - - -/* - * - * Here a table of the joining classes for characters in the range - * U+0620 - U+06FF and U+0750 - U+077F. - * - * The following character also has a joining class: - * - * U+200D ZERO WIDTH JOINER -> causing - * - * All other characters are given the joining class `none'. - * - */ - -static const joining_class arabic[] = -{ - /* U+0620 */ - none, none, right, right, - right, right, dual, right, - dual, right, dual, dual, - dual, dual, dual, right, - - /* U+0630 */ - right, right, right, dual, - dual, dual, dual, dual, - dual, dual, dual, none, - none, none, none, none, - - /* U+0640 */ - causing, dual, dual, dual, - dual, dual, dual, dual, - right, dual, dual, transparent, - transparent, transparent, transparent, transparent, - - /* U+0650 */ - transparent, transparent, transparent, transparent, - transparent, transparent, transparent, transparent, - transparent, transparent, transparent, transparent, - transparent, transparent, transparent, none, - - /* U+0660 */ - none, none, none, none, - none, none, none, none, - none, none, none, none, - none, none, dual, dual, - - /* U+0670 */ - transparent, right, right, right, - none, right, right, right, - dual, dual, dual, dual, - dual, dual, dual, dual, - - /* U+0680 */ - dual, dual, dual, dual, - dual, dual, dual, dual, - right, right, right, right, - right, right, right, right, - - /* U+0690 */ - right, right, right, right, - right, right, right, right, - right, right, dual, dual, - dual, dual, dual, dual, - - /* U+06A0 */ - dual, dual, dual, dual, - dual, dual, dual, dual, - dual, dual, dual, dual, - dual, dual, dual, dual, - - /* U+06B0 */ - dual, dual, dual, dual, - dual, dual, dual, dual, - dual, dual, dual, dual, - dual, dual, dual, dual, - - /* U+06C0 */ - right, dual, right, right, - right, right, right, right, - right, right, right, right, - dual, right, dual, right, - - /* U+06D0 */ - dual, dual, right, right, - none, right, none, transparent, - transparent, transparent, transparent, transparent, - transparent, transparent, transparent, transparent, - - /* U+06E0 */ - transparent, transparent, transparent, transparent, - transparent, none, none, transparent, - transparent, none, transparent, transparent, - transparent, transparent, right, right, - - /* U+06F0 */ - none, none, none, none, - none, none, none, none, - none, none, dual, dual, - dual, none, none, dual -}; - -static const joining_class arabic_supplement[] = -{ - /* U+0750 */ - dual, dual, dual, dual, - dual, dual, dual, dual, - dual, right, right, right, - dual, dual, dual, dual, - - /* U+0760 */ - dual, dual, dual, dual, - dual, dual, dual, dual, - dual, dual, dual, right, - right, dual, none, none, - - /* U+0770 */ - none, none, none, none, - none, none, none, none, - none, none, none, none, - none, none, none, none -}; - -/* Here a table of the joining classes for characters in the range - * U+07C0 - U+07FF. - * - * The following character also has a joining class: - * - * U+200C ZERO WIDTH NON-JOINER -> causing - * - * All other characters are given the joining class `none'. - */ -static const joining_class nko[] = -{ - /* U+07C0 */ - none, none, none, none, - none, none, none, none, - none, none, dual, dual, - dual, dual, dual, dual, - - /* U+07D0 */ - dual, dual, dual, dual, - dual, dual, dual, dual, - dual, dual, dual, dual, - dual, dual, dual, dual, - - /* U+07E0 */ - dual, dual, dual, dual, - dual, dual, dual, dual, - dual, dual, dual, transparent, - transparent, transparent, transparent, transparent, - - /* U+07F0 */ - transparent, transparent, transparent, transparent, - none, none, none, none, - none, none, causing, none, - none, none, none, none, -}; - -#if 0 -struct cgc_ -{ - FT_UShort char_code; - FT_UShort glyph_index; - FT_UShort class; -}; - -typedef struct cgc_ cgc; - -int compare_cgc (const void* a, - const void* b) -{ - return (((cgc*)a)->glyph_index > ((cgc*)b)->glyph_index) ? - 1 : ((((cgc*)a)->glyph_index == ((cgc*)b)->glyph_index) ? - 0 : -1); -} - - -TT_Error Build_Arabic_Glyph_Properties (TT_CharMap char_map, - TT_UShort max_glyphs, - TTO_GDEFHeader** gdef) -{ - TT_UShort i, j, num_glyphs; - - cgc Arabic[0x0700 - 0x0620]; - - TT_UShort glyph_indices[0x700 - 0x0620]; - TT_UShort classes[0x700 - 0x0620]; - - if (!gdef) - return TT_Err_Invalid_Argument; - - j = 0; - - for (i = 0x0620; i < 0x0700; i++) - { - Arabic[j].char_code = i; - Arabic[j].class = (arabic[i - 0x0620] == transparent) ? - MARK_GLYPH : SIMPLE_GLYPH; - Arabic[j].glyph_index = TT_Char_Index (char_map, i); - if (Arabic[j].glyph_index) - j++; - } - num_glyphs = j; - - if (!num_glyphs) - { - /* no Arabic font */ - *gdef = NULL; - return TT_Err_Ok; - } - - /* sort it */ - - qsort (Arabic, num_glyphs, sizeof (cgc), compare_cgc); - - /* write it to the arrays, removing duplicates */ - - glyph_indices[0] = Arabic[0].glyph_index; - classes[0] = Arabic[0].class; - - j = 1; - - for (i = 1; i < num_glyphs; i++) - { - glyph_indices[j] = Arabic[i].glyph_index; - classes[j] = Arabic[i].class; - - if (glyph_indices[j - 1] != glyph_indices[j]) - j++; - } - num_glyphs = j; - - TT_GDEF_Build_ClassDefinition (*gdef, max_glyphs, num_glyphs, - glyph_indices, classes); - - return TT_Err_Ok; -} -#endif - -/* The joining rules as given in the Unicode 2.0 book (characters are - * here specified as appearing in the byte stream, i.e. *not* in - * visual order). Joining classes are given in angle brackets, glyph - * forms in square brackets. Glyphs affected by a specific rule are - * enclosed with vertical bars. - * - * Note: The description of the joining algorithm in the book is - * severely broken. You can get a corrected version from - * www.unicode.org (as of 29-Jun-1999, this hasn't appeared). - * - * R1: - * - * apply joining rules for - * -> [shape1] [shape2] - * - * -> [shape1] [isolated] [shape2] - * - * R2: || - * - * -> [final] - * - * R3: || - * - * -> [initial] - * - * R4: || - * - * -> [medial] - * - * R5: || - * - * -> [final] - * - * R6: || - * - * -> [initial] - * - * R7: If R1-R6 fail: - * - * -> [isolated] - */ - -/* `direction' can be -1, 0, or 1 to indicate the last non-transparent - * glyph, the current glyph, and the next non-transparent glyph, - * respectively. - */ - -static joining_class Get_Joining_Class (gunichar* string, - int pos, - int length, - int direction, - gboolean reverse) -{ - joining_class j; - - - while (1) - { - if (pos == 0 && direction < 0) - return none; - - pos += direction; - - if (pos >= length) - return none; - - if (string[pos] >= 0x0620 && - string[pos] < 0x0700) - j = arabic[string[pos] - 0x0620]; - else if (string[pos] >= 0x0750 && - string[pos] < 0x0780) - j = arabic_supplement[string[pos] - 0x0750]; - else if (string[pos] >= 0x07C0 && - string[pos] < 0x0800) - j = nko[string[pos] - 0x07C0]; - else if (string[pos] == 0x200D) - return causing; - else - return none; - - if (!direction || j != transparent) - { - if (G_UNLIKELY (reverse)) - return j == right ? left : j == left ? right : j; - else - return j; - } - } -} - - -FT_Error Arabic_Assign_Properties (gunichar *string, - gulong *properties, - int length, - gboolean reverse) -{ - joining_class previous, current, next; - int i; - - if (!string || !properties || length == 0) - return FT_Err_Invalid_Argument; - - for (i = 0; i < length; i++) - { - previous = Get_Joining_Class (string, i, length, -1, reverse); - current = Get_Joining_Class (string, i, length, 0, reverse); - next = Get_Joining_Class (string, i, length, 1, reverse); - - /* R1 */ - - if (current == transparent) - { - properties[i] |= isolated_p; - continue; - } - - /* R2 */ - - if (previous == causing || - previous == left || - previous == dual ) - if (current == right) - { - properties[i] |= reverse ? initial_p : final_p; - continue; - } - - /* R3 */ - - if (current == left) - if (next == causing || - next == right || - next == dual ) - { - properties[i] |= reverse ? final_p : initial_p; - continue; - } - - /* R4 */ - - if (previous == causing || - previous == left || - previous == dual ) - if (current == dual) - if (next == causing || - next == right || - next == dual ) - { - properties[i] |= medial_p; - continue; - } - - /* R5 */ - - if (previous == causing || - previous == left || - previous == dual ) - if (current == dual) - if (!(next == causing || - next == right || - next == dual )) - { - properties[i] |= reverse ? initial_p : final_p; - continue; - } - - /* R6 */ - - if (!(previous == causing || - previous == left || - previous == dual )) - if (current == dual) - if (next == causing || - next == right || - next == dual ) - { - properties[i] |= reverse ? final_p : initial_p; - continue; - } - - /* R7 */ - - properties[i] |= isolated_p; - } - - return FT_Err_Ok; -} - - -/* End */ diff --git a/modules/arabic/arabic-ot.h b/modules/arabic/arabic-ot.h deleted file mode 100644 index db9a9aa..0000000 --- a/modules/arabic/arabic-ot.h +++ /dev/null @@ -1,80 +0,0 @@ -/* This file is taken from the FreeType (1) tree. It's been reindented - * to roughly match Pango guidelines (in anticipation of future changes), - * but not otherwise much altered. - */ - -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 1996-2000 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* arabic -- An implementation of the contextual algorithm given in the */ -/* Unicode 2.0 book to assign the `isolated', `initial', `medial', and */ -/* `final' properties to an input string of character codes for the Arabic */ -/* script. */ -/* */ -/* This file is part of the FreeType project, and may only be used */ -/* modified and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/* The file LICENSE.TXT can be found in the Pango distribution as */ -/* pango/opentype/FT-license.txt */ -/****************************************************************************/ - -#include - - -enum joining_type_ -{ - isolated = 1, /* nominal */ - final = 2, /* right_joining */ - initial = 4, /* left_joining */ - medial = 8 /* double_joining */ -}; - -typedef enum joining_type_ joining_type; - - - /* A glyph's property value as needed by e.g. TT_GSUB_Apply_String() - specifies which features should *not* be applied */ - -enum arabic_glyph_property_ -{ - isolated_p = final | initial | medial, - final_p = isolated | initial | medial, - initial_p = isolated | final | medial, - medial_p = isolated | final | initial -}; - -typedef enum arabic_glyph_property_ arabic_glyph_property; - - -enum joining_class_ -{ - right, - left, /* not used */ - dual, - causing, - none, - transparent -}; - -typedef enum joining_class_ joining_class; - - -FT_Error Arabic_Assign_Properties (gunichar *string, - gulong *properties, - int length, - gboolean reverse); -#if 0 -TT_Error Build_Arabic_Glyph_Properties (TT_CharMap char_map, - TT_UShort max_glyphs, - TTO_GDEFHeader** gdef ); -#endif - - -/* End */ diff --git a/modules/syriac/Makefile.am b/modules/syriac/Makefile.am deleted file mode 100644 index 68a4441..0000000 --- a/modules/syriac/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -include $(top_srcdir)/modules/Module.mk - -if HAVE_FREETYPE -INCLUDES += $(FREETYPE_CFLAGS) -if INCLUDE_SYRIAC_FC -noinst_LTLIBRARIES += libpango-syriac-fc.la -else -if DYNAMIC_SYRIAC_FC -module_LTLIBRARIES += pango-syriac-fc.la -endif -endif -endif - -fc_sources = \ - syriac-fc.c \ - syriac-ot.c \ - syriac-ot.h - -pango_syriac_fc_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS) -pango_syriac_fc_la_LIBADD = $(pangoft2libs) -pango_syriac_fc_la_SOURCES = $(fc_sources) -libpango_syriac_fc_la_SOURCES = $(fc_sources) -libpango_syriac_fc_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_syriac_fc - --include $(top_srcdir)/git.mk diff --git a/modules/syriac/syriac-fc.c b/modules/syriac/syriac-fc.c deleted file mode 100644 index 7ba05fb..0000000 --- a/modules/syriac/syriac-fc.c +++ /dev/null @@ -1,212 +0,0 @@ -/* Pango - * syriac-fc.h: - * - * Copyright (C) 2000, 2003, 2007 Red Hat Software - * Copyright (C) 2004 Emil Soleyman-Zomalan - * Authors: - * Owen Taylor - * Emil Soleyman-Zomalan - * Behdad Esfahbod - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "config.h" -#include - -#include "syriac-ot.h" - -#include "pango-engine.h" -#include "pango-utils.h" -#include "pangofc-font.h" - -/* No extra fields needed */ -typedef PangoEngineShape SyriacEngineFc; -typedef PangoEngineShapeClass SyriacEngineFcClass ; - -#define SCRIPT_ENGINE_NAME "SyriacScriptEngineFc" -#define RENDER_TYPE PANGO_RENDER_TYPE_FC - -static PangoEngineScriptInfo syriac_scripts[] = { - { PANGO_SCRIPT_SYRIAC, "*" }, -}; - -static PangoEngineInfo script_engines[] = { - { - SCRIPT_ENGINE_NAME, - PANGO_ENGINE_TYPE_SHAPE, - RENDER_TYPE, - syriac_scripts, G_N_ELEMENTS(syriac_scripts) - } -}; - -static const PangoOTFeatureMap gsub_features[] = -{ - {"ccmp", PANGO_OT_ALL_GLYPHS}, - {"locl", PANGO_OT_ALL_GLYPHS}, - {"isol", isolated}, - {"fina", final}, - {"fin2", final2}, - {"fin3", final3}, - {"medi", medial}, - {"med2", medial2}, - {"init", initial}, - {"rlig", PANGO_OT_ALL_GLYPHS}, - {"calt", PANGO_OT_ALL_GLYPHS}, - {"liga", PANGO_OT_ALL_GLYPHS}, - /* 'dlig' should be turned-on/off-able. lets turn off for now. */ - /* {"dlig", PANGO_OT_ALL_GLYPHS}, */ -}; - -static const PangoOTFeatureMap gpos_features[] = -{ - {"kern", PANGO_OT_ALL_GLYPHS}, - {"mark", PANGO_OT_ALL_GLYPHS}, - {"mkmk", PANGO_OT_ALL_GLYPHS} -}; - -static void -syriac_engine_shape (PangoEngineShape *engine G_GNUC_UNUSED, - PangoFont *font, - const char *text, - gint length, - const PangoAnalysis *analysis, - PangoGlyphString *glyphs) -{ - PangoFcFont *fc_font; - FT_Face face; - PangoOTRulesetDescription desc; - const PangoOTRuleset *ruleset; - PangoOTBuffer *buffer; - gulong *properties = NULL; - glong n_chars; - gunichar *wcs; - const char *p; - int cluster = 0; - int i; - - g_return_if_fail (font != NULL); - g_return_if_fail (text != NULL); - g_return_if_fail (length >= 0); - g_return_if_fail (analysis != NULL); - - fc_font = PANGO_FC_FONT (font); - face = pango_fc_font_lock_face (fc_font); - if (!face) - return; - - buffer = pango_ot_buffer_new (fc_font); - pango_ot_buffer_set_rtl (buffer, analysis->level % 2 != 0); - pango_ot_buffer_set_zero_width_marks (buffer, TRUE); - - wcs = g_utf8_to_ucs4_fast (text, length, &n_chars); - properties = g_new0 (gulong, n_chars); - - syriac_assign_properties (wcs, properties, n_chars); - - g_free (wcs); - - p = text; - for (i=0; i < n_chars; i++) - { - gunichar wc; - PangoGlyph glyph; - - wc = g_utf8_get_char (p); - - if (g_unichar_type (wc) != G_UNICODE_NON_SPACING_MARK) - cluster = p - text; - - if (pango_is_zero_width (wc)) - glyph = PANGO_GLYPH_EMPTY; - else - { - gunichar c = wc; - - if (analysis->level % 2) - g_unichar_get_mirror_char (c, &c); - - glyph = pango_fc_font_get_glyph (fc_font, c); - } - - if (!glyph) - glyph = PANGO_GET_UNKNOWN_GLYPH (wc); - - pango_ot_buffer_add_glyph (buffer, glyph, properties[i], cluster); - - p = g_utf8_next_char (p); - } - - g_free (properties); - - desc.script = analysis->script; - desc.language = analysis->language; - - desc.n_static_gsub_features = G_N_ELEMENTS (gsub_features); - desc.static_gsub_features = gsub_features; - desc.n_static_gpos_features = G_N_ELEMENTS (gpos_features); - desc.static_gpos_features = gpos_features; - - /* TODO populate other_features from analysis->extra_attrs */ - desc.n_other_features = 0; - desc.other_features = NULL; - - ruleset = pango_ot_ruleset_get_for_description (pango_ot_info_get (face), &desc); - - pango_ot_ruleset_substitute (ruleset, buffer); - pango_ot_ruleset_position (ruleset, buffer); - pango_ot_buffer_output (buffer, glyphs); - - pango_ot_buffer_destroy (buffer); - - pango_fc_font_unlock_face (fc_font); -} - -static void -syriac_engine_fc_class_init (PangoEngineShapeClass *class) -{ - class->script_shape = syriac_engine_shape; -} - -PANGO_ENGINE_SHAPE_DEFINE_TYPE (SyriacEngineFc, syriac_engine_fc, - syriac_engine_fc_class_init, NULL) - -void -PANGO_MODULE_ENTRY(init) (GTypeModule *module) -{ - syriac_engine_fc_register_type (module); -} - -void -PANGO_MODULE_ENTRY(exit) (void) -{ -} - -void -PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines, - int *n_engines) -{ - *engines = script_engines; - *n_engines = G_N_ELEMENTS (script_engines); -} - -PangoEngine * -PANGO_MODULE_ENTRY(create) (const char *id) -{ - if (!strcmp (id, SCRIPT_ENGINE_NAME)) - return g_object_new (syriac_engine_fc_type, NULL); - else - return NULL; -} diff --git a/modules/syriac/syriac-ot.c b/modules/syriac/syriac-ot.c deleted file mode 100644 index 0fbb64e..0000000 --- a/modules/syriac/syriac-ot.c +++ /dev/null @@ -1,361 +0,0 @@ -/* Pango - * syriac-ot.h: Determine what OpenType features to apply to characters based - * on the rules for Syriac from the OpenType standard. - * - * Copyright (C) 2004 Emil Soleyman-Zomalan - * Author: Emil Soleyman-Zomalan - * - * This file is based on the Arabic shaping code from FreeType 1 tree; original - * copyright notice: - * - * The FreeType project -- a free and portable quality TrueType renderer. - * - * Copyright 1996-2000 by - * D. Turner, R.Wilhelm, and W. Lemberg - * - * The code, like the FreeType code it is derived from is dual-licensed - * under the GNU General Public License and the FreeType license. See - * pango/opentype/COPYING for full details of this licensing scheme. - */ -#include "config.h" -#include "syriac-ot.h" - -/* Here a table of the joining classes for characters in the range - * U+0700 - U+074F. - * - * The following character also has a joining class: - * - * U+200C ZERO WIDTH NON-JOINER -> causing - * - * All other characters are given the joining class `none'. - */ -static const JoiningClass syriac[] = -{ - /* U+0700 */ - none, none, none, none, - none, none, none, none, - none, none, none, none, - none, none, none, transparent, - - /* U+0710 */ - right, none, dual, dual, - dual, right, right, right, - right, right, dual, dual, - dual, dual, right, dual, - - /* U+0720 */ - dual, dual, dual, dual, - dual, dual, dual, dual, - right, dual, right, dual, - right, none, none, none, - - /* U+0730 */ - transparent, transparent, transparent, transparent, - transparent, transparent, transparent, transparent, - transparent, transparent, transparent, transparent, - transparent, transparent, transparent, transparent, - - /* U+0740 */ - transparent, transparent, transparent, transparent, - transparent, transparent, transparent, transparent, - transparent, transparent, transparent, none, - none, right, dual, dual -}; - -/* `direction' can be -1, 0, or 1 to indicate the last non-transparent - * glyph, the current glyph, and the next non-transparent glyph, - * respectively. - */ -static JoiningClass -Get_Joining_Class (gunichar* string, - int pos, - int length, - int direction) -{ - JoiningClass j; - - while (1) - { - if (pos == 0 && direction < 0) - return none; - - pos += direction; - - if (pos >= length) - return none; - - if (string[pos] < 0x0700 || - string[pos] >= 0x074F) - { - if (string[pos] == 0x200C) - return causing; - else - return none; - } - else - j = syriac[string[pos] - 0x0700]; - - if (!direction || j != transparent) - return j; - } -} - - -/* The rules here are roughly based on the Arabic rules from the Unicode - * 2.0 standard (which differ from the Unicode-4.0 rules), augmented - * with the Syriac rules from the Unicode-4.0 standard. The numbers - * R1...R11 below do not correspond to either the Arabic or the Syriac - * rule numbering from the Unicode standard. - * - * Characters are here specified as appearing in the byte stream, i.e. - * *not* in visual order. Joining classes are given in angle brackets, - * glyph forms in square brackets. Glyphs affected by a specific rule are - * enclosed with vertical bars. - * - * - * Glyphs: 0x0715 (Dalath), 0x0716 (Dalath Rish), 0x072A (Rish), - * 0x0722 (Nun), 0x071F (Kaph) - * - * - * R1: - * - * apply joining rules for - * -> [shape1] [shape2] - * -> [shape1] [isolated] [shape2] - * - * - * R2: <0x0722|0x071F> - * -> [isolated] - * - * The Nun and Kaph characters each have 3 different glyphs - * with two of those glyphs coming at the final position. - * However, one of those final glyphs should really be of the - * isolated glyph form where the preceding character cannot be - * joined to and there is no next character. - * - * This rule exists to combine similar exception for both - * characters without increasing the complexity in the other - * rules. - * - * - * R3: && || - * - * -> [final2] - * - * If the preceding glyph cannot be joined to the current - * glyph and the preceding character is not a Dalath, Rish, - * or Dotless Dalath Rish, then the Alaph takes this contextual - * position. - * - * The [final2] joining rule is placed ahead of the [final] to - * give it greater precedence when choosing the correct glyph. - * If it comes after the [final] rule, the incorrect glyph is - * inserted into position. - * - * - * R4: <0x0715|0x0715|0x072A> || - * - * -> [final3] - * - * If the previous glyph is a Dalath, Rish, or Dotless Dalath - * Rish, then the Alaph takes this contextual position. - * - * The [final3] joining rule is placed ahead of the [final] to - * give it greater precedence when choosing the correct glyph. - * If it comes after the [final] rule, the incorrect glyph is - * inserted into position. - * - * - * R5: || - * - * -> [final] - * - * - * R6: || - * - * -> [final] - * - * - * R7: || - * - * -> [medial] - * - * - * R8: || - * - * -> [medial2] - * - * If the Alaph glyph falls in the middle of a Syriac word and - * the preceding character cannot be joined to, then the Alaph - * takes this contextual position. - * - * - * R9: || - * - * -> [initial] - * - * - * R10: || - * - * -> [initial] - * - * - * R11: -> [isolated] - * - * This joining rule is placed at the end of these features - * because when it is placed at the beginning of all of them - * it tends to break the cursive nature of Syriac writing -- - * it inserts the isolated glyph of each character into that - * position with no joining occurring all throughout a text - * document. - */ - -FT_Error -syriac_assign_properties (gunichar *string, - gulong *properties, - int length) -{ - JoiningClass previous, current, next; - int i; - - if (!string || !properties || length == 0) - return FT_Err_Invalid_Argument; - - for (i = 0; i < length; i++) - { - previous = Get_Joining_Class (string, i, length, -1); - current = Get_Joining_Class (string, i, length, 0); - next = Get_Joining_Class (string, i, length, 1); - - /* R1 */ - - if (current == transparent) - { - properties[i] |= isolated_p; - continue; - } - - /* R2 */ - - if (string[i] == 0x0722 || - string[i] == 0x071F) - if (previous == causing || - previous == right) - if (!(next == causing || - next == right || - next == dual)) - { - properties[i] |= isolated_p; - continue; - } - - /* R3 */ - - if (string[i] == 0x0710) - if (previous == causing || - previous == right) - if (!(string[i - 1] == 0x0715 || - string[i - 1] == 0x0716 || - string[i - 1] == 0x072A)) - { - properties[i] |= final2_p; - continue; - } - - /* R4 */ - - if (string[i] == 0x0710) - if (previous == causing || - previous == right) - if (string[i - 1] == 0x0715 || - string[i - 1] == 0x0716 || - string[i - 1] == 0x072A) - { - properties[i] |= final3_p; - continue; - } - - /* R5 */ - - if (previous == causing || - previous == right || - previous == dual) - if (current == right) - { - properties[i] |= final_p; - continue; - } - - /* R6 */ - - if (previous == causing || - previous == right || - previous == dual) - if (current == dual) - if (!(next == causing || - next == right || - next == dual )) - { - properties[i] |= final_p; - continue; - } - - /* R7 */ - - if (previous == causing || - previous == left || - previous == dual) - if (current == dual) - if (next == causing || - next == right || - next == dual ) - { - properties[i] |= medial_p; - continue; - } - - /* R8 */ - - if (string[i] == 0x0710) - if (previous == causing || - previous == right) - if (next == causing || - next == right || - next == dual) - { - properties[i] |= medial2_p; - continue; - } - - /* R9 */ - - if (current == left) - if (next == causing || - next == right || - next == dual) - { - properties[i] |= initial_p; - continue; - } - - /* R10 */ - - if (!(previous == causing || - previous == left || - previous == dual )) - if (current == dual) - if (next == causing || - next == right || - next == dual) - { - properties[i] |= initial_p; - continue; - } - - /* R11 */ - - properties[i] |= isolated_p; - } - - return FT_Err_Ok; -} diff --git a/modules/syriac/syriac-ot.h b/modules/syriac/syriac-ot.h deleted file mode 100644 index e9aea54..0000000 --- a/modules/syriac/syriac-ot.h +++ /dev/null @@ -1,69 +0,0 @@ -/* Pango - * syriac-ot.h: Determine what OpenType features to apply to characters based - * on the rules for Syriac from the OpenType standard. - * - * Copyright (C) 2004 Emil Soleyman-Zomalan - * Author: Emil Soleyman-Zomalan - * - * This file is based on the Arabic shaping code from FreeType 1 tree; original - * copyright notice: - * - * The FreeType project -- a free and portable quality TrueType renderer. - * - * Copyright 1996-2000 by - * D. Turner, R.Wilhelm, and W. Lemberg - * - * The code, like the FreeType code it is derived from is dual-licensed - * under the GNU Public License and the FreeType license. See see - * pango/opentype/FT-license.txt for full details of the FreeType - * license. - */ - -#ifndef __SYRIAC_OT_H__ -#define __SYRIAC_OT_H__ - -#include - -G_BEGIN_DECLS - -typedef enum -{ - isolated = 1 << 0, /* nominal */ - final = 1 << 1, /* right_joining */ - initial = 1 << 2, /* left_joining */ - medial = 1 << 3, /* double_joining */ - medial2 = 1 << 4, /* double_joining, applies to Alaph only */ - final2 = 1 << 5, /* right_joining, applies to Alaph only */ - final3 = 1 << 6 /* right_joining, applies to Alaph only */ -} JoiningType; - -/* A glyph's property value as needed by e.g. TT_GSUB_Apply_String() - specifies which features should *not* be applied */ -typedef enum -{ - isolated_p = final | initial | medial | medial2 | final2 | final3, - final_p = isolated | initial | medial | medial2 | final2 | final3, - initial_p = isolated | final | medial | medial2 | final2 | final3, - medial_p = isolated | final | initial | medial2 | final2 | final3, - medial2_p = isolated | final | initial | medial | final2 | final3, - final2_p = isolated | final | initial | medial | medial2 | final3, - final3_p = isolated | final | initial | medial | medial2 | final2 -} SyriacGlyphForm; - -typedef enum -{ - right, - left, /* not used */ - dual, - causing, - none, - transparent -} JoiningClass; - -FT_Error syriac_assign_properties (gunichar *string, - gulong *properties, - int length); - -G_END_DECLS - -#endif /* __SYRIAC_OT_H__ */ -- 2.7.4