diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2007-08-21 02:54:05 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2007-08-21 02:54:05 +0000 |
commit | 7c1a1c9db2cbbca42ff1e8afb2050df2a40a6854 (patch) | |
tree | c087d420438b3231a6e6c4b6b5bd866a12f3a251 /tools | |
parent | 22b8a1913a9e862e5d20e90c3b9ca50d37a214b1 (diff) | |
download | pango-7c1a1c9db2cbbca42ff1e8afb2050df2a40a6854.tar.gz |
Bug 348348 – Add a way to get the script name of a gunichar
2007-08-20 Behdad Esfahbod <behdad@gnome.org>
Bug 348348 – Add a way to get the script name of a gunichar
* configure.in: Require glib 2.14, for GUnicodeScript stuff.
* docs/tmpl/scripts.sgml: Document that #PangoScript is
interchangeable with GUnicodeScript.
* pango/pango-script.c (pango_script_for_unichar): Use
g_unichar_get_script(), and document it.
* tools/Makefile.am:
* tools/gen-script-table.pl:
* pango/Makefile.am:
* pango/pango-script-table.h:
Remove pango-script-table.h and its generator.
* pango/pango-gravity.c (get_script_properties):
* pango/pango-language.c (pango_script_get_sample_language):
* pango/pango-ot-tag.c (pango_ot_tag_from_script):
Protect against unexpected script values.
svn path=/trunk/; revision=2406
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile.am | 1 | ||||
-rwxr-xr-x | tools/gen-script-table.pl | 117 |
2 files changed, 0 insertions, 118 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am index deecda93..b099d28b 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -12,7 +12,6 @@ EXTRA_DIST= \ add-copyright \ compress-table.pl \ gen-color-table.pl \ - gen-script-table.pl \ maps/README \ maps/tis-620 diff --git a/tools/gen-script-table.pl b/tools/gen-script-table.pl deleted file mode 100755 index f3af7ce2..00000000 --- a/tools/gen-script-table.pl +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/perl -w -# -# Script to convert http://www.unicode.org/Public/UNIDATA/Scripts.txt -# into a machine-readable table. -# -###################################################################### - -if (@ARGV != 1) { - die "Usage: gen-script-table.pl Scripts.txt > pango-script-table.h\n"; -} - -open IN, $ARGV[0] || die "Cannot open $ARGV[0]: $!\n"; - -my @ranges; -my $file; -my $easy_range; -my $i; -my $start; -my $end; -my $script; - - -while (<IN>) { - if (/^\#\s+(Scripts-.*.txt)/) { - $file = $1; - } - - s/#.*//; - next if /^\s*$/; - if (!/^([0-9A-F]+)(?:\.\.([0-9A-F]+))?\s*;\s*([A-Za-z_]+)\s*$/) { - die "Cannot parse line: '$_'\n"; - } - - if (defined $2) { - push @ranges, [ hex $1, hex $2, uc $3 ]; - } else { - push @ranges, [ hex $1, hex $1, uc $3 ]; - } -} - -@ranges = sort { $a->[0] <=> $b->[0] } @ranges; -$date = gmtime; - -print <<"EOT"; -/* pango-script-table.h: Generated by gen-script-table.pl - * - * Date: $date - * Source: $file - * - * Do not edit. - */ - -EOT - -$easy_range = 0x2000; - -print <<"EOT"; -static const guchar pango_script_easy_table[$easy_range] = { -EOT - -$i = 0; -$end = -1; - -for (my $c = 0; $c < $easy_range; $c++) { - - if ($c % 3 == 0) { - printf "\n "; - } - - if ($c > $end) { - $start = $ranges[$i]->[0]; - $end = $ranges[$i]->[1]; - $script = $ranges[$i]->[2]; - $i++; - } - - if ($c < $start) { - printf " PANGO_SCRIPT_UNKNOWN,"; - } else { - printf " PANGO_SCRIPT_%s,", $script; - } -} - -if ($end >= $easy_range) { - $i--; - $ranges[$i]->[0] = $easy_range; -} - - -print <<"EOT"; - -}; - -static const struct { - gunichar start; - guint16 chars; - guint16 script; -} pango_script_table[] = { -EOT - -for (; $i <= $#ranges; $i++) { - $start = $ranges[$i]->[0]; - $end = $ranges[$i]->[1]; - $script = $ranges[$i]->[2]; - - while ($i <= $#ranges - 1 && - $ranges[$i + 1]->[0] == $end + 1 && - $ranges[$i + 1]->[2] eq $script) { - $i++; - $end = $ranges[$i]->[1]; - } - - printf " { %#06x, %5d, PANGO_SCRIPT_%s },\n", $start, $end - $start + 1, $script; -} - -printf "};\n"; - |