X E TEX Live
Total Page:16
File Type:pdf, Size:1020Kb
X TE EX Live Jonathan Kew SIL International Horsleys Green High Wycombe Bucks HP14 3XL, England jonathan_kew (at) sil dot org 1 X TE EX in TEX Live in the preamble are sufficient to set the typefaces through- out the document. ese fonts were installed by simply e release of TEX Live 2007 marked a milestone for the dropping the .otf or .ttf files in the computer’s Fonts X TE EX project, as the first major TEX distribution to in- folder; no .tfm, .fd, .sty, .map, or other TEX-related files clude X TE EX (version 0.996) as an integral part. Prior to had to be created or installed. this, X TE EX was a tool that could be added to a TEX setup, Release 0.996 of X T X also provides some enhance- but version and configuration differences meant that it was E E ments over earlier, pre-T X Live versions. In particular, difficult to ensure smooth integration in all cases, and it was E there are new primitives for low-level access to glyph infor- only available for users who specifically chose to seek it out mation (useful during font development and testing); some and install it. (One exception to this is the MacTEX pack- preliminary support for the use of OpenType math fonts age, which has included X TE EX for the past year or so, but (such as the Cambria Math font shipped with MS Office this was just one distribution on one platform.) Integration 2007); and a variety of bug fixes. in TEX Live, in contrast, provides near-universal availabil- ity and a more standardized configuration, which should 1.2 Hyphenation setup simplify setup, use and support. Special thanks to Karl Berry for his encouragement A long-standing problem with integrating X TE EX has been and support through this process, and to all the TEX Live the variety of hyphenation patterns for various languages, builders and testers on various platforms who helped to which are written using a variety of character encodings and make this possible. various ways to represent those encodings in 7-bit or 8-bit files. Because X TE EX interprets 8-bit text files as Unicode 1.1 Key features (UTF-8) by default, many old hyphenation files cannot be read as-is. is in turn meant that the X LE ATEX format e two most significant features of X T X as found in T X E E E could fail to build, depending on the user’s language con- Live remain the same as they have been since its first ap- figuration. pearance: support for the use of the host operating system’s Older releases of X TE EX made some attempt to address fonts (PostScript, TrueType, or OpenType) with no T X- E this by including modified versions of some of the hyphen- specific setup, and including layout features defined in the ation files from teTEX, adapted to load correctly as Unicode fonts; and extensive support for Unicode, including com- patterns. However, ensuring that these were installed in the plex Asian and other scripts. With this release, users on right place for X TE EX to find them (without affecting other all platforms have the option of using the same OpenType engines or replacing standard files) was problematic. fonts in TEX documents as in mainstream GUI applications, In TEX Live 2007, this situation has been addressed including access to all the rich typographic features found by modifying the language.dat file so that hyphen- in modern fonts. ation files are loaded via “wrappers” (except for those As an example of the simplicity X T X brings to font E E that are simple ASCII files, which are already Unicode- usage, consider the present article. is is written using the compatible). e wrapper files, provided in TEX Live ltugproc class. Running this in X LAT X, the lines: E E in texmf-dist/tex/generic/xu-hyphen, test whether the \usepackage{fontspec} format is being built by X TE EX, and if so they redefine the \setmainfont[Mapping=tex-text] input encoding and/or \catcodes, active character defini- {Adobe Garamond Pro} \setmonofont[Scale=MatchLowercase] tions, etc., so that the patterns will be loaded as Unicode {Andale Mono WT J} data. Figure 1 shows an example of such a wrapper file; in this case, the German vowels with umlauts and the ß char- acter need Unicode-compliant definitions, in place of those Note: is article is based on the author’s presentations at both the EuroBachoTEX 2007 and TUG 2007 conferences, but is printed in a single found in the original hyphenation file. e precise details Proceedings issue to avoid duplication. vary, of course, depending on the structure and encoding 146 TUGboat, Volume 29, No. 1 — XVII European TEX Conference, 2007 X TE EX Live % xu-dehyphn.tex % Wrapper for XeTeX to read dehyphn.tex % Jonathan Kew, 2006-08-17 % Public domain \begingroup \expandafter\ifx\csname XeTeXrevision\endcsname\relax \else \catcode`\?=7 % Define the accent macro " in such a way that it % expands to single letters in Unicode \catcode`\"=13 \def"#1{\ifx#1a??e4\else \ifx#1o??f6\else \ifx#1u??fc\else \errmessage{Hyphenation pattern file corrupted!}% \fi\fi\fi} % - patterns with umlauts are ok \def\n#1{#1} % - define \3 to be character "00DF (\ss in Unicode) \def\3{??df} % - define \9 to throw an error \def\9{\errmessage{Hyphenation pattern file corrupted!}} % - duplicated patterns to support font encoding OT1 are not wanted \def\c#1{} % \let\PATTERNS=\patterns \def\patterns{% at the \patterns command in dehyphn.tex... \endgroup % end group containing local definitions from dehyphn \begingroup % and start our own (to match \endgroup in dehyphn) \PATTERNS % and then load the real patterns } \fi \input dehyphn.tex \endgroup \endinput Figure 1: xu-dehyphn.tex, a typical hyphenation wrapper file from the TEX Live setup of the pattern file being loaded, but similar techniques can is situation is improving, as some major packages generally be used. have added a test for X TE EX and now choose the appropri- In the longer term, reorganization and standardization ate driver options. For others, including important cases of the hyphenation files, perhaps co-ordinated with work like geometry and crop, TL2007 includes configuration in OpenOffice.org (which uses a very similar hyphenation files in the xelatex subtree that provide the proper setup. algorithm) would be a useful project. However, this will In most cases, therefore, users should find that the packages require not only a good understanding of the language and work transparently in X TE EX just as with other TEX engines encoding issues, but also interaction with license holders and drivers. or maintainers of all the existing patterns. Meanwhile, the One important package that did not work transpar- current setup with xu- wrappers has proved to be a work- ently with X TE EX in the TL2007 release is pgf; however, able interim solution. since the release in February, pgf has also been updated so that it recognizes the X TE EX engine automatically. 1.3 Package configuration 1.4 e ArabX TE EX package Another common problem for X TE EX users in the past has been that some popular LATEX packages (e.g., graphics, A new package by François Charette provides an ArabTEX- color, geometry, crop, hyperref, and others) depend on like interface for typesetting languages in Arabic script, us- knowing the intended output driver (direct PDF genera- ing standard Unicode-based fonts. As shown in figure 2, tion with pdfTEX, dvips, dvipdfm, etc.) in order to use this supports both literal Unicode input of Arabic text, and the correct implementation-specific methods to control the ArabTEX transliterations, and can work with any Open- output. Many such packages attempt to detect the TEX en- Type font, including complex calligraphic styles such as gine in use and automatically choose the appropriate driver. Nastaliq script. is package was created after the cur- However, with X TE EX being a new engine, existing pack- rent TEX Live release, but can be obtained from CTAN and ages were unaware of it. works with the existing X TE EX version. TUGboat, Volume 29, No. 1 — XVII European TEX Conference, 2007 147 Jonathan Kew % preamble... z (x, y, z) \usepackage{arabxetex} \newfontfamily\arabicfont b [Script=Arabic]{Scheherazade} \newfontfamily\urdufont [Script=Arabic,Scale=0.75]{Noori Nastaliq MT} % body... \begin{arab}[fullvoc] ϕ mina 'l-qur'Ani 'l-karImi, r sUraTu 'l-ssajdaTi 15--16: % ...etc... \end{arab} \begin{urdu}[voc] یُونسٔ حضرت وِچُّوں بنیاِسرائِیل اَںبیاءِ % ...etc... y θ Result: ِ َ ْٱ ُآ ِن ْٱ َ ِ ِ، ُ َر ُة ٱ ْ َ ِة ١٥–١٦: إِ َ ُ ْ ِ ُ ِـَــٰ ِ َ ٱ ِ َ إِ َذا ُذ ُوا ِ َ َ وا ُ ًا َو َ ُا ِ َ ْ ِ َر ِ ْ َو ُ ْ َ َ ْ َ ْ ِ ُ َون ۩ x ٔ َ َ َ َ ُ ُ ُ ُ ْ َ ِ ْٱ َ َ ِ ِ َ ْ ُ َن َر ُ ْ َ ًْ َو َ ًَ َو ِ َر َز ْ ٰ ُ ْ ُ ْ ِ ُ َن ِ ِٔ Figure 3: Example of a PSTricks plot embedded in a X LAT X ﻛ E E َﺍ ِ ء ﺍِﺍ ﻭِﮞ ِ ٔ ُ ﺍ ﺪﺭ ۔ ﺍٓ ٔ ﺩﺍ َﺩ ِﻭﺭ۷۸۱/۷۸۲ ﻡ ُﻮﮞ ۷۵۳ﻡ ۔ = ِ document (from http://tug.org/PSTricks/main.cgi?file ﺍُﻭﮞ ﻭُ ﻜ ِﺍِ ٔﺍ ﺩﺍ ﺩﻩ ُﺎﻡ ۔ ﺍٓ ﺍِ ُ ﻜ ﻭِﺡ ﺩﮮﻝ ”“ ﺩﮮ ﺎﻡ َﺭ ﺪﮮ ( ِ ِ ِ pst-plot/3D/examples َ َ۔ﺍ ﺡ َ ﺍ ِﻩ ُﮞ ” ُ ﺍ َّﺭﻉ“ ﺍٓ ِﮞ۔ ﺍ ﺎﻡ ِﻞ ﺩﮮ َ ﺭﮞ ﺍ ﻩﺩﮮ ُﻝ َ ِ ٔ ﺍ ﺩﮮ ﺻﮯ ۔ ﺍِ ﻮﮞ ﺩﮮ ﺪ ﺭﺍ ﺩﻯ ٔ ُﺍ ﺩﮮ َﺩ ﻭﺭﺍﮞ ّ ّ ﮯ ﺍ ﺎﻡ ﻰ ﺩﮮ ﺍٓ ﻯ َﺩﻭﺭ ِ ً ﻛ ﻛ ۱۵۵۰ﻡ ُﻮﮞ ۱۲۰۰ﻡ ﺍٓﺩ ۔ َﻭﻻ ُﺩﻭ ﻰ ﺩﻪ ﺍ۱۲۰۰ ً ِ ﻡ ُﻮﮞ ۶۰۰ﻡ ﺍٓﺩ ﺭﺎ۔ ِ ٔ ُ ُﺩﻭ ﻛُ ﺳ the driver’s .cfg file) to convert this to PDF which can then َﺩﻭﺭ ِﻭﺡ َ ۔ ﺍِ ﺪ ﺭﺍ ُﻮﮞ ﺩﺭﺍ ِ ﻭ َ ﺪﺍﮞ ” ﻬﺪ“۔ ﺭﻭﺍ ﺩﮮ ٔ ُ ُ ﺩﺍ ﺍﺭ .be embedded in the document, as illustrated in figure 3 ﺍ ِٔ ِ۔ While this technique is currently quite slow, it does at least Figure 2: Examples of ArabX TE EX input and typeset output permit the use of such graphics.