| 1 |
% This file shows various usage of this parser |
| 2 |
|
| 3 |
\input luaotfload.sty % otf font loader |
| 4 |
\input kanaparser % load the parser package |
| 5 |
|
| 6 |
\font\jp = ipagp % ipagp.otf font is included in the ipafont font package: https://www.internationalphoneticassociation.org/content/ipa-fonts |
| 7 |
|
| 8 |
\parserInit % initialize kana parser |
| 9 |
|
| 10 |
% wrapper macros that change font automatically |
| 11 |
\def\jchar#1{{\jp #1}} |
| 12 |
\def\kpth#1{\jchar{\toHiragana{#1}}} |
| 13 |
\def\kptk#1{\jchar{\toKatakana{#1}}} |
| 14 |
\def\kptl#1{\jchar{\toLatin{#1}}} |
| 15 |
|
| 16 |
Example of transliteration to Latin: \kptl{しゅんかしゅうとう しし} |
| 17 |
|
| 18 |
Example of transliteration to katakana featuring prolongation dashes: \kptk{しゅんかしゅうとう しし} |
| 19 |
|
| 20 |
Example of transliteration to hiragana converting prolongation dashes: \kpth{シュンカシュートー} |
| 21 |
|
| 22 |
Example of transliteration of multiple-form syllables to hiragana using default settings: \kpth{jiji wewe} |
| 23 |
|
| 24 |
\toggleChars{ji we} % toggles the kana representation of 'ji' and 'we' syllables |
| 25 |
Example of transliteration of multiple-form syllables to hiragana using alternate settings: \kpth{jiji wewe} |
| 26 |
|
| 27 |
Mixed example of transliteration to katakana: \kptk{shunkashuutouuuxxxxxchou} |
| 28 |
|
| 29 |
Example of default transliteration to hiragana using ambiguous syllables after n: \kpth{renyoukei} |
| 30 |
|
| 31 |
Example of isolated n-character to resolve ambiguity: \kpth{ren'youkkei} |
| 32 |
|
| 33 |
Example of hiragana to Latin transliteration from previous example: \kptl{れんようけい} |
| 34 |
|
| 35 |
Example of consonant gemination from hiragana to Latin: \kptl{にっぽん} |
| 36 |
|
| 37 |
Example of consonant gemination from Latin to hiragana: \kpth{nippon} |
| 38 |
|
| 39 |
Example of character preservation: \kptl{when transLating to Latin, ' and " are preserved} |
| 40 |
|
| 41 |
Example of character preservation 2: \kptl{\kpth{when transLating to kana, ' is consumed, " is preserved}} |
| 42 |
|
| 43 |
\bye |