summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-09-25 23:04:51 +0000
committerKarl Berry <karl@freefriends.org>2012-09-25 23:04:51 +0000
commiteb411ed661c178e451eb3dd55d6ee8bc154c1265 (patch)
tree4658020be8d565c5639dd20164c5d9e83ac454da /Master/texmf-dist/tex/xelatex
parentbfe53688ab950cd41271c259a29df8dd5eff29cd (diff)
new-to-TL xelatex package ucharclasses (25sep12)
git-svn-id: svn://tug.org/texlive/trunk@27811 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex')
-rw-r--r--Master/texmf-dist/tex/xelatex/ucharclasses/ucharclasses.sty719
1 files changed, 719 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/xelatex/ucharclasses/ucharclasses.sty b/Master/texmf-dist/tex/xelatex/ucharclasses/ucharclasses.sty
new file mode 100644
index 00000000000..1617916da32
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/ucharclasses/ucharclasses.sty
@@ -0,0 +1,719 @@
+% ----------------------------------------------------------------------------
+% This "ucharclasses" package sets up XeTeX character classes based on which
+% unicode block a character is found in. It then allows transition rules to be defined
+% when entering or leaving particular unicode blocks, the code of which gets inserted
+% automatically when a transition from a character from one unicode block to a
+% character from another unicode block is encountered by XeTeX
+%
+% Current compatibility should be Unicode 6.0, although I may have missed one or
+% more blocks that were added between 5 and 6.
+%
+% License: public domain (http://www.tex.ac.uk/CTAN/help/Catalogue/licenses.pd.html)
+% ----------------------------------------------------------------------------
+
+\ProvidesPackage{ucharclasses}[2012/09/25 v2.0x Unicode block
+ character classes for XeLaTeX]
+
+\newif\if@ucharclassverbose
+\DeclareOption{verbose}{\@ucharclassverbosetrue}
+
+% ----------------------------------------------------------------------------
+% The package options allow you to selectively enable certain unicode blocks
+% ----------------------------------------------------------------------------
+
+% We first define all blocks in a list together with their start and
+% end point
+
+\def\AllClasses{
+% Unicode 5.1 block definitions
+ \do{AegeanNumbers}{65792}{65855}
+ \do{AlphabeticPresentationForms}{64256}{64335}
+ \do{AncientGreekMusicalNotation}{119296}{119375}
+ \do{AncientGreekNumbers}{65856}{65935}
+ \do{AncientSymbols}{65936}{65999}
+ \do{Arabic}{1536}{1791}
+ \do{ArabicPresentationFormsA}{64336}{65023}
+ \do{ArabicPresentationFormsB}{65136}{65279}
+ \do{ArabicSupplement}{1872}{1919}
+ \do{Armenian}{1328}{1423}
+ \do{Arrows}{8592}{8703}
+ \do{Balinese}{6912}{7039}
+ \do{BasicLatin}{32}{127}
+ \do{Bengali}{2432}{2559}
+ \do{BlockElements}{9600}{9631}
+ \do{Bopomofo}{12544}{12591}
+ \do{BopomofoExtended}{12704}{12735}
+ \do{BoxDrawing}{9472}{9599}
+ \do{BraillePatterns}{10240}{10495}
+ \do{Buginese}{6656}{6687}
+ \do{Buhid}{5952}{5983}
+ \do{ByzantineMusicalSymbols}{118784}{119039}
+ \do{Carian}{66208}{66271}
+ \do{Cham}{43520}{43615}
+ \do{Cherokee}{5024}{5119}
+ \do{CJKCompatibility}{13056}{13311}
+ \do{CJKCompatibilityForms}{65072}{65103}
+ \do{CJKCompatibilityIdeographs}{63744}{64255}
+ \do{CJKCompatibilityIdeographsSupplement}{194560}{195103}
+ \do{CJKRadicalsSupplement}{11904}{12031}
+ \do{CJKStrokes}{12736}{12783}
+ \do{CJKSymbolsAndPunctuation}{12288}{12351}
+ \do{CJKUnifiedIdeographs}{19968}{40959}
+ \do{CJKUnifiedIdeographsExtensionA}{13312}{19903}
+ \do{CJKUnifiedIdeographsExtensionB}{131072}{173791}
+ \do{CJKUnifiedIdeographsExtensionC}{173824}{177983}
+ \do{CombiningDiacriticalMarks}{768}{879}
+ \do{CombiningDiacriticalMarksforSymbols}{8400}{8447}
+ \do{CombiningDiacriticalMarksSupplement}{7616}{7679}
+ \do{CombiningHalfMarks}{65056}{65071}
+ \do{ControlPictures}{9216}{9279}
+ \do{Coptic}{11392}{11519}
+ \do{CountingRodNumerals}{119648}{119679}
+ \do{Cuneiform}{73728}{74751}
+ \do{CuneiformNumbersAndPunctuation}{74752}{74879}
+ \do{CurrencySymbols}{8352}{8399}
+ \do{CypriotSyllabary}{67584}{67647}
+ \do{Cyrillic}{1024}{1279}
+ \do{CyrillicExtendedA}{11744}{11775}
+ \do{CyrillicExtendedB}{42560}{42655}
+ \do{CyrillicSupplement}{1280}{1327}
+ \do{Deseret}{66560}{66639}
+ \do{Devanagari}{2304}{2431}
+ \do{Dingbats}{9984}{10175}
+ \do{DominoTiles}{127024}{127135}
+ \do{EnclosedAlphanumerics}{9312}{9471}
+ \do{EnclosedCJKLettersAndMonths}{12800}{13055}
+ \do{Ethiopic}{4608}{4991}
+ \do{EthiopicExtended}{11648}{11743}
+ \do{EthiopicSupplement}{4992}{5023}
+ \do{GeneralPunctuation}{8192}{8303}
+ \do{GeometricShapes}{9632}{9727}
+ \do{Georgian}{4256}{4351}
+ \do{GeorgianSupplement}{11520}{11567}
+ \do{Glagolitic}{11264}{11359}
+ \do{Gothic}{66352}{66383}
+ \do{GreekAndCoptic}{880}{1023}
+ \do{GreekExtended}{7936}{8191}
+ \do{Gujarati}{2688}{2815}
+ \do{Gurmukhi}{2560}{2687}
+ \do{HalfwidthAndFullwidthForms}{65280}{65519}
+ \do{HangulCompatibilityJamo}{12592}{12687}
+ \do{HangulJamo}{4352}{4607}
+ \do{HangulSyllables}{44032}{55215}
+ \do{Hanunoo}{5920}{5951}
+ \do{Hebrew}{1424}{1535}
+ \do{Hiragana}{12352}{12447}
+ \do{IdeographicDescriptionCharacters}{12272}{12287}
+ \do{IPAExtensions}{592}{687}
+ \do{Kanbun}{12688}{12703}
+ \do{KangxiRadicals}{12032}{12255}
+ \do{Kannada}{3200}{3327}
+ \do{Katakana}{12448}{12543}
+ \do{KatakanaPhoneticExtensions}{12784}{12799}
+ \do{KayahLi}{43264}{43311}
+ \do{Kharoshthi}{68096}{68191}
+ \do{Khmer}{6016}{6143}
+ \do{KhmerSymbols}{6624}{6655}
+ \do{Lao}{3712}{3839}
+ \do{LatinExtendedAdditional}{7680}{7935}
+ \do{LatinExtendedA}{256}{383}
+ \do{LatinExtendedB}{384}{591}
+ \do{LatinExtendedC}{11360}{11391}
+ \do{LatinExtendedD}{42784}{43007}
+ \do{LatinSupplement}{128}{255}
+ \do{Lepcha}{7168}{7247}
+ \do{LetterlikeSymbols}{8448}{8527}
+ \do{Limbu}{6400}{6479}
+ \do{LinearBIdeograms}{65664}{65791}
+ \do{LinearBSyllabary}{65536}{65663}
+ \do{Lycian}{66176}{66207}
+ \do{Lydian}{67872}{67903}
+ \do{MahjongTiles}{126976}{127023}
+ \do{Malayalam}{3328}{3455}
+ \do{MathematicalAlphanumericSymbols}{119808}{120831}
+ \do{MathematicalOperators}{8704}{8959}
+ \do{MiscellaneousMathematicalSymbolsA}{10176}{10223}
+ \do{MiscellaneousMathematicalSymbolsB}{10624}{10751}
+ \do{MiscellaneousSymbols}{9728}{9983}
+ \do{MiscellaneousSymbolsAndArrows}{11008}{11263}
+ \do{MiscellaneousTechnical}{8960}{9215}
+ \do{ModifierToneLetters}{42752}{42783}
+ \do{Mongolian}{6144}{6319}
+ \do{MusicalSymbols}{119040}{119295}
+ \do{Myanmar}{4096}{4255}
+ \do{NewTaiLue}{6528}{6623}
+ \do{NKo}{1984}{2047}
+ \do{NumberForms}{8528}{8591}
+ \do{Ogham}{5760}{5791}
+ \do{OldChiki}{7248}{7295}
+ \do{OldItalic}{66304}{66351}
+ \do{OldPersian}{66464}{66527}
+ \do{OpticalCharacterRecognition}{9280}{9311}
+ \do{Oriya}{2816}{2943}
+ \do{Osmanya}{66688}{66735}
+ \do{PhagsPa}{43072}{43135}
+ \do{PhaistosDisc}{66000}{66047}
+ \do{Phoenician}{67840}{67871}
+ \do{PhoneticExtensions}{7424}{7551}
+ \do{PhoneticExtensionsSupplement}{7552}{7615}
+ \do{PrivateUseArea}{57344}{63743}
+ \do{Rejang}{43312}{43359}
+ \do{Runic}{5792}{5887}
+ \do{Saurashtra}{43136}{43231}
+ \do{Shavian}{66640}{66687}
+ \do{Sinhala}{3456}{3583}
+ \do{SmallFormVariants}{65104}{65135}
+ \do{SpacingModifierLetters}{688}{767}
+ \do{Specials}{65520}{65535}
+ \do{SuperscriptsAndSubscripts}{8304}{8351}
+ \do{SupplementalArrowsA}{10224}{10239}
+ \do{SupplementalArrowsB}{10496}{10623}
+ \do{SupplementalMathematicalOperators}{10752}{11007}
+ \do{SupplementalPunctuation}{11776}{11903}
+ \do{SupplementaryPrivateUseAreaA}{983040}{1048575}
+ \do{SupplementaryPrivateUseAreaB}{1048576}{1114111}
+ \do{SylotiNagri}{43008}{43055}
+ \do{Syriac}{1792}{1871}
+ \do{Tagalog}{5888}{5919}
+ \do{Tagbanwa}{5984}{6015}
+ \do{Tags}{917504}{917631}
+ \do{TaiLe}{6480}{6527}
+ \do{TaiXuanJingSymbols}{119552}{119647}
+ \do{Tamil}{2944}{3071}
+ \do{Telugu}{3072}{3199}
+ \do{Thaana}{1920}{1983}
+ \do{Thai}{3584}{3711}
+ \do{Tibetan}{3840}{4095}
+ \do{Tifinagh}{11568}{11647}
+ \do{Ugaritic}{66432}{66463}
+ \do{UnifiedCanadianAboriginalSyllabics}{5120}{5759}
+ \do{Vai}{42240}{42559}
+ \do{VariationSelectors}{65024}{65039}
+ \do{VariationSelectorsSupplement}{917760}{917999}
+ \do{VerticalForms}{65040}{65055}
+ \do{YiRadicals}{42128}{42191}
+ \do{YiSyllables}{40960}{42127}
+ \do{YijingHexagramSymbols}{19904}{19967}
+% Unicode 6.0 block definitions
+ \do{Mandaic}{2112}{2143}
+ \do{Batak}{7104}{7167}
+ \do{EthiopicExtendedA}{43776}{43823}
+ \do{Brahmi}{69632}{69759}
+ \do{BamumSupplement}{92160}{92735}
+ \do{KanaSupplement}{110592}{110847}
+ \do{PlayingCards}{127136}{127231}
+ \do{MiscellaneousSymbolsAndPictographs}{127744}{128511}
+ \do{Emoticons}{128512}{128591}
+ \do{TransportAndMapSymbols}{128640}{128767}
+ \do{AlchemicalSymbols}{128768}{128895}
+ \do{CJKUnifiedIdeographsExtensionD}{177984}{178207}
+}
+% ----------------------------------------------------------------------------
+% Option handling lets the user turn off "load all" and selectively enable only those blocks
+% they are interested in
+% ----------------------------------------------------------------------------
+
+% Each option starts with \overrideClassLoading; so any specified
+% option will set |\if@overrideClassLoading| to true; when one has
+% been scanned it's not necessary to set the conditional again. Then
+% for block X we let \enableX to \@empty so that later on we can check
+% if it is defined
+
+\newif\if@overrideClassLoading
+\newcommand{\overrideClassLoading}{\@overrideClassLoadingtrue
+ \let\overrideClassLoading\relax}
+
+\def\do#1#2#3{\DeclareOption{#1}%
+ {\overrideClassLoading\expandafter\let\csname enable#1\endcsname\@empty}}
+% We execute the list with this definition of \do
+\AllClasses
+
+% informal groups
+% We define lists also for these groups
+
+\def\ClassGroups{
+ \doclass{Arabic}
+ \doclass{Chinese}
+ \doclass{CJK}
+ \doclass{Cyrillic}
+ \doclass{Diacritics}
+ \doclass{Greek}
+ \doclass{Korean}
+ \doclass{Japanese}
+ \doclass{Latin}
+ \doclass{Mathematics}
+ \doclass{Phonetics}
+ \doclass{Punctuation}
+ \doclass{Symbols}
+ \doclass{Yi}
+ \doclass{Other}
+}
+
+\def\ArabicClasses{
+ \do{Arabic}
+ \do{ArabicPresentationFormsA}
+ \do{ArabicPresentationFormsB}
+ \do{ArabicSupplement}
+}
+
+\def\ChineseClasses{
+ \do{Bopomofo}
+ \do{BopomofoExtended}
+ \do{CJKCompatibility}
+ \do{CJKCompatibilityForms}
+ \do{CJKCompatibilityIdeographs}
+ \do{CJKCompatibilityIdeographsSupplement}
+ \do{CJKRadicalsSupplement}
+ \do{CJKStrokes}
+ \do{CJKSymbolsAndPunctuation}
+ \do{CJKUnifiedIdeographs}
+ \do{CJKUnifiedIdeographsExtensionA}
+ \do{CJKUnifiedIdeographsExtensionB}
+ \do{CJKUnifiedIdeographsExtensionC}
+ \do{CJKUnifiedIdeographsExtensionD}
+ \do{EnclosedCJKLettersAndMonths}
+ \do{IdeographicDescriptionCharacters}
+ \do{KangxiRadicals}
+}
+
+\def\CJKClasses{
+ \do{Bopomofo}
+ \do{BopomofoExtended}
+ \do{CJKCompatibility}
+ \do{CJKCompatibilityForms}
+ \do{CJKCompatibilityIdeographs}
+ \do{CJKCompatibilityIdeographsSupplement}
+ \do{CJKRadicalsSupplement}
+ \do{CJKStrokes}
+ \do{CJKSymbolsAndPunctuation}
+ \do{CJKUnifiedIdeographs}
+ \do{CJKUnifiedIdeographsExtensionA}
+ \do{CJKUnifiedIdeographsExtensionB}
+ \do{CJKUnifiedIdeographsExtensionC}
+ \do{CJKUnifiedIdeographsExtensionD}
+ \do{EnclosedCJKLettersAndMonths}
+ \do{HalfwidthAndFullwidthForms}
+ \do{HangulCompatibilityJamo}
+ \do{HangulJamo}
+ \do{HangulSyllables}
+ \do{Hiragana}
+ \do{IdeographicDescriptionCharacters}
+ \do{Kanbun}
+ \do{KangxiRadicals}
+ \do{Katakana}
+ \do{KatakanaPhoneticExtensions}
+ \do{KanaSupplement}
+}
+
+\def\CyrillicClasses{
+ \do{Cyrillic}
+ \do{CyrillicExtendedA}
+ \do{CyrillicExtendedB}
+ \do{CyrillicSupplement}
+}
+
+\def\DiacriticsClasses{
+ \do{CombiningDiacriticalMarks}
+ \do{CombiningDiacriticalMarksforSymbols}
+ \do{CombiningDiacriticalMarksSupplement}
+ \do{CombiningHalfMarks}
+}
+
+\def\GreekClasses{
+ \do{Coptic}
+ \do{GreekAndCoptic}
+ \do{GreekExtended}
+}
+
+\def\KoreanClasses{
+ \do{HangulCompatibilityJamo}
+ \do{HangulJamo}
+ \do{HangulSyllables}
+}
+
+\def\JapaneseClasses{
+ \do{HalfwidthAndFullwidthForms}
+ \do{Hiragana}
+ \do{Kanbun}
+ \do{KangxiRadicals}
+ \do{Katakana}
+ \do{KatakanaPhoneticExtensions}
+ \do{KanaSupplement}
+ \do{CJKUnifiedIdeographs}
+}
+
+\def\LatinClasses{
+ \do{BasicLatin}
+ \do{LatinExtendedAdditional}
+ \do{LatinExtendedA}
+ \do{LatinExtendedB}
+ \do{LatinExtendedC}
+ \do{LatinExtendedD}
+ \do{LatinSupplement}
+ \do{AlphabeticPresentationForms}
+}
+
+\def\MathematicsClasses{
+ \do{MathematicalAlphanumericSymbols}
+ \do{MathematicalOperators}
+ \do{MiscellaneousMathematicalSymbolsA}
+ \do{MiscellaneousMathematicalSymbolsB}
+ \do{SupplementalMathematicalOperators}
+}
+
+\def\PhoneticsClasses{
+ \do{IPAExtensions}
+ \do{PhoneticExtensions}
+ \do{PhoneticExtensionsSupplement}
+}
+
+\def\PunctuationClasses{
+ \do{GeneralPunctuation}
+ \do{SupplementalPunctuation}
+}
+
+\def\SymbolsClasses{
+ \do{Arrows}
+ \do{BoxDrawing}
+ \do{ByzantineMusicalSymbols}
+ \do{ControlPictures}
+ \do{CurrencySymbols}
+ \do{GeometricShapes}
+ \do{LetterlikeSymbols}
+ \do{MiscellaneousSymbols}
+ \do{MiscellaneousSymbolsAndArrows}
+ \do{MiscellaneousTechnical}
+ \do{SupplementalArrowsA}
+ \do{SupplementalArrowsB}
+ \do{VariationSelectors}
+ \do{VariationSelectorsSupplement}
+ \do{MiscellaneousSymbolsAndPictographs}
+ \do{Emoticons}
+ \do{TransportAndMapSymbols}
+ \do{AlchemicalSymbols}
+}
+
+\def\YiClasses{
+ \do{YiRadicals}
+ \do{YiSyllables}
+}
+
+\def\OtherClasses{
+ \do{AegeanNumbers}
+ \do{AncientGreekMusicalNotation}
+ \do{AncientGreekNumbers}
+ \do{Armenian}
+ \do{Balinese}
+ \do{Bengali}
+ \do{BlockElements}
+ \do{BraillePatterns}
+ \do{Buginese}
+ \do{Buhid}
+ \do{Cherokee}
+ \do{Coptic}
+ \do{CountingRodNumerals}
+ \do{Cuneiform}
+ \do{CuneiformNumbersAndPunctuation}
+ \do{CypriotSyllabary}
+ \do{Deseret}
+ \do{Devanagari}
+ \do{Dingbats}
+ \do{DominoTiles}
+ \do{EnclosedAlphanumerics}
+ \do{Ethiopic}
+ \do{EthiopicExtended}
+ \do{EthiopicSupplement}
+ \do{Georgian}
+ \do{GeorgianSupplement}
+ \do{Glagolitic}
+ \do{Gothic}
+ \do{Gujarati}
+ \do{Gurmukhi}
+ \do{Hanunoo}
+ \do{Hebrew}
+ \do{Kannada}
+ \do{Kharoshthi}
+ \do{Khmer}
+ \do{KhmerSymbols}
+ \do{Lao}
+ \do{Limbu}
+ \do{LinearBIdeograms}
+ \do{LinearBSyllabary}
+ \do{MahjongTiles}
+ \do{Malayalam}
+ \do{ModifierToneLetters}
+ \do{Mongolian}
+ \do{MusicalSymbols}
+ \do{Myanmar}
+ \do{NewTaiLue}
+ \do{NKo}
+ \do{NumberForms}
+ \do{Ogham}
+ \do{OldItalic}
+ \do{OldPersian}
+ \do{OpticalCharacterRecognition}
+ \do{Oriya}
+ \do{Osmanya}
+ \do{PhagsPa}
+ \do{Phoenician}
+ \do{PrivateUseArea}
+ \do{Runic}
+ \do{Shavian}
+ \do{Sinhala}
+ \do{SmallFormVariants}
+ \do{SpacingModifierLetters}
+ \do{Specials}
+ \do{SuperscriptsAndSubscripts}
+ \do{SupplementaryPrivateUseAreaA}
+ \do{SupplementaryPrivateUseAreaB}
+ \do{SylotiNagri}
+ \do{Syriac}
+ \do{Tagalog}
+ \do{Tagbanwa}
+ \do{Tags}
+ \do{TaiLe}
+ \do{TaiXuanJingSymbols}
+ \do{Tamil}
+ \do{Telugu}
+ \do{Thaana}
+ \do{Thai}
+ \do{Tibetan}
+ \do{Tifinagh}
+ \do{Ugaritic}
+ \do{UnifiedCanadianAboriginalSyllabics}
+ \do{VerticalForms}
+ \do{YijingHexagramSymbols}
+}
+
+% For each class group Z we define the relative option
+% \DeclareOption{Z}{\overrideClassLoading\enableX1\enableX2...\enableXn}
+% where X1, X2, ..., Xn are the blocks belonging to class Z
+
+\def\do#1{%
+ \unexpanded{\expandafter\let\csname enable#1\endcsname\@empty}}
+\def\doclass#1{%
+ \begingroup\edef\x{\endgroup\noexpand\DeclareOption{#1}{%
+ \noexpand\overrideClassLoading\csname #1Classes\endcsname}}\x}
+\ClassGroups
+
+
+\ProcessOptions\relax
+
+% If no option has been given, \if@overrideClassLoading will still be
+% false, and in this case we enable *all* blocks (again by defining
+% \enableX equal to \@empty for each block X
+
+\if@overrideClassLoading\else
+ \def\do#1#2#3{\expandafter\let\csname enable#1\endcsname\@empty}
+ \AllClasses
+\fi
+
+% ----------------------------------------------------------------------------
+% After dealing with the options, make sure we have the necessary packages available
+% ----------------------------------------------------------------------------
+
+% because this package relies on XeTeX's intercharclass sytem, better require XeTeX
+\RequirePackage{ifxetex}
+\RequireXeTeX
+
+% ----------------------------------------------------------------------------
+% This package heavily exploits XeTeX's intercharclass system!
+% ----------------------------------------------------------------------------
+
+% enable/disable commands
+\newcommand{\disableTransitionRules}{\XeTeXinterchartokenstate = 0}
+\newcommand{\enableTransitionRules}{\XeTeXinterchartokenstate = 1}
+
+% shorthand commands
+\let\uccoff\disableTransitionRules
+\let\uccon\enableTransitionRules
+
+% make sure it's turned on
+\enableTransitionRules
+
+% ----------------------------------------------------------------------------
+% And now, finally, we can start loading all the requested blocks
+% ----------------------------------------------------------------------------
+
+% \message{Package ucharclasses Message: Assigning character classes per
+% Unicode block (this may take a while)}
+
+%% We record the last allocated class before allocating ours;
+%% \newXeTeXintercharclass saves in the counter
+%% \xe@alloc@intercharclass the last allocated class number; initially
+%% it's 3, but some other code might have allocated interchar classes
+%% before loading this package; if \enableX is defined (to \@empty,
+%% but that's irrelevant), an intercharclass is allocated by using the
+%% list \AllClasses; two cases for block X:
+%%
+%% (1) \enableX is defined: then \do{X}{a}{b} will become
+%% \@defineUnicodeClass{X}{a}{b} which in turn will execute
+%% \newXeTeXintercharclass\XClass and start a loop assigning code
+%% points from a to b to this class
+%%
+%% (2) \enableX is not defined: then \do{X}{a}{b} will become
+%% \@gobblethree{X}{a}{b} and so nothing will be performed
+
+\chardef\@classstart=\xe@alloc@intercharclass
+
+\providecommand\@gobblethree[3]{}
+\def\do#1{%
+ \ifcsname enable#1\endcsname
+ \expandafter\@defineUnicodeClass
+ \else
+ \expandafter\@gobblethree
+ \fi{#1}}
+
+\def\@defineUnicodeClass#1#2#3{%
+ \if@ucharclassverbose\typeout{Defining #1 Class}\fi
+ \expandafter\newXeTeXintercharclass\csname #1Class\endcsname
+ \count@=#2
+ \loop
+ \if@ucharclassverbose
+ \typeout{\XeTeXcharclass\number\count@=
+ \expandafter\string\csname #1Class\endcsname}%
+ \fi
+ \XeTeXcharclass\count@=\csname #1Class\endcsname
+ \ifnum\count@<#3
+ \advance\count@\@ne
+ \repeat
+}
+\AllClasses
+
+% finally, we record the end of our charclass range
+\chardef\@classend=\xe@alloc@intercharclass
+
+%%% Our assigned classes go from \@classstart (excluded) to \@classend (included)
+
+% ----------------------------------------------------------------------------
+% Use: \setTransitionsFor{block name}{when entering this block}{when leaving this block}
+% ----------------------------------------------------------------------------
+
+\def\setTransitionsFor#1#2#3{%
+ \ifcsname enable#1\endcsname
+ \count@=\@classstart
+ \loop\ifnum\count@<\@classend
+ \advance\count@\@ne
+ \ifnum\count@=\csname #1Class\endcsname\else
+ \XeTeXinterchartoks\count@ \csname #1Class\endcsname={#2}%
+ \XeTeXinterchartoks\csname #1Class\endcsname \count@={#3}%
+ \fi
+ \repeat
+ \XeTeXinterchartoks\@cclv\csname #1Class\endcsname={#2}%
+ \XeTeXinterchartoks\csname #1Class\endcsname\@cclv={#3}%
+ \else
+ \if@ucharclassverbose
+ \PackageWarningNoLine{ucharclasses}{Class #1\MessageBreak
+ not loaded}%
+ \fi
+ \fi
+}
+
+% ----------------------------------------------------------------------------
+% Use: \setTransitionTo{block name}{what to do when entering this block}
+% ----------------------------------------------------------------------------
+
+\def\setTransitionTo#1#2{%
+ \ifcsname enable#1\endcsname
+ \count@=\@classstart
+ \loop\ifnum\count@<\@classend
+ \advance\count@\@ne
+ \ifnum\count@=\csname #1Class\endcsname\else
+ \XeTeXinterchartoks\count@ \csname #1Class\endcsname={#2}%
+ \fi
+ \repeat
+ \XeTeXinterchartoks\@cclv\csname #1Class\endcsname={#2}%
+ \else
+ \if@ucharclassverbose
+ \PackageWarningNoLine{ucharclasses}{Class #1\MessageBreak
+ not loaded}%
+ \fi
+ \fi
+}
+
+% ----------------------------------------------------------------------------
+% Use: \setTransitionFrom{block name }{what to do when leaving this block}
+% ----------------------------------------------------------------------------
+
+\def\setTransitionFrom#1#2{%
+ \ifcsname enable#1\endcsname
+ \count@=\@classstart
+ \loop\ifnum\count@<\@classend
+ \advance\count@\@ne
+ \ifnum\count@=\csname #1Class\endcsname\else
+ \XeTeXinterchartoks\csname #1Class\endcsname \count@={#2}%
+ \fi
+ \repeat
+ \XeTeXinterchartoks\csname #1Class\endcsname\@cclv={#2}%
+ \else
+ \if@ucharclassverbose
+ \PackageWarningNoLine{ucharclasses}{Class #1\MessageBreak
+ not loaded}%
+ \fi
+ \fi
+}
+
+% ----------------------------------------------------------------------------
+% Informal Block Rules - for these, to/from must always be defined
+%
+% Available informal groups are:
+%
+% - Arabic
+% - Chinese (including bopomofo)
+% - CJK (Chinese/Japanese/Korean)
+% - Cyrillic
+% - Diacritics
+% - Greek
+% - Japanese (it is advised to set CJK first to a catch-all, then set Japanese for specifics)
+% - Korean (=Hangul) (same comment as for Japanese)
+% - Latin
+% - Mathematics
+% - Phonetics
+% - Punctuation
+% - Symbols
+% - Yi
+% - Other (I am not a fan of lump groups. I hope to un-lump most of it)
+%
+% ----------------------------------------------------------------------------
+
+%% For each class group Z we define \setTransitionsForX as
+%% \newcommand\setTransitionsForZ[2]{%
+%% \setTransitionsFor{X1}{#1}{#2}
+%% \setTransitionsFor{X2}{#1}{#2}
+%% ...
+%% \setTransitionsFor{Xn}{#1}{#2}}
+%% where X1, X2, ..., Xn are the blocks in group Z
+
+\def\do#1{\noexpand\setTransitionsFor{#1}{####1}{####2}}
+\def\doclass#1{
+ \begingroup\edef\x{\endgroup
+ \noexpand\newcommand
+ \unexpanded\expandafter{\csname setTransitionsFor#1\endcsname}[2]%
+ {\csname #1Classes\endcsname}}\x}
+\ClassGroups
+
+
+% ----------------------------------------------------------------------------
+%
+% based on the previous informal groups, we can define a catch-all transition command
+%
+% ----------------------------------------------------------------------------
+
+%% The following is equivalent to define
+%% \newcommand{\setDefaultTransitions[2]{
+%% \setTransitionsForArabic{#1}{#2}
+%% ...
+%% \setTransitionsForOther{#1}{#2}}
+
+\def\doclass#1{%
+ \expandafter\noexpand\csname setTransitionsFor#1\endcsname{####1}{####2}}
+\begingroup\edef\x{\endgroup
+ \noexpand\newcommand\noexpand\setDefaultTransitions[2]{%
+ \ClassGroups}}\x
+
+% ----------------------------------------------------------------------------
+
+\let\do\@undefined\let\doclass\@undefined
+\endinput
+%
+% End of file `ucharclasses.sty'. \ No newline at end of file