• date post

14-Jul-2016
• Category

## Documents

• view

24

0

Embed Size (px)

description

Latex

### Transcript of Font Speciales

• The fontspec packageFont selection for X ELATEX and LuaLATEX

Will Robertson and Khaled Hosnywill.robertson@latex-project.org

2015/09/24 v2.4e

Contents1 History 3

2 Introduction 32.1 About this manual . . . . 32.2 Acknowledgements . . . . 3

3 Package loading and options 43.1 Maths fonts adjustments . 43.2 Configuration . . . . . . . 53.3 Warnings . . . . . . . . . . 5

I General font selection 5

4 Font selection 64.1 By font name . . . . . . . . 64.2 By file name . . . . . . . . 6

5 New commands to select fontfamilies 75.1 More control over font

shape selection . . . . . . . 85.2 Specifically choosing the

NFSS family . . . . . . . . 105.3 Choosing additional NFSS

font faces . . . . . . . . . . 105.4 Math(s) fonts . . . . . . . . 115.5 Miscellaneous font select-

ing details . . . . . . . . . 12

6 Selecting font features 136.1 Default settings . . . . . . 136.2 Default settings from a file 146.3 Changing the currently se-

lected features . . . . . . . 15

6.4 Priority of feature selection 156.5 Different features for dif-

ferent font shapes . . . . . 166.6 Different features for dif-

ferent font sizes . . . . . . 17

7 Font independent options 187.1 Colour . . . . . . . . . . . 187.2 Scale . . . . . . . . . . . . . 197.3 Interword space . . . . . . 197.4 Post-punctuation space . . 207.5 The hyphenation character 207.6 Optical font sizes . . . . . 20

II OpenType 22

8 Introduction 228.1 How to select font features 22

9 Complete listing of OpenTypefont features 239.1 Ligatures . . . . . . . . . . 239.2 Letters . . . . . . . . . . . 239.3 Numbers . . . . . . . . . . 249.4 Contextuals . . . . . . . . 259.5 Vertical Position . . . . . . 259.6 Fractions . . . . . . . . . . 269.7 Stylistic Set variations . . . 279.8 Character Variants . . . . . 279.9 Alternates . . . . . . . . . 289.10 Style . . . . . . . . . . . . . 299.11 Diacritics . . . . . . . . . . 319.12 Kerning . . . . . . . . . . . 319.13 Font transformations . . . 329.14 Annotation . . . . . . . . . 329.15 CJK shape . . . . . . . . . 33

1

• 9.16 Character width . . . . . . 339.17 Vertical typesetting . . . . 349.18 OpenType scripts and lan-

guages . . . . . . . . . . . 34

III LuaTEX-only font fea-tures 35

10 OpenType font feature files 36

IV Fonts and featureswith X ETEX 38

11 X ETEX-only font features 3811.1 Mapping . . . . . . . . . . 3811.2 Letter spacing . . . . . . . 3911.3 Different font technolo-

gies: aat and OpenType . 3911.4 Optical font sizes . . . . . 39

12 Mac OS Xs aat fonts 4012.1 Ligatures . . . . . . . . . . 4012.2 Letters . . . . . . . . . . . 4012.3 Numbers . . . . . . . . . . 4012.4 Contextuals . . . . . . . . 4012.5 Vertical position . . . . . . 4112.6 Fractions . . . . . . . . . . 4112.7 Variants . . . . . . . . . . . 4212.8 Alternates . . . . . . . . . 4212.9 Style . . . . . . . . . . . . . 4312.10 CJK shape . . . . . . . . . 4312.11 Character width . . . . . . 4312.12 Vertical typesetting . . . . 4312.13 Diacritics . . . . . . . . . . 4412.14 Annotation . . . . . . . . . 44

V Programming interface 44

13 Defining new features 44

14 Going behind fontspecs back 45

15 Renaming existing features & op-tions 45

16 Programming details 46

VI The patching/improvementof LATEX2 and other pack-ages 47

17 Inner emphasis 47

18 Unicode footnote symbols 48

19 Verbatim 48

20 Discretionary hyphenation: \- 48

21 Commands for old-style and lin-ing numbers 48

VII fontspec.sty andfriends 49

22 Header code 4922.1 expl3 tools . . . . . . . . . 4922.2 Bits and pieces . . . . . . . 4922.3 Error/warning/info mes-

sages . . . . . . . . . . . . 5122.4 Option processing . . . . . 5422.5 Packages . . . . . . . . . . 55

23 The main package code 5523.1 Encodings . . . . . . . . . 5523.2 User commands . . . . . . 5623.3 Programmers interface . . 6323.4 expl3 interface for font

loading . . . . . . . . . . . 6723.5 Internal macros . . . . . . 6823.6 keyval definitions . . . . . 8723.7 Italic small caps . . . . . . 11123.8 Selecting maths fonts . . . 11223.9 Finishing up . . . . . . . . 11623.10 Compatibility . . . . . . . 116

VIII fontspec.lua 117

IX fontspec-patches.sty 11923.11 Unicode footnote symbols 11923.12 Emph . . . . . . . . . . . . 11923.13 \- . . . . . . . . . . . . . . 12023.14 Verbatims . . . . . . . . . . 12023.15 \oldstylenums . . . . . . . 122

X fontspec.cfg 123

2

• 1 HistoryThis package began life as a LATEX interface to select system-installed Mac OS X fonts inJonathan Kews X ETEX, the first widely-used Unicode extension to TEX. Over time, X ETEX wasextended to support OpenType fonts and then was ported into a cross-platform program torun also on Windows and Linux.

More recently, LuaTEX is fast becoming the TEX engine of the day; it supports Unicodeencodings and OpenType fonts and opens up the internals of TEX via the Lua programminglanguage. Hans Hagens ConTEXt Mk. IV is a re-write of his powerful typesetting system,taking full advantage of LuaTEXs features including font support; a kernel of his work inthis area has been extracted to be useful for other TEX macro systems as well, and this hasenabled fontspec to be adapted for LATEX when run with the LuaTEX engine.

2 IntroductionThe fontspec package allows users of either X ETEX or LuaTEX to load OpenType fonts in aLATEX document. No font installation is necessary, and font features can be selected and usedas desired throughout the document.

Without fontspec, it is necessary to write cumbersome font definition files for LATEX, sinceLATEXs font selection scheme (known as the nfss) has a lot going on behind the scenes toallow easy commands like \emph or \bfseries. With an uncountable number of fonts nowavailable for use, however, it becomes less desirable to have to write these font definition(.fd) files for every font one wishes to use.

Because fontspec is designed to work in a variety of modes, this user documentation issplit into separate sections that are designed to be relatively independent. Nonetheless, thebasic functionality all behaves in the same way, so previous users of fontspec under X ETEXshould have little or no difficulty switching over to LuaTEX.

This manual can get rather in-depth, as there are a lot of details to cover. See the exampledocuments fontspec-xetex.tex and fontspec-luatex.tex for a complete minimal examplewith each engine.

2.1 About this manualThis document is typeset with pdfLATEX using pre-compiled examples that have been gen-erated by either X ETEX or LuaTEX. You may regenerate the examples by removing thedoc-files/ subdirectory and typesetting the manual with the following invocation:

pdflatex -shell-escape fontspec.dtx

Note that many of the examples use fonts that are not included in TEX Live or MiKTeX, andsome of them are non-free fonts that must be purchased.

Id like to reduce the number of non-free fonts used in this manual. If you know anyfreely available fonts that could be used as alternative to any of the fonts in this document,please suggest them to me. Finally, if any aspect of the documentation is unclear or youwould like to suggest more examples that could be made, get in touch. (Contributionsespecially welcome.)

2.2 AcknowledgementsThis package could not have been possible without the early and continued support theauthor of X ETEX, Jonathan Kew. When I started this package, he steered me many times inthe right direction.

3

• Ive had great feedback over the years on feature requests, documentation queries, bugreports, font suggestions, and so on from lots of people all around the world. Many thanksto you all.

Thanks to David Perry and Markus Bohning for numerous documentation improve-ments and David Perry again for contributing the text for one of the sections of this manual.

Special thanks to Khaled Hosny, who had been the driving force behind the support forLuaLATEX, ultimately leading to version 2.0 of the package.

3 Package loading and optionsFor basic use, no package options are required:

\usepackage{fontspec}

Package options will be introduced below; some preliminary details are discussed first:

xunicode Ross Moores xunicode package is now automatically loaded for users of bothX ELATEX and LuaLATEX. This package provides backwards compatibility with LATEXs methodsfor accessing extra characters and accents (for example, \%, \\$, \textbullet, \"u, and so on),plus many more Unicode characters.

X ETEX users only The xltxtra package adds some minor extra features to X ELATEX, in-cluding, via the metalogo package, the \XeTeX macro to typeset the X ETEX logo. While thispackage was previously recommended, it serves a much smaller role nowadays and gener-ally will not be required. Please consult its documentation to assess whether its features arewarranted before loading it.

LuaTEX users only In order to load fonts by their name rather than by their file-name (e.g., Latin Modern Roman instead of ec-lmr10), you may need to run the scriptluaotfload-tool, which is distributed with the luaotfload package. Note that if you do notexecute this script beforehand, the first time you attempt to typeset the process will pausefor (up to) several minutes. (But only the first time.) Please see the luaotfload documentationfor more information.

babel The babel package is not really supported! Especially Vietnamese, Greek, and Hebrewat least might not work correctly, as far as I can tell. Theres a better chance with Cyrillic andLatin-based languages, howeverfontspec ensures at least that fonts should load correctly.The polyglossia package is recommended instead as a modern replacement for babel.