10

I would like to try to write a minimal XeTeX source that generates a comprehensive UNICODE table, substituting in local fonts as required by the current plane. I made the attached code as an MWE for people wanting to include small snippets of multilingual text, but want to take it further. This will be my first time attempting loops and conditionals, so any guidance appreciated, particularly on recursively populating tabular environments.

(Please note that this is different than this question in that I do not require automatic font substitution. My goal is to produce a comprehensive reference document from which one could extract precisely the minimum XeTeX code required to include this or that glyph in his or her document.)

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[10pt]{article}

% PACKAGES

\usepackage{fontspec}
\usepackage{longtable}

% OPEN DOCUMENT

\begin{document}

% SPECIFY UNICODE FONT

\setmainfont{Arial Unicode MS}

% SPECIFY ADDITIONAL FONTS FOR GLYPHS NOT INCLUDED IN UNICODE FONT

\newfontfamily{\Inuktitut}{Euphemia UCAS}
\newfontfamily{\Khmer}{Khmer MN}
\newfontfamily{\Sinhala}{Sinhala MN}

% BODY

\begin{longtable}{ll}
Afrikaans & My skeertuig is vol palings.\\
Albanian & Automjeti im është plot me ngjala.\\
Arabic (MSA) & حَوّامتي مُمْتِلئة بِأَنْقَلَيْسون\\
Armenian (E) & Իմ օդաթիռը լի է օձաձկերով\\
Armenian (W) & Իմ սաւառնակս օձաձկներով լեցուն է\\
Aromanian & Pãmporea-a mea-i ãmplinã di uhelji.\\
Azeri    & Hoverkraftimin içi ilan balıǧı ilə doludur.\\
Basque & Nire aerolabangailua aingirez beteta dago.\\
Belarusian & Маё судна на паветранай падушцы поўна вуграмі.\\
Bengali & আমার হভারক্রাফ্ট ইল-এ ভর্তি হয়ে গেছে\\
Bhojpuri & हमार मँडराये वाली जहाज सर्पमीनन से भरल ह\\
Breton & Leun gant sili eo ma dourruzer.\\
Bulgarian   & Корабът ми на въздушна възглавница е пълен със змиорки.\\
Catalan & El meu aerolliscador està ple d'anguiles.\\
Cebuano & Puno ug kasili ang akong hoberkrap.\\
Chamorro    & Bula håsuli/åsuli iyo-ku hovercraft.\\
Chinese (Cantonese) & 我隻氣墊船裝滿晒鱔\\
Chinese (Mandarin, Traditional) & 我的氣墊船充滿了鱔魚\\
Chinese (Mandarin, Simplified) & 我的气垫船充满了鳝鱼\\
Chinese (Taiwanese) & 我的氣墊船充滿了鱔魚\\
Cornish & Leun a sylli yw ow skath bargesi.\\
Corsican & U me battellu hè carcu d'anguili.\\
Croatian & Moja je lebdjelica puna jegulja.\\
Czech & Moje vznášedlo je plné úhořů.\\
Danish & Mit luftpudefartøj er fyldt med ål.\\
Dutch & Mijn luchtkussenboot zit vol paling.\\
English & My hovercraft is full of eels.\\
Estonian & Mu hõljuk on angerjaid täis.\\
Faroese & Luftpútufar mítt er (skít)fult í álli!\\
Finnish & Ilmatyynyalukseni on täynnä ankeriaita.\\
French & Mon aéroglisseur est plein d'anguilles.\\
Frisian (N) & Min luftdümpetbüüdj as ful ma äil.\\
Frisian (W) & Myn hoverkreaft is fol fan Eels.\\
Friulian & Il gno hovercraft al è plen di bisats.\\
Galician & O meu aerodeslizador esta cheo de anguías.\\
Georgian & ჩემი ხომალდი საჰაერო ბალიშზე სავსეა გველთევზებით\\
German & Mein Luftkissenfahrzeug ist voller Aale.\\
Greek (Ancient)  & Τὸ πλοῖόν μου τὸ μετεωριζόμενον ἐστι πλῆρες ἐγχελέων\\
Greek (Modern) & Το Χόβερκράφτ μου είναι γεμάτο χέλια\\
Greenlandic & Umiatsiaasara pullattagaq nimerussanik ulikkaarpoq.\\
Hebrew & הרחפת שלי מלאה בצלופחים\\
Hindi    & मेरी मँडराने वाली नाव सर्पमीनों से भरी हैं\\
Hungarian & A légpárnás hajóm tele van angolnákkal.\\
Icelandic & Svifnökkvinn minn er fullur af álum.\\
Indonesian & Hovercraft saya penuh dengan belut.\\
Inuktitut & \Inuktitut ᐅᒥᐊᕐᔫᑉ ᐳᓪᓕᓕᒫᐸᒐ ᑕᑦᑕᕐᓂᖅ ᐊᒻᒪᔭᖅ\\
Irish (Gaelic) & Tá m'árthach foluaineach lán d'eascanna.\\
Italian & Il mio aeroscivolante è pieno di anguille.\\
Japanese & 私のホバークラフトは鰻でいっぱいです.\\
Khmer & \Khmer សុទ្ធតែឣន្ចងពេញទូកហាះយើង ។\\
Korean & 내 호버크라프트는 장어로 가득 차 있어요\\
Lakota Sioux & Iyéčhiŋkiŋyaŋka čha kiŋyáŋ mitȟáwa kiŋ hoká ožúla (yeló)!\\
Latin & Mea navis volitans anguillis plena est.\\
Latvian & Mans transportlīdzeklis uz gaisa spilvena ir pilns ar zušiem.\\
Lithuanian & Mano laivas su oro pagalve pilnas ungurių.\\
Low German & Mien Lüchtpöukaan ist vull von sük aalen.\\
Luxembourgish & Mäi Loftkësseboot ass voller Éilen.\\
Macedonian & Моето летачко возило е полно со јагули.\\
Manx (Gaelic) & Ta my haagh crowal lane dy astan.\\
Māori & Kī tōnu taku waka topaki i te tuna.\\
Malay & Hoverkraf saya penuh dengan belut.\\
Malayalam & എന്‍റെ പറക്കും-പേടകം നിറയെ വ്ളാങ്കുകളാണ്\\
Maltese & Il-hovercraft tiegħi hu mimli sallur.\\
Marathi & माझी होडी मासळयांनी भरली आहे\\
Mongolian & Миний агаарын даралтыг ашиглан хөвөгч усан онгоцийг дүүрэн могой загас юм.\\
Nahuatl & Noehēcatlapalqui cōāmichtēnqui.\\
Ndebele (N) & Isikepe sami sigcwele umzowa.\\
Norwegian & Luftputebåten min er full av ål.\\
Occitan & Mon aerolisador es plen d'anguilas.\\
Oriya & Mo hovercraft re eel bharti hei jaichi.\\
Persian (Farsi) & هاورکرافت من پر مارماهى است\\
Polish & Mój poduszkowiec jest pełen węgorzy.\\
Portuguese & Meu hovercraft está cheio de enguias.\\
Proto-Indo-European & Dihskolmos-to-h1me hxVnghel plh1nos h1esti.\\
Punjabi & ਮੇਰਾ ਹਵਰਕ੍ਰਾਫ਼ਤ ਨਾਂਗਾਂ ਨਾਲ਼ ਭਰਿਆ ਪਿਆ।\\
Quenya & Venenya vilyanirwanen ná quanta as angolingwi.\\
Romanian & Vehicolul meu pe pernă de aer e plin cu ţipari.\\
Russian & Моё судно на воздушной подушке полно угрей.\\
Samoan & Ua tumu la'u ato fagota i pusi.\\
Sardinian (Logudorese) & Su hovercraft est penu de ambidas.\\
Scottish Gaelic & Tha mo bhàta-foluaimein loma-làn easgannan.\\
Serbian & Мој ховеркрафт је пун јегуља.\\
Shona & Hovercraft yangu yakazara nemikunga.\\
Sinhala & \Sinhala මාගේ වායු පා යානයේ ආඳන් පිරී ඇත\\
Slovak & Moje vznášadlo je plné úhorov.\\
Slovenian & Moje vozilo na zračni blazini je polno jegulj.\\
Somali & Huufarkarafkayga waxaa ka buuxa eels.\\
Spanish & Mi aerodeslizador está lleno de anguilas.\\
Swahili & Gari langu linaloangama limejaa na mikunga.\\
Swedish & Min svävare är full med ål.\\
Swiss German & Mis Luftchüssiboot isch volle Aal.\\
Tagalog & Puno ng palos ang aking hoberkrap/hovercraft.\\
Tamil    & என் மிதவை நிறைய விலாங்கு மீன்கள்.\\
Telugu & నా హోవర్ఁక్రాఫ్ఠ్ అంతా ఈలు చేపలతో నిండిపోయింది.\\
Thai & โฮเวอร์คราฟท์ของผมเต็มไปด้วยปลาไหล.\\
Tibetan & ངའི་རླུང་འདེགས་གྲུ་གཟིངས་ནི་ཉ་མན་ལི་ཡིས་གང་གི་འདུག །\\
Tok Pisin & Bilong me hangamapim bot stap pulap maleo.\\
Tongan & Hoku vakapuna tētē 'i 'olunga fono 'i he toke.\\
Tsotsil & Li j-xulem tak'ine noj ta conoetik.\\
Turkish & Benim hovercraft yılan balığı dolu.\\
Tuvan & Мээң ховеркрафтым иштинде чылан ышкаш балык долу.\\
Ukrainian & Моє судно на повітряній подушці наповнене вуграми.\\
Uzbek & Mening kayiqim baliq bilan to'lgan.\\
Vietnamese & Tàu cánh ngầm của tôi đầy lươn.\\
Võro & Muq hõl'omismassin om angõrit täüs.\\
Welsh & Mae fy hofrenfad yn llawn llyswennod.\\
Yiddish & מיין פראָם ( שוועבשיף ) איז פֿול מיט ווענערס\\
Yorùbá & Ọkọ afategun-sare mi kun fun ẹja arọ.\\
Zulu & Umkhumbi wami ugcwele ngenyoka zemanzini.
\end{longtable}

% END

\end{document}

===UPDATE===

After reading some of the great answers and comments here, I have the backbone for this project. My immediate, brute force, solution will be to create multido loops for each UNICODE subset currently displaying .notdef glyphs, switching typefaces as required. Definitely open to other, more elegant suggestions.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[10pt]{article}

% PACKAGES

\usepackage{fontspec}
\usepackage{multicol}
\usepackage{multido}


% FORMATTING

\textwidth = 6.5 in
\textheight = 8 in
\oddsidemargin = 0.0 in
\evensidemargin = 0.0 in
\setlength{\parindent}{0pt}

% OPEN DOCUMENT

\begin{document}

% SPECIFY UNICODE FONT

\setmainfont{Arial Unicode MS}

% BODY
\small
\begin{multicols}{10}
\multido{\i=0+1}{"10000}{% from U+0000 to U+FFFF
    {\tiny\i}\ \symbol{\i}\endgraf
}
\end{multicols}

\end{document}

% END

\end{document}
  • Why don't you turn your update in an answer? – karlkoeller Aug 19 '13 at 6:10
  • 2
    I'm not nearly there yet. My effort is to make a XeTeX document that includes every UNICODE glyph. Since there does not exist a truly pan-UNICODE font, it will take more work. For example, right now I cannot figure out why U+01F7 (ƿ) fails to print, though I know Arial Unicode MS contains it. Lots of little tweaks needed...the very tweaks others will hope to find if this is to be a useful reference document. – commonhare Aug 19 '13 at 6:24
  • 1
    The ucharclasses package might help. – Leo Liu Aug 19 '13 at 14:53
2

A simple example using ucharclasses package:

\documentclass{article}
\usepackage{ucharclasses}
\usepackage{fontspec}
\usepackage{bidi}

% some fonts with Windows
\setDefaultTransitions{\fontspec{Times New Roman}}{}
\setTransitionsForCJK{\fontspec{SimSun}}{}
\setTransitionsForArabics{\fontspec{Times New Roman}\setRTL}{\setLTR}
\setTransitionsFor{Gurmukhi}{\fontspec{Raavi}}{}

\begin{document}

\begin{tabular}{ll}
Arabic (MSA) & حَوّامتي مُمْتِلئة بِأَنْقَلَيْسون \\
Chinese (Mandarin, Simplified) & 我的气垫船充满了鳝鱼 \\
Punjabi & ਮੇਰਾ ਹਵਰਕ੍ਰਾਫ਼ਤ ਨਾਂਗਾਂ ਨਾਲ਼ ਭਰਿਆ ਪਿਆ।\\
\end{tabular}

\end{document}

enter image description here

You should read the package document and set the proper fonts.

The use of loop in your question is OK. See also my previous answer in Generating a table of glyphs with XeTeX , but \iffontchar is not necessary.

  • I built mine based on yours. I removed the conditional, because I want all the .notdefs to show so I may identify missing glyphs. I think I will add them manually via more loops...ucharclasses does not cover every UNICODE plane, as far as I can see...? – commonhare Aug 19 '13 at 16:46
  • 1
    @commonhare: It seems that ucharclasses is not difficult to extend. But before that, you should read the source code to see the Unicode ranges. – Leo Liu Aug 20 '13 at 1:46
  • Note that the Arabic text is wrong in two ways. First the glyphs fail to combine with adjacent ones. Second the words are ordered from left to right, even though the letters in the words are ordered right to left. – richard Apr 12 '16 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.