diff options
author | James Bursa <james@netsurf-browser.org> | 2005-02-20 18:19:29 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2005-02-20 18:19:29 +0000 |
commit | 7caf0192182233de4c7524a6c40d914229952dd8 (patch) | |
tree | 1c4829abfb738e8906d2dfcd40428afe28b655a8 | |
parent | ba031d279ca169c0f1da245d35e40bc52e5abe31 (diff) | |
download | librufl-7caf0192182233de4c7524a6c40d914229952dd8.tar.gz librufl-7caf0192182233de4c7524a6c40d914229952dd8.tar.bz2 |
[project @ 2005-02-20 18:19:29 by bursa]
Fix glyph with multiple Unicodes issue on RO3-4.
svn path=/import/rufl/; revision=2452
-rw-r--r-- | makefile | 4 | ||||
-rwxr-xr-x | makeglyphs | 16 | ||||
-rw-r--r-- | rufl_init.c | 15 | ||||
-rw-r--r-- | rufl_internal.h | 4 |
4 files changed, 28 insertions, 11 deletions
@@ -22,8 +22,8 @@ all: rufl.o rufl_test,ff8 rufl_chars,ff8 rufl.o: $(SOURCE) Glyphs $(CC) $(CFLAGS) -c -o $@ $(SOURCE) -rufl_glyph_map.c: Glyphs - ./makeglyphs < $^ > $@ +rufl_glyph_map.c: Glyphs makeglyphs + ./makeglyphs < Glyphs > $@ rufl_test,ff8: rufl_test.c rufl.o $(CC) $(CFLAGS) $(LIBS) -o $@ $^ @@ -1,21 +1,29 @@ #!/usr/bin/perl -W -%glyph = (); +%name = (); print "#include <stdlib.h>\n"; print "#include \"rufl_internal.h\"\n"; print "const struct rufl_glyph_map_entry rufl_glyph_map[] = {\n"; +print "\t{\" \", 0}, /* sentinel */\n"; while (<>) { if (/^([0-9A-F]{4});([a-zA-Z0-9]+);/) { - $glyph{$2} = $1; + $name{"$1:$2"} = 1; } } -foreach $z (sort keys %glyph) { - print "\t{\"$z\", 0x$glyph{$z}},\n"; +@glyph = (); +while (($un, ) = each %name) { + ($u, $n) = split ':', $un; + push @glyph, [$n, $u]; } +foreach $z (sort {$$a[0] cmp $$b[0] or $$a[1] cmp $$b[1]} @glyph) { + print "\t{\"$$z[0]\", 0x$$z[1]},\n"; +} + +print "\t{\"~\", 0} /* sentinel */\n"; print "};\n"; print "const size_t rufl_glyph_map_size = sizeof rufl_glyph_map /\n"; print " sizeof rufl_glyph_map[0];\n"; diff --git a/rufl_init.c b/rufl_init.c index 3778978..7756ad9 100644 --- a/rufl_init.c +++ b/rufl_init.c @@ -521,9 +521,18 @@ rufl_code rufl_init_read_encoding(font_f font, sizeof rufl_glyph_map[0], rufl_glyph_map_cmp); if (entry) { - umap->map[u].u = entry->u; - umap->map[u].c = i - 1; - u++; + /* may be more than one unicode for the glyph + * sentinels stop overshooting array */ + while (strcmp(s, (entry - 1)->glyph_name) == 0) + entry--; + for (; strcmp(s, entry->glyph_name) == 0; + entry++) { + umap->map[u].u = entry->u; + umap->map[u].c = i - 1; + u++; + if (u == 256) + break; + } } } } diff --git a/rufl_internal.h b/rufl_internal.h index 5eb4989..6394722 100644 --- a/rufl_internal.h +++ b/rufl_internal.h @@ -51,7 +51,7 @@ struct rufl_unicode_map { /** Number of valid entries in u and c. */ unsigned int entries; /** Map from Unicode to character code. */ - struct rufl_unicode_map_entry map[224]; + struct rufl_unicode_map_entry map[256]; }; @@ -156,7 +156,7 @@ unsigned int rufl_substitution_lookup(unsigned int c); } #define rufl_CACHE "<Wimp$ScrapDir>.RUfl_cache" -#define rufl_CACHE_VERSION 1 +#define rufl_CACHE_VERSION 2 struct rufl_glyph_map_entry { |