diff options
author | Federico Mena Quintero <federico@ximian.com> | 2005-11-08 04:36:11 +0000 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2005-11-08 04:36:11 +0000 |
commit | f03772dc687d1b157036ebe65872bae6a5507cbf (patch) | |
tree | 96876ae035a576e75e9393f7acd4e0db061461f3 /tools/Makefile.am | |
parent | d7157323acccf40ca481aa43be8b1a71bd1f79ac (diff) | |
download | pango-f03772dc687d1b157036ebe65872bae6a5507cbf.tar.gz |
Fixes bug #320666:
2005-11-07 Federico Mena Quintero <federico@ximian.com>
Fixes bug #320666:
Instead of doing a bsearch() for every gunichar to map it to a
PangoScript, use a precomputed table for the first 8192 code
points. Also, remember the last script that we computed on each
invocation; this will also help CJK and the other scripts above
U+2000.
This table also holds information on whether the characters in it
are paired characters. We can use this to avoid doing the
expensive get_pair_index() call most of the time.
Many thanks to Matthias Clasen for his suggestions for this patch.
* tools/gen-easy-scripts-table.c: New program to generate
pango_easy_scripts_table.
* tools/Makefile.am: Build gen-easy-scripts-table.
* pango/pango-easy-scripts-table.h: New file with a mapping of the
first 8192 Unicode characters to their corresponding scripts. The
table also says whether each character has a paired char or not.
* pango/Makefile.am (libpango_1_0_la_SOURCES): Add pango-easy-scripts-table.h.
* pango/pango-script-table.h: Remove everything below U+2000, and
add a note to that effect.
* pango/pango-script.c (pango_script_for_unichar_with_last_index):
New function. This is the old pango_script_for_unichar(), but it
lets the caller keep around the computed index in
pango_script_table. This works under the assumption that a
character is likely to be in the same script block as the
preceding character in a string.
(pango_script_for_unichar): First, do a quick check against the
pango_easy_scripts_table. Then, do the expensive check with
pango_script_for_unichar_with_last_index().
(pango_script_iter_next): If the character is within the easy
script range, find out if it is a paired character by using
PANGO_PAIRED_CHAR_FLAG.
(struct _PangoScriptIter): Add a last_index_for_script_lookup
field. We use this to maintain the last-lookup index from
pango_script_for_unichar_with_last_index().
(pango_script_iter_next): If the character is not within the easy
script range, use pango_script_for_unichar_with_last_index(), and
store the index in the last_index_for_script_lookup field of the
PangoScriptIter.
Diffstat (limited to 'tools/Makefile.am')
-rw-r--r-- | tools/Makefile.am | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am index d521c58b..9e7f2387 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -7,7 +7,7 @@ INCLUDES = \ -DPANGO_DISABLE_DEPRECATED \ $(PANGO_DEBUG_FLAGS) -noinst_PROGRAMS = gen-script-for-lang +noinst_PROGRAMS = gen-script-for-lang gen-easy-scripts-table EXTRA_DIST= \ add-copyright \ @@ -19,3 +19,6 @@ EXTRA_DIST= \ gen_script_for_lang_SOURCES = gen-script-for-lang.c gen_script_for_lang_LDADD = ../pango/libpango-$(PANGO_API_VERSION).la + +gen_easy_scripts_table_SOURCES = gen-easy-scripts-table.c +gen_easy_scripts_table_LDADD = ../pango/libpango-$(PANGO_API_VERSION).la |