summaryrefslogtreecommitdiffstats
path: root/util/unicode/x11
diff options
context:
space:
mode:
Diffstat (limited to 'util/unicode/x11')
-rw-r--r--util/unicode/x11/encodings.in71
-rwxr-xr-xutil/unicode/x11/makeencodings135
2 files changed, 206 insertions, 0 deletions
diff --git a/util/unicode/x11/encodings.in b/util/unicode/x11/encodings.in
new file mode 100644
index 0000000000..f1578784be
--- /dev/null
+++ b/util/unicode/x11/encodings.in
@@ -0,0 +1,71 @@
+# This file contains the mapping of xlfds to mib enum (used to convert
+# unicode to the xlfd encoding) and the QFontDatabase::WritingSystem's
+# they support the format is 'xlfd mib script,...'
+#
+# Latin
+iso8859-1 4 Latin
+iso8859-2 5 Latin
+iso8859-3 6 Latin
+iso8859-4 7 Latin
+iso8859-9 12 Latin
+iso8859-10 13 Latin
+iso8859-13 109 Latin
+iso8859-14 110 Latin
+iso8859-15 111 Latin
+hp-roman8 2004 Latin
+#
+# Cyrillic
+iso8859-5 8 Cyrillic
+*-cp1251 2251 Cyrillic
+koi8-ru 2084 Cyrillic
+koi8-u 2088 Cyrillic
+koi8-r 2084 Cyrillic
+#
+# Greek
+iso8859-7 10 Greek
+#
+#
+# Hebrew
+iso8859-8 85 Hebrew
+#
+# China, Mainland
+gb18030-0 -114 SimplifiedChinese
+gb18030.2000-0 -113 SimplifiedChinese
+gbk-0 -113 SimplifiedChinese
+gb2312.*-0 57 SimplifiedChinese
+#
+# Japan
+jisx0201*-0 15 Japanese
+jisx0208*-0 63 Japanese
+#
+# Korea
+ksc5601*-* 36 Korean
+#
+# Hong Kong
+big5hkscs-0 -2101 TraditionalChinese
+hkscs-1 -2101 TraditionalChinese
+#
+# Taiwan
+big5*-* -2026 TraditionalChinese
+#
+# Tamil
+tscii-* 2028 Tamil
+#
+# Thai
+tis620*-* 2259 Thai
+iso8859-11 2259 Thai
+#
+# Lao
+mulelao-1 -4242 Lao
+#
+# Ethiopic
+ethiopic-unicode 0 Other
+#
+# Unicode
+iso10646-1 0 Latin,Greek,Cyrillic,Armenian,Hebrew,Arabic,Thai,Lao,Tibetan,Georgian,SimplifiedChinese,TraditionalChinese, Japanese,Korean,Vietnamese,Yi,Tagalog,Hanunoo,Buhid,Tagbanwa,Limbu,TaiLe,Braille,Other
+unicode-* 0 Latin,Greek,Cyrillic,Armenian,Hebrew,Arabic,Thai,Lao,Tibetan,Georgian,SimplifiedChinese,TraditionalChinese, Japanese,Korean,Vietnamese,Yi,Tagalog,Hanunoo,Buhid,Tagbanwa,Limbu,TaiLe,Braille,Other
+#
+# Other
+*-symbol 0 Other
+*-fontspecific 0 Other
+fontspecific-* 0 Other
diff --git a/util/unicode/x11/makeencodings b/util/unicode/x11/makeencodings
new file mode 100755
index 0000000000..841fc404ab
--- /dev/null
+++ b/util/unicode/x11/makeencodings
@@ -0,0 +1,135 @@
+#!/usr/bin/perl
+
+use strict;
+
+open IN, "encodings.in"
+ or die "Can't open in\n";
+open out, ">encodings.c"
+ or die "Can't open out\n";
+
+my @qwritingSystems = (
+ "Any",
+ "Latin",
+ "Greek",
+ "Cyrillic",
+ "Armenian",
+ "Hebrew",
+ "Arabic",
+ "Syriac",
+ "Thaana",
+ "Devanagari",
+ "Bengali",
+ "Gurmukhi",
+ "Gujarati",
+ "Oriya",
+ "Tamil",
+ "Telugu",
+ "Kannada",
+ "Malayalam",
+ "Sinhala",
+ "Thai",
+ "Lao",
+ "Tibetan",
+ "Myanmar",
+ "Georgian",
+ "Khmer",
+ "SimplifiedChinese",
+ "TraditionalChinese",
+ "Japanese",
+ "Korean",
+ "Vietnamese",
+ "Yi",
+ "Tagalog",
+ "Hanunoo",
+ "Buhid",
+ "Tagbanwa",
+ "Limbu",
+ "TaiLe",
+ "Braille",
+ "Other"
+);
+
+my $writingSystemsCount = @qwritingSystems;
+
+my $num = 0;
+my @xlfd = ();
+my @mib = ();
+my @writingSystems = ();
+
+my $i;
+
+while (<IN>) {
+ chomp;
+ s/#.*//;
+ if ( index( $_, ' ' ) > -1 ) {
+ chomp;
+ my @line = split( / /, $_ );
+ $xlfd[$num] = $line[0];
+ $mib[$num] = $line[1];
+ $writingSystems[$num] = $line[2];
+
+ $num = $num + 1;
+ }
+
+}
+
+print out "#define make_tag( c1, c2, c3, c4 ) \\\n";
+print out " ((((unsigned int)c1)<<24) | (((unsigned int)c2)<<16) | \\\n";
+print out " (((unsigned int)c3)<<8) | ((unsigned int)c4))\n\n";
+
+print out "struct XlfdEncoding {\n const char *name;\n int id;\n";
+print out " int mib;\n unsigned int hash1;\n unsigned int hash2;\n};\n\n";
+
+print out "static const XlfdEncoding xlfd_encoding[] = {\n";
+$i = 0;
+while( $i < $num ) {
+ my $x = $xlfd[$i];
+ my $hash1 = "make_tag('".substr($x,0,1)."','".substr($x,1,1)."','".substr($x,2,1)."','".substr($x,3,1)."')";
+ if( index( $x, "*" ) > -1 && index( $x, "*" ) < 4 ) {
+ $hash1 = "0";
+ }
+ my $idx = length( $x ) - 4;
+ my $hash2 = "make_tag('".substr($x,$idx,1)."','".substr($x,$idx+1,1)."','".substr($x,$idx+2,1)."','".substr($x,$idx+3,1)."')";
+ if( index( $x, "*", $idx ) > -1 ) {
+ $hash2 = "0";
+ }
+ print out " { \"".$xlfd[$i]."\", ".$i.", ".$mib[$i].
+ ", ".$hash1.", ".$hash2." },\n";
+ $i = $i + 1;
+}
+print out " { 0, 0, 0, 0, 0 }\n};\n\n";
+
+print out "static const char writingSystems_for_xlfd_encoding[".$num."][".$writingSystemsCount.
+"] = { \n";
+$i = 0;
+while( $i < $num ) {
+ my $j = 0;
+ my @s = split( /,/, $writingSystems[$i] );
+ print out " // ".$xlfd[$i]."\n";
+ print out " { ";
+ while( $j < $writingSystemsCount ) {
+ if( grep( /^$qwritingSystems[$j]$/, @s ) ) {
+ print out "1";
+ } else {
+ print out "0";
+ }
+ $j = $j + 1;
+ if ( $j < $writingSystemsCount ) {
+ print out ", ";
+ if ( !(($j) % 10) ) {
+ print out "\n ";
+ }
+ }
+ }
+ $i = $i + 1;
+ if ( $i < $num ) {
+ print out " },\n";
+ } else {
+ print out " }\n";
+ }
+}
+print out "\n};\n\n";
+
+
+
+close out;