summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-05-05 23:30:41 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-05-05 23:30:41 +0000
commit20ab53bba42fa623824fe5fe98b2afcc13d93c76 (patch)
tree5fac2ca08fcd99db82ddf881958ffe1330c728c2 /tools
parent46ba6b62b8423d3a8e6223ebd516f1703d23aa56 (diff)
downloadpango-20ab53bba42fa623824fe5fe98b2afcc13d93c76.tar.gz
Add ZWS to hacky break algorithm.
Fri May 5 18:56:45 2000 Owen Taylor <otaylor@redhat.com> * pango/break.c (pango_break): Add ZWS to hacky break algorithm. * modules/basic/basic.c (basic_engine_shape): Special case zero-width-space as a temporary hack. (What's the right solution?) * modules/basic/tables-big.i: Added support for TIS-620 encoding. * configure.in pango/modules.[ch] pango/Makefile.am modules/**: First stab at support for linking modules directly into Pango. Add a --with-included-modules= flag that causes the specified modules to be built as convenience libraries and linked directly into libpangox. Tue May 2 22:59:52 2000 Owen Taylor <otaylor@redhat.com> * modules/basic/basic.c: Get rid of link list of masks in cache structure in favor of an array. (This is easy to do now since we already have linear indices for the masks from the new table format.) * pango/modules.c pango/pango-context.c pango/pangox.c: Modify _pango_find_map() to take quarks for the engine type and render type instead of strings. Get rid of the map hash table in favor of a GList with the most recently used map at the beginning. * pango/modules.[ch] pango/pango-context.c pango/pangox.c: Add some utility functions for getting the engine for a particular character in a map. Using modules.c knowledge of map structure, this allows us to save a bunch of useless strcmps. * pango/pango-context.c (add_engines): Remove unused lookup of shape mask. * modules/basic/tables-{small,big}.i modules/basic/basic.c tools/compress-table.pl: Reencode mask table to avoid binary searches and save a bit of space. * modules/basic/basic.c (find_converter): Get rid of gratuitous use of hash tables for looking up iconv converters. * modules/basic/tables-{small,big}.i modules/basic/basic.c: Use conv_ucs4 instead of conv_8bit for latin-1. * pango/pango-layout.c: Avoid calling pango_glyph_string_extents() - just add up the widths from shaping.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/compress-table.pl91
1 files changed, 78 insertions, 13 deletions
diff --git a/tools/compress-table.pl b/tools/compress-table.pl
index 83b268cb..a11f3d8a 100755
--- a/tools/compress-table.pl
+++ b/tools/compress-table.pl
@@ -7,6 +7,37 @@ sub convert {
return $s;
}
+$combo_index = 1;
+
+sub add {
+ my $combo = shift;
+ if (!exists($combos{$combo})) {
+ $combos{$combo} = $combo_index++;
+ printf " $combo,\n", $combos{$combo};
+ }
+}
+
+my $col = 0;
+
+sub output {
+ my ($start,$u,$index) = @_;
+
+ for (my $i = $start; $i < $u; $i++) {
+ print " 0,";
+ $col = ($col + 1) % 16;
+ if ($col == 0) {
+ print "\n";
+ }
+ }
+ printf " %2d,", $index;
+ $col = ($col + 1) % 16;
+ if ($col == 0) {
+ print "\n";
+ }
+}
+
+print "const guint32 char_mask_map[] = {\n 0,\n";
+
open TABLE, "table";
$encodings = "";
@@ -16,28 +47,62 @@ while (<TABLE>) {
($u, $e) = ($1, $2);
$u = oct($u);
-
- if (!defined $start) {
- $start = $u;
+
+ if (!defined $old_u) {
$old_u = $u;
$encodings = convert($e);
- $end = $u;
} elsif ($old_u ne $u) {
- if (!defined $old_encodings) {
- $old_encodings = $encodings;
- } elsif ($old_encodings ne $encodings || $old_u != $end + 1) {
-
- printf "{ %#x, %#x, $old_encodings },\n", $start, $end;
- $start = $old_u;
- $old_encodings = $encodings;
- }
- $end = $old_u;
+ add($encodings);
+ $old_u = $u;
+ $encodings = convert($e);
+ } else {
+ $encodings .= "|".convert($e);
+ }
+ }
+}
+
+if (defined $old_u) {
+ add($encodings);
+}
+
+close TABLE;
+
+print <<EOF;
+};
+
+const guchar char_masks[] = {
+EOF
+
+open TABLE, "table";
+
+$encodings = "";
+
+undef $old_u;
+$start = 0;
+while (<TABLE>) {
+ if (/^(0x[0-9a-fA-F]+)\s+([^:]*):(0x[0-9a-fA-F]+)/) {
+ ($u, $e) = ($1, $2);
+
+ $u = oct($u);
+
+ if (!defined $old_u) {
+ $old_u = $u;
$encodings = convert($e);
+ } elsif ($old_u ne $u) {
+ output($start, $old_u, $combos{$encodings});
+ $start = $old_u + 1;
$old_u = $u;
+ $encodings = convert($e);
} else {
$encodings .= "|".convert($e);
}
}
}
+if (defined $old_u) {
+ output($start, $old_u, $combos{$encodings});
+}
+
close TABLE;
+
+print "\n};\n";