From 0f36f55ee0e7c9bf224fabbaf31843b3868f213c Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Tue, 23 Sep 2003 23:11:59 +0000 Subject: Modules now declare a list of scripts that they cover instead of a list of Tue Sep 23 18:03:57 2003 Owen Taylor * pango/pango-engines.[ch] pango/pango-engines-private.h: Modules now declare a list of scripts that they cover instead of a list of code point ranges. Also, there is now a ->covers() virtual function that allows a module to decide live whether the font covers a particular codepoint; remove old get_coverage() method. * pango/pango-fontset.[ch]: Add a foreach() function to iterate over all the fonts in a fontset (with a true return stopping iteration). * pango/pango-context.c: Complete rewrite using script-run information to improve language tags. Switch to an approach where we handle one run at a time rather than computing information for each character individually then later breaking the result into runs. * pango/pango-fontset.[ch]: Switch over to using pango-impl-utils.h. * modules/basic/basic-x.c pango/pangox-fontmap.c: Adapt to the change from get_coverage => covers. * pango/pango-modules.h pango/modules.c: Switch PangoMap over to being based on script rather than being based on codepoint. Remove the no longer needed pango_map_get_entry(). * pango/modules.c: Handle new script-based modules. * pango/pango-fc-fontmap.c pango/pango-win32-fontmap.c pango/pang-fontmap.[ch]: Add a shape_engine_type field to PangoFontmapClass, pango_font_map_get_shape_engine_type(); this allows generic code to find a shaper for a particular fontmap. * pango/pango-script.[ch]: Add pango_script_get_sample_language(), pango_language_includes_script(); functions for determining the relationship between scripts and language. * tools/gen-script-for-lang.c: Modify to spit out a useful table. * pango/pango-script-lang-table.h: Version of table generated from current fontconfig data. * pango/pangox.c: Remove complicated code to compute coverages; no longer useful now that we just have the basic shaper as a legacy thing. * modules/*/*.c: Adapt to identifying shape engines by language range. * modules/thai/thai-fc.c modules/thai/thai-shaper.[ch]: Remove now unused "has_glyph" function and XTIS support. * modules/thai/thai-fc.c: Handle non-Thai characters as well, since the Thai module now gets spaces, punctuation, and so forth. --- pango/pangox-fontmap.c | 44 +++++++++++++++----------------------------- 1 file changed, 15 insertions(+), 29 deletions(-) (limited to 'pango/pangox-fontmap.c') diff --git a/pango/pangox-fontmap.c b/pango/pangox-fontmap.c index ca6615ec..09fbfcc9 100644 --- a/pango/pangox-fontmap.c +++ b/pango/pangox-fontmap.c @@ -220,6 +220,7 @@ pango_x_font_map_class_init (PangoFontMapClass *class) object_class->finalize = pango_x_font_map_finalize; class->load_font = pango_x_font_map_load_font; class->list_families = pango_x_font_map_list_families; + class->shape_engine_type = PANGO_RENDER_TYPE_X; } /* @@ -1527,7 +1528,6 @@ pango_x_face_get_coverage (PangoXFace *xface, PangoXFont *xfont; PangoXFontMap *xfontmap = NULL; /* Quiet gcc */ PangoCoverage *result = NULL; - GHashTable *coverage_hash; Atom atom = None; if (xface) @@ -1553,42 +1553,28 @@ pango_x_face_get_coverage (PangoXFace *xface, if (!result) { - guint32 ch; PangoMap *shape_map; - PangoCoverage *coverage; - PangoCoverageLevel font_level; - PangoMapEntry *map_entry; - + PangoEngineShape *engine; + gunichar wc; + result = pango_coverage_new (); - coverage_hash = g_hash_table_new (g_str_hash, g_str_equal); - shape_map = pango_x_get_shaper_map (language); + engine = (PangoEngineShape *)pango_map_get_engine (shape_map, PANGO_SCRIPT_COMMON); - for (ch = 0; ch < 65536; ch++) + for (wc = 0; wc < 65536; wc++) { - map_entry = pango_map_get_entry (shape_map, ch); - if (map_entry->info) - { - coverage = g_hash_table_lookup (coverage_hash, map_entry->info->id); - if (!coverage) - { - PangoEngineShape *engine = (PangoEngineShape *)pango_map_get_engine (shape_map, ch); - coverage = _pango_engine_shape_get_coverage (engine, font, language); - g_hash_table_insert (coverage_hash, map_entry->info->id, coverage); - } - - font_level = pango_coverage_get (coverage, ch); - if (font_level == PANGO_COVERAGE_EXACT && !map_entry->is_exact) - font_level = PANGO_COVERAGE_APPROXIMATE; - - if (font_level != PANGO_COVERAGE_NONE) - pango_coverage_set (result, ch, font_level); - } + PangoCoverageLevel level; + + level = _pango_engine_shape_covers (engine, font, language, wc); + if (level != PANGO_COVERAGE_NONE) + pango_coverage_set (result, wc, level); } - g_hash_table_foreach (coverage_hash, free_coverages_foreach, NULL); - g_hash_table_destroy (coverage_hash); + return result; + + + result = _pango_engine_shape_get_coverage (engine, font, language); if (atom) pango_x_store_cached_coverage (xfontmap, atom, result); -- cgit v1.2.1