diff options
author | Owen Taylor <otaylor@redhat.com> | 2003-08-02 18:18:30 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2003-08-02 18:18:30 +0000 |
commit | 61b8f962174f41685a12d850632da094a4dd1bc6 (patch) | |
tree | 67faa7cce4cbeb289defc9fed024b7616baa5a26 /pango | |
parent | 85cb529088899889a65a99d3a00f6035eecb4c98 (diff) | |
download | pango-61b8f962174f41685a12d850632da094a4dd1bc6.tar.gz |
Remove.
Sat Aug 2 14:10:31 2003 Owen Taylor <otaylor@redhat.com>
* pango/Makefile.am pango/pango-intset.[ch] pango/pango-indic.[ch]:
Remove.
* pango/pangox.c (pango_x_apply_ligatures): Make a noop,
remove associated code.
* pango/pangox-fontmap.c pango/pangox.[ch]: Deprecate everything.
Diffstat (limited to 'pango')
-rw-r--r-- | pango/Makefile.am | 6 | ||||
-rwxr-xr-x | pango/pango-indic.c | 216 | ||||
-rw-r--r-- | pango/pango-indic.h | 89 | ||||
-rw-r--r-- | pango/pango-intset.c | 130 | ||||
-rw-r--r-- | pango/pango-intset.h | 43 | ||||
-rw-r--r-- | pango/pangox-fontmap.c | 3 | ||||
-rw-r--r-- | pango/pangox.c | 473 | ||||
-rw-r--r-- | pango/pangox.h | 4 |
8 files changed, 22 insertions, 942 deletions
diff --git a/pango/Makefile.am b/pango/Makefile.am index bfe87958..ac541e05 100644 --- a/pango/Makefile.am +++ b/pango/Makefile.am @@ -62,8 +62,6 @@ libpango_1_0_la_SOURCES = \ pango-fontmap.c \ pango-fontset.c \ pango-glyph-item.c \ - pango-intset.c \ - pango-intset.h \ pango-item.c \ pango-layout.c \ pango-markup.c \ @@ -86,7 +84,6 @@ pango_headers = \ pango-fontset.h \ pango-glyph.h \ pango-glyph-item.h \ - pango-indic.h \ pango-item.h \ pango-layout.h \ pango-modules.h \ @@ -144,8 +141,7 @@ libpangox_1_0_la_SOURCES = \ pangox.c \ pangox-private.h \ pangox-fontcache.c \ - pangox-fontmap.c \ - pango-indic.c + pangox-fontmap.c # ------------------- libpangoxft ------------------- diff --git a/pango/pango-indic.c b/pango/pango-indic.c deleted file mode 100755 index 0bd417cb..00000000 --- a/pango/pango-indic.c +++ /dev/null @@ -1,216 +0,0 @@ -/* Pango - * pango-indic.c: Library for Indic script rendering - * - * Copyright (C) 2000 SuSE Linux Ltd. - * - * Author: Robert Brady <rwb197@zepler.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * Licence as published by the Free Software Foundation; either - * version 2 of the Licence, 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 Licence for more details. - * - * You should have received a copy of the GNU Library General Public - * Licence along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "pango-glyph.h" -#include "pango-indic.h" - -/** - * pango_indic_shift_vowels: - * @script: A #PangoIndicScript - * @chars: Array of #gunichar - * @end: Pointer to just after the end of @chars - * - * This causes the any vowels in @chars which are - * left-joining vowels to move to the start of @chars. - * - * It determines whether the vowels are left-joining - * by calling is_prefixing_vowel from @script. - */ -void -pango_indic_shift_vowels (PangoIndicScript *script, - gunichar *chars, - gunichar *end) -{ - int length = end - chars; - int i, j; - - for (i = 1 ; i < length ; i++) - { - if (script->is_prefixing_vowel (chars[i])) - { - gunichar tmp = chars[i]; - - for (j = i; j > 0; j--) { - chars[j] = chars[j - 1]; - } - - chars[0] = tmp; - } - } -} - -/** - * pango_indic_compact: - * @script: A #PangoIndicScript - * @num: The number of glyphs - * @chars: An array of glyphs/characters - * @cluster: The cluster array. - * - * This eliminates any blank space in the @chars - * array, updated @clusters and @num also. - * (Blank space is defines as U+0000) - */ -void -pango_indic_compact (PangoIndicScript *script, - int *num, - gunichar *chars, - int *cluster) -{ - gunichar *dest = chars; - gunichar *end = chars + *num; - int *cluster_dest = cluster; - while (chars < end) - { - if (*chars) - { - *dest = *chars; - *cluster_dest = *cluster; - dest++; - chars++; - cluster++; - cluster_dest++; - } - else - { - chars++; - cluster++; - } - } - *num -= (chars - dest); -} - -static gunichar -default_vowel_sign_to_matra (gunichar a) -{ - return (a + 0xc000); -} - -/** - * pango_indic_convert_vowels: - * @script: A #PangoIndicScript - * @in_middle: Whether vowels should be converted - * @num: The number of elements in @chars. - * @chars: An array of glyphs/characters - * @has_standalone_vowels: Whether the font has standalone vowels. - * - * This converts the second two vowel signs in a row - * in a string, to either a vowel letter or spacing forms - * of the combining vowel. - */ -void -pango_indic_convert_vowels (PangoIndicScript *script, - gboolean in_middle, - int *num, - gunichar *chars, - gboolean has_standalone_vowels) -{ - /* goes along and converts vowel signs to vowel letters if needed. */ - gunichar *end = chars + *num; - gunichar *start = chars; - gunichar (*vowel_sign_to_matra)(gunichar a) = script->vowel_sign_to_matra; - gboolean last_was_vowel_sign = 0; - - vowel_sign_to_matra = FALSE; - if (!vowel_sign_to_matra || has_standalone_vowels) - vowel_sign_to_matra = default_vowel_sign_to_matra; - - while (chars < end) - { - gboolean convert = FALSE; - gboolean is_vowel_sign = script->is_vowel_sign (chars[0]); - if (is_vowel_sign) - { - if (chars==start) - convert = TRUE; - - if (chars > start && in_middle && - (last_was_vowel_sign || - (script->is_vowel_half && script->is_vowel_half (chars[-1])))) - convert = TRUE; - } - - if (convert) - chars[0] = vowel_sign_to_matra (chars[0]); - - last_was_vowel_sign = is_vowel_sign; - - chars++; - } -} - -/** - * pango_indic_split_out_characters - * @script: A #PangoIndicScript - * @text: A UTF-8 string - * @n_chars: The number of UTF-8 sequences in @text - * @wc: Pointer to array of #gunichar (output param) - * @n_glyph: Pointer to number of elements in @wc. (output param) - * @glyphs: A #PangoGlyphString. - * - * This splits out the string @text into characters. It will - * split out two-part vowels using @script->vowel_split if - * this function is available. - * - * *@n_chars is allocated with g_new, you must free it. - */ -void -pango_indic_split_out_characters (PangoIndicScript *script, - const char *text, - int n_chars, - gunichar **wc, - int *n_glyph, - PangoGlyphString *glyphs) -{ - const char *p = text; - int i; - *n_glyph = n_chars; - - if (script->vowel_split) - for (i = 0; i < n_chars; i++) - { - gunichar u = g_utf8_get_char (p); - if (script->vowel_split (u, NULL, NULL)) - (*n_glyph)++; - p = g_utf8_next_char (p); - } - - p = text; - *wc = (gunichar *) g_new (gunichar, *n_glyph); - pango_glyph_string_set_size (glyphs, *n_glyph); - for (i = 0; i < *n_glyph; i++) - { - (*wc)[i] = g_utf8_get_char (p); - glyphs->log_clusters[i] = p - text; - - if (script->vowel_split) - if (script->vowel_split ((*wc)[i], &(*wc)[i], &(*wc)[i+1])) - { - i++; - glyphs->log_clusters[i] = p - text; - } - - p = g_utf8_next_char (p); - } -} - - diff --git a/pango/pango-indic.h b/pango/pango-indic.h deleted file mode 100644 index daab3cb4..00000000 --- a/pango/pango-indic.h +++ /dev/null @@ -1,89 +0,0 @@ -/* Pango - * pango-indic.h: Library for Indic script rendering - * - * Copyright (C) 2000 SuSE Linux Ltd. - * - * Author: Robert Brady <rwb197@zepler.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * Licence as published by the Free Software Foundation; either - * version 2 of the Licence, 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 Licence for more details. - * - * You should have received a copy of the GNU Library General Public - * Licence along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * This library is basically internal - * - * Don't use it, unless you are me, or are in contact with me, - * or like living dangerously. - */ - -#ifndef __PANGO_INDIC_H__ -#define __PANGO_INDIC_H__ - -#include <pango-glyph.h> - -G_BEGIN_DECLS - -#ifdef PANGO_ENABLE_ENGINE - -#define PANGO_ZERO_WIDTH_NON_JOINER 0x200c -#define PANGO_ZERO_WIDTH_JOINER 0x200d - -typedef struct _PangoIndicScript PangoIndicScript; - -struct _PangoIndicScript { - /* Compulsory */ - gchar *name; - /* Compulsory */ - gboolean (*is_prefixing_vowel) (gunichar what); - /* Compulsory */ - gboolean (*is_vowel_sign) (gunichar what); - /* Optional */ - gunichar (*vowel_sign_to_matra) (gunichar what); - /* Optional */ - gboolean (*is_vowel_half) (gunichar what); - - /* Optional */ - gboolean (*vowel_split) (gunichar what, - gunichar *prefix, - gunichar *suffix); -}; - -void pango_indic_shift_vowels (PangoIndicScript *script, - gunichar *chars, - gunichar *end); - -void pango_indic_compact (PangoIndicScript *script, - int *num, - gunichar *chars, - int *cluster); - -void pango_indic_convert_vowels (PangoIndicScript *script, - gboolean in_middle, - int *num, - gunichar *chars, - gboolean has_standalone_vowels); - -void pango_indic_split_out_characters (PangoIndicScript *script, - const gchar *text, - int n_chars, - gunichar **wc, - int *n_glyph, - PangoGlyphString *glyphs); - -#endif /* PANGO_ENABLE_ENGINE */ - -G_END_DECLS - -#endif /* __PANGO_INDIC_H */ diff --git a/pango/pango-intset.c b/pango/pango-intset.c deleted file mode 100644 index 9c0df6df..00000000 --- a/pango/pango-intset.c +++ /dev/null @@ -1,130 +0,0 @@ -/* Pango - * pango-intset.c: Integer set - * - * Copyright (C) 2000 SuSE Linux Ltd - * - * Author: Robert Brady <rwb197@zepler.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * Licence as published by the Free Software Foundation; either - * version 2 of the Licence, 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 Licence for more details. - * - * You should have received a copy of the GNU Library General Public - * Licence along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#include <string.h> -#include <stdlib.h> -#include <math.h> -#include <glib.h> - -#include "pango-intset.h" - -#define ELEMENT_BITS (sizeof (guint) * CHAR_BIT) - -#define OFF_MASK (ELEMENT_BITS-1) -#define SEG_MASK (~(OFF_MASK)) - -PangoIntSet * -pango_int_set_new (void) -{ - PangoIntSet *p = g_new (PangoIntSet, 1); - p->start = 0; - p->size = 0; - p->bits = 0; - return p; -} - -static void -pango_int_set_expand (PangoIntSet *g, int value) -{ - if (!g->bits) - { - g->bits = g_new (guint, 1); - g->bits[0] = 0; - g->start = (value & SEG_MASK); - g->size = 1; - return; - } - - if (value < g->start) - { - int extra_space = ((g->start - value) & OFF_MASK) + 1; - int new_start = (value & SEG_MASK); - guint *new_bits = g_new (guint, extra_space + g->size); - memcpy (new_bits + extra_space, g->bits, g->size * sizeof (guint)); - g_free (g->bits); - g->bits = new_bits; - memset (new_bits, 0, extra_space * sizeof (guint)); - g->start = new_start; - g->size += extra_space; - return; - } - - if (value >= (g->start + g->size * ELEMENT_BITS)) - { - int extra_space = (((value - (g->start + g->size * ELEMENT_BITS)) & - OFF_MASK)) + 1; - g->bits = g_realloc (g->bits, (g->size + extra_space) * sizeof (guint)); - memset (g->bits + g->size, 0, extra_space * sizeof (guint)); - g->size += extra_space; - return; - } -} - -void -pango_int_set_add (PangoIntSet *g, int value) -{ - int offset; - pango_int_set_expand (g, value); - offset = value - g->start; - g->bits[offset / ELEMENT_BITS] |= (1 << (offset & (OFF_MASK))); -} - -void -pango_int_set_add_range (PangoIntSet *g, int start, int end) -{ - int i; - - pango_int_set_add (g, start); - - if (start != end) - pango_int_set_add (g, end); - - if ((end - start) != 1) - for (i = start; i < end; i++) - pango_int_set_add (g, i); -} - -gboolean -pango_int_set_contains (PangoIntSet *g, int member) -{ - if (!g->bits) - return 0; - - if (member < g->start) - return 0; - - if (member >= (g->start + (g->size * ELEMENT_BITS))) - return 0; - - return (g->bits[((member - g->start) / ELEMENT_BITS)] >> - (member & (ELEMENT_BITS-1))) & 1; -} - -void -pango_int_set_destroy (PangoIntSet *g) -{ - g_free (g->bits); - g_free (g); -} - diff --git a/pango/pango-intset.h b/pango/pango-intset.h deleted file mode 100644 index 68c419bc..00000000 --- a/pango/pango-intset.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Pango - * pango-intset.h: Integer set - * - * Copyright (C) 2000 SuSE Linux Ltd - * - * Author: Robert Brady <rwb197@zepler.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * Licence as published by the Free Software Foundation; either - * version 2 of the Licence, 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 Licence for more details. - * - * You should have received a copy of the GNU Library General Public - * Licence along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __PANGO_INTSET_H__ -#define __PANGO_INTSET_H__ - -typedef struct _PangoIntSet PangoIntSet; -PangoIntSet *pango_int_set_new (void); -void pango_int_set_add (PangoIntSet *g, - int glyph); -void pango_int_set_destroy (PangoIntSet *g); -void pango_int_set_add_range (PangoIntSet *g, - int start, - int end); -gboolean pango_int_set_contains (PangoIntSet *g, - int member); -struct _PangoIntSet -{ - int start, size; - guint *bits; -}; - -#endif diff --git a/pango/pangox-fontmap.c b/pango/pangox-fontmap.c index 78814c16..0d83fe79 100644 --- a/pango/pangox-fontmap.c +++ b/pango/pangox-fontmap.c @@ -32,6 +32,9 @@ #include "pango-fontmap.h" #include "pango-utils.h" + +#undef PANGO_DISABLE_DEPRECATED + #include "pangox-private.h" typedef struct _PangoXFamily PangoXFamily; diff --git a/pango/pangox.c b/pango/pangox.c index e3036d5b..91c3c75e 100644 --- a/pango/pangox.c +++ b/pango/pangox.c @@ -24,15 +24,15 @@ #include <math.h> #include <X11/Xlib.h> -#include "pangox.h" #include "pango-utils.h" -#include "pangox-private.h" -#include "pango-intset.h" #include "modules.h" -#define PANGO_X_UNKNOWN_FLAG 0x10000000 +#undef PANGO_DISABLE_DEPRECATED -#define PANGO_LIGATURE_HACK_DEBUG +#include "pangox.h" +#include "pangox-private.h" + +#define PANGO_X_UNKNOWN_FLAG 0x10000000 #include "config.h" @@ -46,97 +46,6 @@ typedef struct _PangoXFontClass PangoXFontClass; typedef struct _PangoXMetricsInfo PangoXMetricsInfo; typedef struct _PangoXContextInfo PangoXContextInfo; -typedef struct _PangoXLigatureInfo PangoXLigatureInfo; -typedef struct _PangoXLigatureSource PangoXLigatureSource; - -#ifndef HAVE_STRTOK_R -/* This implementation of strtok_r comes from the GNU C library. - * Copyright (C) 1991, 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc. - */ -static char * -my_strtok_r (char *s, - const char *delim, - char **save_ptr) -{ - char *token; - - if (s == NULL) - s = *save_ptr; - - /* Scan leading delimiters. */ - s += strspn (s, delim); - if (*s == '\0') - { - *save_ptr = s; - return NULL; - } - - /* Find the end of the token. */ - token = s; - s = strpbrk (token, delim); - if (s == NULL) - /* This token finishes the string. */ - *save_ptr = token + strlen (token); - else - { - /* Terminate the token and make *SAVE_PTR point past it. */ - *s = '\0'; - *save_ptr = s + 1; - } - return token; -} -#else -#define my_strtok_r strtok_r -#endif /* HAVE_STRTOK_R */ - -static int -hex_to_integer (const char *s) -{ - int a; - char *end_ptr; - - if (!*s) - return (gunichar)-1; - - a = strtol (s, &end_ptr, 16); - if (*end_ptr) - return (gunichar)-1; /* Invalid characters in string */ - - if (a <= 0 || a >= 0xffff) - return (gunichar)-1; /* Character out of range */ - - return a; -} - -static PangoIntSet * -parse_gintset_spec (char *s) -{ - char *m = NULL; - PangoIntSet *set = pango_int_set_new (); - s = my_strtok_r (s, ",", &m); - while (s) - { - char *p = strchr (s, '-'); - if (!p) - { - int i = hex_to_integer (s); - if (i != -1) - pango_int_set_add (set, i); - } - else - { - int start, end; - *p = 0; - p++; - start = hex_to_integer (s); - end = hex_to_integer (p); - if (start != -1 && end != -1) - pango_int_set_add_range (set, start, end); - } - s = my_strtok_r (NULL, ",", &m); - } - return set; -} struct _PangoXSubfontInfo { @@ -145,12 +54,6 @@ struct _PangoXSubfontInfo gboolean is_1byte; int range_byte1; int range_byte2; - - /* hash table mapping setnames to PangoIntSets */ - GHashTable *ligature_sets; - - PangoXLigatureInfo *ligs; - int n_ligs; }; struct _PangoXMetricsInfo @@ -170,24 +73,6 @@ struct _PangoXFontClass PangoFontClass parent_class; }; -struct _PangoXLigatureSource -{ - gboolean is_set; - union { - PangoIntSet *set; - gunichar glyph; - } data; -}; - -struct _PangoXLigatureInfo -{ - int n_source; - PangoXLigatureSource *source; - - gunichar *dest; - int n_dest; -}; - static PangoFontClass *parent_class; /* Parent class structure for PangoXFont */ static void pango_x_font_class_init (PangoXFontClass *class); @@ -227,11 +112,6 @@ static void pango_x_get_item_properties (PangoItem *item, PangoAttrColor *bg_color, gboolean *bg_set); -static void font_struct_get_ligatures (PangoFontMap *map, - Display *display, - XFontStruct *fs, - PangoXSubfontInfo *info); - static inline PangoXSubfontInfo * pango_x_find_subfont (PangoFont *font, PangoXSubfont subfont_index) @@ -267,7 +147,6 @@ pango_x_make_font_struct (PangoFont *font, PangoXSubfontInfo *info) info->is_1byte = (info->font_struct->min_byte1 == 0 && info->font_struct->max_byte1 == 0); info->range_byte1 = info->font_struct->max_byte1 - info->font_struct->min_byte1 + 1; info->range_byte2 = info->font_struct->max_char_or_byte2 - info->font_struct->min_char_or_byte2 + 1; - font_struct_get_ligatures (xfont->fontmap, xfont->display, info->font_struct, info); } static inline XFontStruct * @@ -1142,9 +1021,6 @@ pango_x_insert_subfont (PangoFont *font, const char *xlfd) info->xlfd = g_strdup (xlfd); info->font_struct = NULL; - info->n_ligs = 0; - info->ligs = 0; - info->ligature_sets = 0; xfont->n_subfonts++; @@ -1348,13 +1224,6 @@ subfonts_foreach (gpointer key, gpointer value, gpointer data) } static void -free_sets_foreach (gpointer key, gpointer value, gpointer data) -{ - g_free (key); - pango_int_set_destroy (value); -} - -static void free_metrics_info (PangoXMetricsInfo *info) { pango_font_metrics_unref (info->metrics); @@ -1367,7 +1236,7 @@ pango_x_font_finalize (GObject *object) PangoXFont *xfont = (PangoXFont *)object; PangoXFontCache *cache = pango_x_font_map_get_font_cache (xfont->fontmap); - int i, j; + int i; for (i=0; i<xfont->n_subfonts; i++) { @@ -1378,20 +1247,6 @@ pango_x_font_finalize (GObject *object) if (info->font_struct) pango_x_font_cache_unload (cache, info->font_struct); - if (info->ligs) - { - - for (j=0; j<info->n_ligs;j++) - { - g_free (info->ligs[j].source); - } - - g_free (info->ligs); - - g_hash_table_foreach (info->ligature_sets, free_sets_foreach, NULL); - g_hash_table_destroy (info->ligature_sets); - } - g_free (info); } @@ -1759,243 +1614,17 @@ pango_x_get_item_properties (PangoItem *item, } } -static void -font_struct_get_ligatures (PangoFontMap *fontmap, - Display *display, - XFontStruct *fs, - PangoXSubfontInfo *info) -{ - int i; - - PangoXLigatureInfo *linfo = 0; - int n_linfo = 0; - - GList *list = g_list_append (NULL, g_strdup ("PANGO_LIGATURE_HACK")); - GList *list_start = list; - - info->ligature_sets = g_hash_table_new (g_str_hash, g_str_equal); - - while (list) - { - Atom this_atom = pango_x_fontmap_atom_from_name (fontmap, (char *)list->data); - for (i = 0; i < fs->n_properties; i++) - { - if (fs->properties[i].name == this_atom) - { - char *val = g_strdup (pango_x_fontmap_name_from_atom (fontmap, fs->properties[i].card32)); - char *p; - char *a = my_strtok_r (val, " ", &p); - while (a) - { - char *r; - char *m; - char *q; - PangoXLigatureSource *source = NULL; - gunichar *dest = NULL; - int n_source = 0; - int n_dest = 0; - PangoXLigatureInfo *xli; - - switch (*a) - { - - case '$': - /* class being defined */ - { - char *name = a + 1; - char *data = strchr (a, '='); - PangoIntSet *set; - if (!data) - { -#ifdef PANGO_LIGATURE_HACK_DEBUG - g_warning ("Error parsing ligature info: Isolated $.\n"); -#endif - break; - } - - *data = 0; - data++; - set = parse_gintset_spec (data); - if (!set) - { -#ifdef PANGO_LIGATURE_HACK_DEBUG - g_warning ("Error parsing ligature info: Invalid glyphset.\n"); -#endif - break; - } - g_hash_table_insert (info->ligature_sets, - g_strdup (name), set); - break; - } - - case ':': - /* a pointer */ - { - char *lang = a+1; - char *name = strchr (lang, ':'); - if (name) - { - name++; - list = g_list_append (list, g_strdup (name)); - } - else - { -#ifdef PANGO_LIGATURE_HACK_DEBUG - g_warning ("Error parsing ligature info: Bad pointer.\n"); -#endif - } - break; - } - - default: - /* a literal */ - { - n_linfo++; - linfo = g_realloc (linfo, sizeof (PangoXLigatureInfo) * - n_linfo); - r = strchr (a, '='); - if (!r) - { -#ifdef PANGO_LIGATURE_HACK_DEBUG - g_warning ("Error parsing ligature info: No equals.\n"); -#endif - n_linfo--; - break; - } - *r = 0; - r++; - q = a; - q = my_strtok_r (q, "+", &m); - while (q) - { - n_source ++; - source = g_realloc (source, n_source * - sizeof (PangoXLigatureSource)); - if (q[0] == '%') - { - source[n_source-1].is_set = 1; - source[n_source-1].data.set = - g_hash_table_lookup (info->ligature_sets, - q+1); - if (!source[n_source-1].data.set) - { -#ifdef PANGO_LIGATURE_HACK_DEBUG - g_warning ("Error parsing ligature info: Unable to locate glyphset : %s\n", q+1); -#endif - source [n_source-1].is_set = 0; - source [n_source-1].data.glyph = 0; - } - } - else - { - int i = hex_to_integer (q); - if (i == -1) - { -#ifdef PANGO_LIGATURE_HACK_DEBUG - g_warning ("Error parsing ligature info: Bad character value : %s. Assuming 0\n", q); -#endif - i = 0; - } - source [n_source-1].is_set = 0; - source [n_source-1].data.glyph = i; - } - q = my_strtok_r (NULL, "+", &m); - } - q = r; - q = my_strtok_r (q, "+", &m); - while (q) - { - n_dest++; - dest = g_realloc (dest, n_dest * sizeof (gunichar)); - - if (q[0] == '%') - { - char *er; - dest[n_dest-1] = -strtol (q+1, &er, 10); - if (*er) - { -#ifdef PANGO_LIGATURE_HACK_DEBUG - g_warning ("Error parsing ligature info: Bad %% reference. Assuming 1"); -#endif - dest[n_dest-1] = -1; - } - } - else - { - int i = hex_to_integer (q); - if (i != -1) - { - dest[n_dest-1] = i; - } - else - { - dest[n_dest-1] = 0; - } - } - - q = my_strtok_r (NULL, "+", &m); - } - - xli = linfo + n_linfo - 1; - - xli->source = source; - xli->n_source = n_source; - xli->dest = dest; - xli->n_dest = n_dest; - - if (xli->n_dest > xli->n_source) - { - g_warning ("Error parsing ligature info: Warning : truncating substitute string."); - xli->n_dest = n_source; - } - } - } - - /* end switch */ - a = my_strtok_r (NULL, " ", &p); - } - g_free (val); - } - } - list = g_list_next (list); - } - - list = list_start; - - while (list) - { - g_free (list->data); - list = g_list_next (list); - } - - g_list_free (list_start); - - info->n_ligs = n_linfo; - info->ligs = linfo; -} - /** * pango_x_apply_ligatures: - * @font: a #PangoFont. - * @subfont: a #PangoXSubFont. - * @glyphs: a pointer to a pointer to an array of - * glyph indices. This holds the input glyphs - * on entry, and ligation will be performed - * on this array in-place. If the number - * of glyphs is increased, Pango will - * call g_realloc() on @glyphs, so @chars - * must be allocated with g_malloc(). - * @n_glyphs: a pointer to the number of glyphs - * *@n_glyphs is the number of original glyphs - * on entry and the number of resulting glyphs - * upon return. - * @clusters: a pointer to the cluster information. + * @font: unused + * @subfont: unused + * @glyphs: unused + * @n_glyphs: unused + * @clusters: unused * - * Does subfont-specific ligation. This involves replacing - * groups of glyphs in @chars with alternate groups of glyphs - * based on information provided in the X font. + * Previously did subfont-specific ligation. Now a no-op. * - * Return value: %TRUE if any ligations were performed. + * Return value: %FALSE, always. */ gboolean pango_x_apply_ligatures (PangoFont *font, @@ -2004,81 +1633,7 @@ pango_x_apply_ligatures (PangoFont *font, int *n_glyphs, int **clusters) { - int hits = 0; - int i, j, k; - PangoXSubfontInfo *subfont; - PangoXLigatureInfo *linfo; - int n_linfo = 0; - XFontStruct *fs; - - g_return_val_if_fail (font != NULL, 0); - - subfont = pango_x_find_subfont (font, subfont_id); - if (!subfont) - return 0; - - fs = pango_x_get_font_struct (font, subfont); - if (!fs) - return 0; - - linfo = subfont->ligs; - n_linfo = subfont->n_ligs; - - for (i = 0; i < *n_glyphs; i++) - for (j= 0; j < n_linfo; j++) - { - PangoXLigatureInfo *li = &linfo[j]; - gunichar *temp; - - if (i + li->n_source > *n_glyphs) - continue; - - for (k = 0; k < li->n_source; k++) - { - if ((li->source[k].is_set && - !pango_int_set_contains (li->source[k].data.set, - (*glyphs)[i + k])) - || (!li->source[k].is_set && - (*glyphs)[i + k] != li->source[k].data.glyph)) - goto next_pattern; - } - - - { - gunichar buffer[16]; - if (li->n_source < G_N_ELEMENTS (buffer)) - { - memcpy (buffer, &(*glyphs)[i], li->n_source * sizeof (gunichar)); - temp = buffer; - } - else - { - temp = g_memdup (&(*glyphs)[i], li->n_source * sizeof (gunichar)); - } - - for (k = 0; k < li->n_dest; k++) - { - int f = li->dest[k]; - if (f < 0) - f = temp[i - (1+f)]; - - (*glyphs) [i + k - (li->n_dest - li->n_source)] = f; - } - - for (k = 0; k < li->n_source-li->n_dest; k++) - (*glyphs) [i+k] = 0; - - hits++; - i += li->n_source - 1; - - if (temp != buffer) - g_free (temp); - } - - next_pattern: ; - } - - return hits >= 1; + return FALSE; } /** diff --git a/pango/pangox.h b/pango/pangox.h index 9f2a6833..7944a635 100644 --- a/pango/pangox.h +++ b/pango/pangox.h @@ -30,6 +30,8 @@ G_BEGIN_DECLS #include <X11/Xlib.h> +#ifndef PANGO_DISABLE_DEPRECATED + #define PANGO_RENDER_TYPE_X "PangoRenderX" typedef GC (*PangoGetGCFunc) (PangoContext *context, PangoColor *color, GC base_gc); @@ -122,6 +124,8 @@ gboolean pango_x_apply_ligatures (PangoFont *font, int *n_glyphs, int **clusters); +#endif /* PANGO_DISABLE_DEPRECATED */ + G_END_DECLS #endif /* __PANGOX_H__ */ |