diff options
author | Jonathan Kew <jfkthame@googlemail.com> | 2007-11-21 12:29:46 +0000 |
---|---|---|
committer | Jonathan Kew <jfkthame@googlemail.com> | 2007-11-21 12:29:46 +0000 |
commit | 952d69f85d43b087ce9fa79d3fc6f1c076000bc7 (patch) | |
tree | dd6937a6486e80e1638618308481075efab000ae /Build/source/libs/icu-xetex/layout/MakeShapingTypeData.pl | |
parent | 888236cb9df7b7d7b5a3e2d784037a9a59511c53 (diff) |
updated icu-xetex library for XeTeX 0.997
git-svn-id: svn://tug.org/texlive/trunk@5536 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/icu-xetex/layout/MakeShapingTypeData.pl')
-rw-r--r-- | Build/source/libs/icu-xetex/layout/MakeShapingTypeData.pl | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/Build/source/libs/icu-xetex/layout/MakeShapingTypeData.pl b/Build/source/libs/icu-xetex/layout/MakeShapingTypeData.pl new file mode 100644 index 00000000000..4062b403170 --- /dev/null +++ b/Build/source/libs/icu-xetex/layout/MakeShapingTypeData.pl @@ -0,0 +1,90 @@ +#! /usr/bin/perl + +# script to create ShapingTypeData.cpp from UCD file DerivedJoiningType.txt +# written by JK, 2007-01-16 +# This script may be distributed and used freely + +%types = ( + 'C' => 1, + 'D' => 2, + 'R' => 4, + 'T' => 5 +); + +@ranges = (); + +sub addRange +{ + my ($s, $e, $t) = @_; + + if ((scalar @ranges > 0) + && ($ranges[$#ranges]->[2] == $t) + && ($ranges[$#ranges]->[1] == $s - 1)) { + $ranges[$#ranges]->[1] = $e; + return; + } + + push @ranges, [ $s, $e, $t ]; +} + +# read the DerivedJoiningType.txt file and remember all the ranges +while (<>) { + if (m/^([0-9A-F]{4})\s+; ([CDRT]) \#/) { + # single codepoint + $start = hex $1; + $end = $start; + $type = $types{$2}; + addRange($start, $end, $type); + next; + } + if (m/^([0-9A-F]{4})\.\.([0-9A-F]{4})\s+; ([CDRT]) \#/) { + # range of codes + $start = hex $1; + $end = hex $2; + $type = $types{$3}; + addRange($start, $end, $type); + next; + } +} + +# write the ShapingTypeData.cpp file + +$date = `date +"%F %T %Z"`; +print <<__EOT__; +/* + * + * (C) Copyright SIL International. 2007. + * (C) Copyright IBM Corp. 1998-2005. + * Based on code distributed with ICU 3.6 + * and the Unicode Character Database, version 5.0.0 + * + * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS + * YOU REALLY KNOW WHAT YOU'RE DOING. + * + * Generated on: $date + */ + +#include "LETypes.h" +#include "ArabicShaping.h" + +U_NAMESPACE_BEGIN + +const le_uint8 ArabicShaping::shapingTypeTable[] = { +__EOT__ + +printf " 0x%02X, 0x%02X, /* classFormat */\n", 0, 2; +printf " 0x%02X, 0x%02X, /* classRangeCount */\n", + (scalar @ranges) / 256, (scalar @ranges) % 256; +print join(",\n", map { + sprintf " 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X", + $_->[0] / 256, $_->[0] % 256, + $_->[1] / 256, $_->[1] % 256, + $_->[2] / 256, $_->[2] % 256, + } sort { $a->[0] <=> $b->[0] } @ranges); + +print <<__EOT__; + +}; + +U_NAMESPACE_END +__EOT__ |