1 package Font::TTF::OTTags;
5 Font::TTF::OTTags - Utilities for TrueType/OpenType tags
9 use Font::TTF::OTTags qw( %tttags %ttnames readtagsfile );
11 # Look at built-in stuff:
12 $script_tag = $tttags{'SCRIPT'}{'Cypriot Syllabary'};
13 $lang_name = $ttnames{'LANGUAGE'}{'AFK '}
15 # Read latest tags file to add to built-in definitions
16 readtagsfile ("C:\\Program Files\\Microsoft VOLT\\TAGS.txt");
18 First-level keys to %tttags and %ttnames are:
22 'SCRIPT' -- retrieve script tag or name
24 'LANGUAGE' -- retrieve language tag or name
26 'FEATURE' -- retrieve feature tag or name
30 Built-in data has been derived from Microsoft's tag registry at
31 L<http://www.microsoft.com/typography/otspec/ttoreg.htm>,
32 updated to draft v1.5 of the OpenType Spec.
39 use vars qw( %tttags %ttnames @EXPORT_OK @ISA );
41 @ISA = qw( Exporter );
42 @EXPORT_OK = qw( %tttags %ttnames readtagsfile);
47 # All data below derived from VOLT 1.3 TAGS.txt file.
48 # For conveninence of human checking, these are now sorted alphabetically.
54 "Bengali v.2" => "bng2",
60 "Byzantine Music" => "byzm",
61 "CJK Ideographic" => "hani",
62 "Canadian Syllabics" => "cans",
67 "Cypriot Syllabary" => "cprt",
71 "Devanagari v.2" => "dev2",
72 "Devanagari" => "deva",
75 "Glagolitic" => "glag",
78 "Gujarati v.2" => "gjr2",
80 "Gurmukhi v.2" => "gur2",
82 "Hangul Jamo" => "jamo",
88 "Kannada v.2" => "knd2",
92 "Kharosthi" => "khar",
101 "Malayalam v.2" => "mlm2",
102 "Malayalam" => "mlym",
103 "Mathematical Alphanumeric Symbols" => "math",
104 "Mongolian" => "mong",
105 "Musical Symbols" => "musc",
108 "New Tai Lue" => "talu",
110 "Ol Chiki" => "olck",
111 "Old Italic" => "ital",
112 "Old Persian Cuneiform" => "xpeo",
113 "Oriya v.2" => "ory2",
116 "Phags-pa" => "phag",
117 "Phoenician" => "phnx",
120 "Saurashtra" => "saur",
123 "Sumero-Akkadian Cuneiform" => "xsux",
124 "Sundanese" => "sund",
125 "Syloti Nagri" => "sylo",
128 "Tagbanwa" => "tagb",
130 "Tamil v.2" => "tml2",
132 "Telugu v.2" => "tel2",
137 "Tifinagh" => "tfng",
138 "Ugaritic Cuneiform" => "ugar",
146 "Abkhazian" => "ABK ",
149 "Afrikaans" => "AFK ",
151 "Albanian" => "SQI ",
152 "Alsatian" => "ALS ",
156 "Arakanese" => "ARK ",
157 "Armenian" => "HYE ",
158 "Assamese" => "ASM ",
159 "Athapaskan" => "ATH ",
165 "Baghelkhandi" => "BAG ",
171 "Bamileke" => "BML ",
175 "Belarussian" => "BEL ",
182 "Bhojpuri" => "BHO ",
183 "Bible Cree" => "BCR ",
186 "Blackfoot" => "BKF ",
189 "Braj Bhasha" => "BRI ",
191 "Bulgarian" => "BGR ",
196 "Chaha Gurage" => "CHG ",
197 "Chattisgarhi" => "CHH ",
199 "Cherokee" => "CHR ",
200 "Chichewa" => "CHI ",
202 "Chinese Hong Kong" => "ZHH ",
203 "Chinese Phonetic" => "ZHP ",
204 "Chinese Simplified" => "ZHS ",
205 "Chinese Traditional" => "ZHT ",
206 "Chipewyan" => "CHP ",
208 "Church Slavonic" => "CSL ",
210 "Comorian" => "CMR ",
212 "Corsican" => "COS ",
214 "Crimean Tatar" => "CRT ",
215 "Croatian" => "HRV ",
222 "Dhivehi (OBSOLETE)" => "DHV ",
229 "Dzongkha" => "DZN ",
230 "Eastern Cree" => "ECR ",
236 "Esperanto" => "NTO ",
237 "Estonian" => "ETI ",
244 "Filipino" => "PIL ",
248 "Forest Nenets" => "FNE ",
249 "French Antillean" => "FAN ",
252 "Friulian" => "FRL ",
258 "Galician" => "GAL ",
259 "Garhwali" => "GAW ",
261 "Garshuni" => "GAR ",
263 "Georgian" => "KAT ",
268 "Greenlandic" => "GRN ",
270 "Gujarati" => "GUJ ",
274 "Hammer-Banna" => "HBN ",
280 "High Mari" => "HMA ",
281 "Hiligaynon" => "HIL ",
285 "Hungarian" => "HUN ",
286 "Icelandic" => "ISL ",
290 "Inari Sami" => "ISM ",
291 "Indonesian" => "IND ",
293 "Inuktitut" => "INU ",
294 "Irish Traditional" => "IRT ",
297 "Japanese" => "JAN ",
298 "Javanese" => "JAV ",
301 "Kabardian" => "KAB ",
303 "Kalenjin" => "KAL ",
308 "Karachay" => "KAR ",
310 "Karakalpak" => "KRK ",
311 "Karelian" => "KRL ",
313 "Kashmiri" => "KSH ",
317 "Khanty-Kazim" => "KHK ",
318 "Khanty-Shurishkar" => "KHS ",
319 "Khanty-Vakhi" => "KHV ",
323 "Khutsuri Georgian" => "KGE ",
326 "Kildin Sami" => "KSM ",
331 "Komi-Permyak" => "KOP ",
332 "Komi-Zyrian" => "KOZ ",
337 "Korean Old Hangul" => "KOH ",
362 "Lithuanian" => "LTH ",
364 "Low Mari" => "LMA ",
365 "Lower Sorbian" => "LSB ",
369 "Lule Sami" => "LSM ",
371 "Luxembourgish" => "LTZ ",
372 "Macedonian" => "MKD ",
373 "Maithili" => "MTH ",
376 "Malagasy" => "MLG ",
378 "Malayalam Reformed" => "MLR ",
379 "Malayalam Traditional" => "MAL ",
384 "Mandinka" => "MND ",
386 "Manipuri" => "MNI ",
388 "Manx Gaelic" => "MNX ",
390 "Mapudungun" => "MAP ",
399 "Moldavian" => "MOL ",
401 "Mongolian" => "MNG ",
402 "Moose Cree" => "MCR ",
403 "Moroccan" => "MOR ",
407 "Naga-Assamese" => "NAG ",
419 "Northern Sami" => "NSM ",
420 "Northern Tai" => "NTA ",
421 "Norway House Cree" => "NHC ",
422 "Norwegian" => "NOR ",
425 "Oji-Cree" => "OCR ",
429 "Ossetian" => "OSS ",
431 "Palestinian Aramaic" => "PAA ",
436 "Polytonic Greek" => "PGR ",
437 "Portuguese" => "PTG ",
438 "Provencal" => "PRO ",
441 "Rajasthani" => "RAJ ",
442 "Rhaeto-Romanic" => "RMS ",
444 "Romanian" => "ROM ",
447 "Russian Buriat" => "RBU ",
453 "Sanskrit" => "SAN ",
465 "Silte Gurage" => "SIG ",
467 "Sinhalese" => "SNH ",
468 "Skolt Sami" => "SKS ",
471 "Slovenian" => "SLV ",
472 "Sodo Gurage" => "SOG ",
476 "South Slavey" => "SSL ",
477 "Southern Sami" => "SSM ",
482 "Swadaya Aramaic" => "SWA ",
488 "Tabasaran" => "TAB ",
489 "Tahitian" => "THT ",
499 "Tigrinya" => "TGY ",
506 "Tundra Nenets" => "TNE ",
509 "Turoyo Aramaic" => "TUA ",
513 "Ukrainian" => "UKR ",
514 "Upper Sorbian" => "USB ",
519 "Vietnamese" => "VIT ",
523 "West-Cree" => "WCR ",
525 "Woods Cree" => "DCR ",
529 "Yi Classic" => "YIC ",
530 "Yi Modern" => "YIM ",
538 "Above-Base Forms" => "abvf",
539 "Above-Base Mark Positioning" => "abvm",
540 "Above-Base Substitutions" => "abvs",
541 "Access All Alternates" => "aalt",
543 "Alternate Annotation Forms" => "nalt",
544 "Alternate Half Widths" => "halt",
545 "Alternate Vertical Half Metrics" => "vhal",
546 "Alternate Vertical Metrics" => "valt",
547 "Alternative Fractions" => "afrc",
548 "Below-Base Forms" => "blwf",
549 "Below-Base Mark Positioning" => "blwm",
550 "Below-Base Substitutions" => "blws",
551 "Capital Spacing" => "cpsp",
552 "Case-Sensitive Forms" => "case",
553 "Centered CJK Punctuation" => "cpct",
554 "Conjunct Forms After Ro" => "cfar",
555 "Conjunct Forms" => "cjct",
556 "Contextual Alternates" => "calt",
557 "Contextual Ligatures" => "clig",
558 "Contextual Swash" => "cswh",
559 "Cursive Positioning" => "curs",
560 "Default Processing" => "dflt",
561 "Denominators" => "dnom",
562 "Diphthongs (OBSOLETE)" => "dpng",
563 "Discretionary Ligatures" => "dlig",
564 "Distances" => "dist",
565 "Expert Forms" => "expt",
566 "Final Glyph On Line Alternates" => "falt",
567 "Fractions" => "frac",
568 "Full Widths" => "fwid",
569 "Glyph Composition/Decomposition" => "ccmp",
570 "Halant Forms" => "haln",
571 "Half Forms" => "half",
572 "Half Widths" => "hwid",
574 "Historical Forms" => "hist",
575 "Historical Ligatures" => "hlig",
576 "Hojo (JIS X 0212-1990) Kanji Forms" => "hojo",
577 "Horizontal Kana Alternates" => "hkna",
578 "Initial Forms" => "init",
579 "Isolated Forms" => "isol",
581 "JIS2004 Forms" => "jp04",
582 "JIS78 Forms" => "jp78",
583 "JIS83 Forms" => "jp83",
584 "JIS90 Forms" => "jp90",
585 "Justification Alternates" => "jalt",
587 "Leading Jamo Forms" => "ljmo",
588 "Left Bounds" => "lfbd",
589 "Lining Figures" => "lnum",
590 "Localized Forms" => "locl",
591 "Mark Positioning via Substitution" => "mset",
592 "Mark Positioning" => "mark",
593 "Mark to Mark Positioning" => "mkmk",
594 "Mathematical Greek" => "mgrk",
595 "Medial Forms #2" => "med2",
596 "Medial Forms" => "medi",
597 "NLC Kanji Forms" => "nlck",
598 "Nukta Forms" => "nukt",
599 "Numerators" => "numr",
600 "Oldstyle Figures" => "onum",
601 "Optical Bounds" => "opbd",
602 "Optical Size" => "size",
603 "Ordinals" => "ordn",
604 "Ornaments" => "ornm",
605 "Petite Capitals From Capitals" => "c2pc",
606 "Petite Capitals" => "pcap",
607 "Post-base Forms" => "pstf",
608 "Post-base Substitutions" => "psts",
609 "Pre-base Forms" => "pref",
610 "Pre-base Substitutions" => "pres",
611 "Proportional Alternate Vertical Metrics" => "vpal",
612 "Proportional Alternate Widths" => "palt",
613 "Proportional Figures" => "pnum",
614 "Proportional Kana" => "pkna",
615 "Proportional Widths" => "pwid",
616 "Quarter Widths" => "qwid",
617 "Rakar Forms" => "rkrf",
618 "Randomize" => "rand",
619 "Reph Forms" => "rphf",
620 "Required Ligatures" => "rlig",
621 "Right Bounds" => "rtbd",
622 "Right-To-Left Alternates" => "rtla",
623 "Ruby Notation Forms" => "ruby",
624 "Scientific Inferiors" => "sinf",
625 "Simplified Forms" => "smpl",
626 "Slashed Zero" => "zero",
627 "Small Capitals From Capitals" => "c2sc",
628 "Small Capitals" => "smcp",
629 "Standard Ligatures" => "liga",
630 "Stylistic Alternates" => "salt",
631 "Stylistic Set 1" => "ss01",
632 "Stylistic Set 10" => "ss10",
633 "Stylistic Set 11" => "ss11",
634 "Stylistic Set 12" => "ss12",
635 "Stylistic Set 13" => "ss13",
636 "Stylistic Set 14" => "ss14",
637 "Stylistic Set 15" => "ss15",
638 "Stylistic Set 16" => "ss16",
639 "Stylistic Set 17" => "ss17",
640 "Stylistic Set 18" => "ss18",
641 "Stylistic Set 19" => "ss19",
642 "Stylistic Set 2" => "ss02",
643 "Stylistic Set 20" => "ss20",
644 "Stylistic Set 3" => "ss03",
645 "Stylistic Set 4" => "ss04",
646 "Stylistic Set 5" => "ss05",
647 "Stylistic Set 6" => "ss06",
648 "Stylistic Set 7" => "ss07",
649 "Stylistic Set 8" => "ss08",
650 "Stylistic Set 9" => "ss09",
651 "Subscript" => "subs",
652 "Superscript" => "sups",
654 "Tabular Figures" => "tnum",
655 "Terminal Forms #2" => "fin2",
656 "Terminal Forms #3" => "fin3",
657 "Terminal Forms" => "fina",
658 "Third Widths" => "twid",
660 "Traditional Forms" => "trad",
661 "Traditional Name Forms" => "tnam",
662 "Trailing Jamo Forms" => "tjmo",
664 "Vattu Variants" => "vatu",
665 "Vertical Alternates and Rotation" => "vrt2",
666 "Vertical Kana Alternates" => "vkna",
667 "Vertical Kerning" => "vkrn",
668 "Vertical Writing" => "vert",
669 "Vowel Jamo Forms" => "vjmo",
674 foreach my $s (qw ( SCRIPT LANGUAGE FEATURE ) )
676 map { $ttnames{$s}{$tttags{$s}{$_}} = $_ } keys %{$tttags{$s}};
681 =head2 readtagsfile ( filename )
683 Read a file in the syntax of Tags.txt (included with Microsoft VOLT) to obtain additional/replacement tag definitions.
685 Returns 0 if can't open the file; else 1.
692 open (TAGS, $fname) or return 0;
693 my ($what, $name, $tag);
696 ($what, $name, $tag) = (m/"([^"]*)", "([^"]*)", "([^"]*)"/); #"
697 $ttnames{$what}{$tag} = $name;
698 $tttags{$what}{$name} = $tag;