summaryrefslogtreecommitdiffstats
path: root/third_party/harfbuzz/contrib/tables/combining-class-parse.py
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-07 00:44:49 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-07 00:44:49 +0000
commit83f6e08f4c56ef411ad1da5f3bfd4711ec94b052 (patch)
tree6bf8e871963cfc1ab8bf6190dceed5b9631cf8ee /third_party/harfbuzz/contrib/tables/combining-class-parse.py
parentd5c0e0e416a67e7e8dd98745cdf1bdc7de20517c (diff)
downloadchromium_src-83f6e08f4c56ef411ad1da5f3bfd4711ec94b052.zip
chromium_src-83f6e08f4c56ef411ad1da5f3bfd4711ec94b052.tar.gz
chromium_src-83f6e08f4c56ef411ad1da5f3bfd4711ec94b052.tar.bz2
Add Harfbuzz to third_party and Skia support for such.
Harfbuzz is an open source library which is a unification of the Qt and Pango shaping engines. We'll be using it on Chromium Linux to perform complex text shaping. Additionally, we add support for Harfbuzz into Skia, guarded by SKIA_HARFBUZZ. http://codereview.chromium.org/63035/show git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13214 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/harfbuzz/contrib/tables/combining-class-parse.py')
-rw-r--r--third_party/harfbuzz/contrib/tables/combining-class-parse.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/third_party/harfbuzz/contrib/tables/combining-class-parse.py b/third_party/harfbuzz/contrib/tables/combining-class-parse.py
new file mode 100644
index 0000000..c591ddd
--- /dev/null
+++ b/third_party/harfbuzz/contrib/tables/combining-class-parse.py
@@ -0,0 +1,34 @@
+import sys
+from unicode_parse_common import *
+
+# http://www.unicode.org/Public/5.1.0/ucd/extracted/DerivedCombiningClass.txt
+
+class IdentityMap(object):
+ def __getitem__(_, key):
+ return key
+
+def main(infile, outfile):
+ ranges = unicode_file_parse(infile, IdentityMap(), '0')
+ ranges = sort_and_merge(ranges)
+
+ print >>outfile, '// Generated from Unicode tables\n'
+ print >>outfile, '#ifndef COMBINING_PROPERTIES_H_'
+ print >>outfile, '#define COMBINING_PROPERTIES_H_\n'
+ print >>outfile, '#include <stdint.h>'
+ print >>outfile, 'struct combining_property {'
+ print >>outfile, ' uint32_t range_start;'
+ print >>outfile, ' uint32_t range_end;'
+ print >>outfile, ' uint8_t klass;'
+ print >>outfile, '};\n'
+ print >>outfile, 'static const struct combining_property combining_properties[] = {'
+ for (start, end, value) in ranges:
+ print >>outfile, ' {0x%x, 0x%x, %s},' % (start, end, value)
+ print >>outfile, '};\n'
+ print >>outfile, 'static const unsigned combining_properties_count = %d;\n' % len(ranges)
+ print >>outfile, '#endif // COMBINING_PROPERTIES_H_'
+
+if __name__ == '__main__':
+ if len(sys.argv) != 3:
+ print 'Usage: %s <input .txt> <output .h>' % sys.argv[0]
+ else:
+ main(file(sys.argv[1], 'r'), file(sys.argv[2], 'w+'))