diff options
author | Karl Berry <karl@freefriends.org> | 2016-04-21 20:55:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-04-21 20:55:25 +0000 |
commit | cde7add49b05077ff24b6006f031bbdd70c91d7d (patch) | |
tree | 5beec57ac5092f86eb2db3ce46db12dc5f0c3a25 /Master/texmf-dist/source/luatex/luaotfload/luaotfload-main.tex | |
parent | 2697dc3d2c099b15f96861286d6863d5a15bda10 (diff) |
luaotfload (21apr16)
git-svn-id: svn://tug.org/texlive/trunk@40655 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/luatex/luaotfload/luaotfload-main.tex')
-rw-r--r-- | Master/texmf-dist/source/luatex/luaotfload/luaotfload-main.tex | 205 |
1 files changed, 146 insertions, 59 deletions
diff --git a/Master/texmf-dist/source/luatex/luaotfload/luaotfload-main.tex b/Master/texmf-dist/source/luatex/luaotfload/luaotfload-main.tex index ca1bc96e701..c243f03a007 100644 --- a/Master/texmf-dist/source/luatex/luaotfload/luaotfload-main.tex +++ b/Master/texmf-dist/source/luatex/luaotfload/luaotfload-main.tex @@ -1,8 +1,8 @@ -%% Copyright (C) 2009-2015 +%% Copyright (C) 2009-2016 %% %% by Elie Roux <elie.roux@telecom-bretagne.eu> %% and Khaled Hosny <khaledhosny@eglug.org> -%% and Philipp Gesang <philipp.gesang@alumni.uni-heidelberg.de> +%% and Philipp Gesang <phg@phi-gamma.net> %% %% This file is part of Luaotfload. %% @@ -32,7 +32,7 @@ \beginfrontmatter \setdocumenttitle {The \identifier{luaotfload} package} - \setdocumentdate {2015/12/12 v2.6} + \setdocumentdate {2016/04/21 v2.7} \setdocumentauthor {Elie Roux · Khaled Hosny · Philipp Gesang\\ Home: \hyperlink {https://github.com/lualatex/luaotfload}\\ Support: \email {lualatex-dev@tug.org}} @@ -188,9 +188,30 @@ for a more formal description see figure \ref{font-syntax}. <specification> ::= <prefixed spec>, [ <subfont no> ], \{ <modifier> \} \alt <anon lookup>, \{ <modifier> \} ; - <prefixed spec> ::= `file:', <file lookup> + <prefixed spec> ::= `combo:', <combo list> + \alt `file:', <file lookup> \alt `name:', <name lookup> ; + <combo list> ::= <combo def 1>, \{ `;', <combo def> \} ; + + <combo def 1> ::= <combo id>, `->', <combo id> ; + + <combo def> ::= <combo id>, `->', <combo id chars> ; + + <combo id> ::= (`(', \{ {\sc digit} \}, `)' | \{ {\sc digit} \} ) ; + + <combo id chars> ::= (`(', \{ {\sc digit} \}, `,', <combo chars>, `)' + \alt \{ {\sc digit} \} ) ; + + <combo chars> ::= `fallback' + \alt \{ <combo range>, \{ `*', <combo range> \} \} ; + + <combo range> ::= <combo num>, [ `-', <combo num> ] ; + + <combo num> ::= `0x', \{ {\sc hexdigit} \} + \alt `U+', \{ {\sc digit} \} + \alt \{ {\sc digit} \} ; + <file lookup> ::= \{ <name character> \} ; <name lookup> ::= \{ <name character> \} ; @@ -227,12 +248,11 @@ requires a \emphasis{prefix}: \endnarrower % where \meta{prefix} is either \inlinecode{file:} or \inlinecode {name:}.\footnote{% - The development version also knows two further prefixes, - \inlinecode {kpse:} and \inlinecode {my:}. + \identifier{Luaotfload} also knows two further prefixes, \inlinecode {kpse:} + and \inlinecode {my:}. % A \inlinecode {kpse} lookup is restricted to files that can be found by - \identifier{kpathsea} and - will not attempt to locate system fonts. + \identifier{kpathsea} and will not attempt to locate system fonts. % This behavior can be of value when an extra degree of encapsulation is needed, for instance when supplying a customized tex distribution. @@ -373,7 +393,7 @@ have no meaning in \LUATEX. \beginsubsubsection{Loading by File Name} -For example, conventional \abbrev{type1} font can be loaded with a +For example, conventional \TeX\ font can be loaded with a \inlinecode {file:} request like so: \beginlisting @@ -584,38 +604,6 @@ obviously, \inlinecode{random}. defaulting to \inlinecode{dflt}. \endaltitem - \beginaltitem {featurefile} - A comma-separated list of feature files to be applied to the - font. - % - Feature files contain a textual representation of - \OpenType tables and extend the features of a font - on fly. - % - After they are applied to a font, features defined in a - feature file can be enabled or disabled just like any - other font feature. - % - The syntax is documented in \identifier{Adobe}’s - \OpenType Feature File Specification.\footnote{% - Cf. \hyperlink {http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html}. - Feature file support is part of the engine which at the - time of this writing (2014) implements the spec only - partially. - See the - \hyperlink [\LUATEX tracker]{http://tracker.luatex.org/view.php?id=231} - for details. - } - - For a demonstration of how to set a \inlinecode{tkrn} feature consult - the file \inlinecode{tkrn.fea} that is part of \identifier{luaotfload}. - It can be read and applied as follows: - - \beginlisting - \font \test = Latin Modern Roman:featurefile=tkrn.fea;+tkrn - \endlisting - \endaltitem - \beginaltitem {color} A font color, defined as a triplet of two-digit hexadecimal \abbrev{rgb} values, with an optional fourth value for @@ -807,6 +795,92 @@ Currently (2014) there are three of them: \endsection %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\beginsection {Combining fonts} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Version 2.7 and later support combining characters from multiple fonts into a +single virtualized one. This requires that the affected fonts be loaded in +advance as well as a special \emphasis{request syntax}. Furthermore, this +allows to define \emphasis{fallback fonts} to supplement fonts that may lack +certain required glyphs. + +Combinations are created by defining a font using the \luaident{combo:} prefix. + +\beginsubsection {Fallbacks} + +For example, the \identifier{Latin Modern} family of fonts does, as indicated +in the name, not provide Cyrillic glyphs. If Latin script dominates in the copy +with interspersed Cyrillic, a fallback can be created from a similiar looking +font like \identifier{Computer Modern Unicode}, taking advantage of the fact +that it too derives from Knuth’s original \identifier{Computer Modern} series: + +\beginlisting + \input luaotfload.sty + \font \lm = file:lmroman10-regular.otf:mode=base + \font \cmu = file:cmunrm.otf:mode=base + \font \lmu = "combo: 1->\fontid\lm; 2->\fontid\cmu,fallback" + \lmu Eh bien, mon prince. Gênes et Lueques ne sont plus que des + apanages, des поместья, de la famille Buonaparte. + \bye +\endlisting + +As simple as this may look on the first glance, this approach is entirely +inappropriate if more than a couple letters are required from a different font. +Because the combination pulls nothing except the glyph data, all of the +important other information that constitute a proper font -- kerning, styles, +features, and suchlike -- will be missing. + +\endsubsection %% Fallbacks + +\beginsubsection {Combinations} + +Generalizing the idea of a \emphasis{fallback font}, it is also possible to +pick definite sets of glyphs from multiple fonts. On a bad day, for instance, +it may be the sanest choice to start out with \identifier{EB Garamond} italics, +typeset all decimal digits in the bold italics of \identifier{GNU Freefont}, +and tone down the punctuation with extra thin glyphs from \identifier{Source +Sans}: + +\beginlisting + \def \feats {-tlig;-liga;mode=base;-kern} + \def \fileone {EBGaramond12-Italic.otf} + \def \filetwo {FreeMonoBoldOblique.otf} + \def \filethree {SourceSansPro-ExtraLight.otf} + + \input luaotfload.sty + + \font \one = file:\fileone :\feats + \font \two = file:\filetwo :\feats + \font \three = file:\filethree:\feats + + \font \onetwothree = "combo: 1 -> \fontid\one; + 2 -> \fontid\two, 0x30-0x39; + 3 -> \fontid\three, 0x21*0x3f; + + {\onetwothree \TeX—0123456789—?!} + \bye +\endlisting + +\noindent Despite the atrocious result, the example demonstrates well the +syntax that is used to specify ranges and fonts. Fonts are being referred to by +their internal index which can be obtained by passing the font command into the +\texmacro{fontid} macro, e. g. \inlinecode{\fontid\one}, after a font has been +defined. The first component of the combination is the base font which will be +extended by the others. It is specified by the index alone. + +All further fonts require either the literal \inlinecode{fallback} or a list of +codepoint definitions to be appended after a comma. The elements of this list +again denote either single codepoints like \inlinecode{0x21} (referring to the +exclamation point character) or ranges of codepoints (\inlinecode{0x30-0x39}). +Elements are separated by the \identifier{ASCII} asterisk character +(\inlinecode{*}). The characters referenced in the list will be imported from +the respective font, if available. + +\endsubsection %% Combinations + +\endsection + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \beginsection {Font names database} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1160,6 +1234,7 @@ and have thus been omitted from the merge.\footnote{% \beginaltitem {l-boolean.lua} \endaltitem \beginaltitem {l-math.lua} \endaltitem \beginaltitem {util-str.lua} \endaltitem + \beginaltitem {util-fil.lua} \endaltitem \enddefinitions \enddoublecolumns @@ -1169,30 +1244,28 @@ grouped twofold as below: \begindefinitions \beginnormalitem The \emphasis{font loader} itself. - These files have been written for - \LUATEX-Fonts and they are distributed along - with \identifier{luaotfload}. + These files have been written for \LUATEX-Fonts and they are + distributed along with \identifier{luaotfload} so as to resemble + the state of the code when it was imported. Their purpose is either + to give a slightly aged version of a file if upstream considers + latest developments for not yet ready for use outside Context; or, + to install placeholders or minimalist versions of APIs relied upon + but usually provided by parts of Context not included in the + fontloader. \begindoublecolumns \begindefinitions \beginaltitem{luatex-basics-nod.lua} \endaltitem + \beginaltitem{luatex-basics-chr.lua} \endaltitem \beginaltitem{luatex-fonts-enc.lua} \endaltitem \beginaltitem{luatex-fonts-syn.lua} \endaltitem - \beginaltitem{luatex-fonts-tfm.lua} \endaltitem - \beginaltitem{luatex-fonts-chr.lua} \endaltitem - \beginaltitem{luatex-fonts-lua.lua} \endaltitem - \beginaltitem{luatex-fonts-inj.lua} \endaltitem - \beginaltitem{luatex-fonts-otn.lua} \endaltitem - \beginaltitem{luatex-fonts-def.lua} \endaltitem \beginaltitem{luatex-fonts-ext.lua} \endaltitem - \beginaltitem{luatex-fonts-cbk.lua} \endaltitem \enddefinitions \enddoublecolumns \endnormalitem \beginnormalitem - Code related to \emphasis{font handling and - node processing}, taken directly from - \CONTEXT. + Code related to \emphasis{font handling and node processing}, taken + directly from \CONTEXT. \begindoublecolumns \begindefinitions \beginaltitem{data-con.lua} \endaltitem @@ -1200,12 +1273,25 @@ grouped twofold as below: \beginaltitem{font-con.lua} \endaltitem \beginaltitem{font-cid.lua} \endaltitem \beginaltitem{font-map.lua} \endaltitem + \beginaltitem{font-tfm.lua} \endaltitem + \beginaltitem{font-afm.lua} \endaltitem + \beginaltitem{font-afk.lua} \endaltitem \beginaltitem{font-oti.lua} \endaltitem - \beginaltitem{font-otf.lua} \endaltitem - \beginaltitem{font-otb.lua} \endaltitem + \beginaltitem{font-otr.lua} \endaltitem + \beginaltitem{font-cff.lua} \endaltitem + \beginaltitem{font-ttf.lua} \endaltitem + \beginaltitem{font-dsp.lua} \endaltitem + \beginaltitem{font-oup.lua} \endaltitem + \beginaltitem{font-otl.lua} \endaltitem + \beginaltitem{font-oto.lua} \endaltitem + \beginaltitem{font-otj.lua} \endaltitem \beginaltitem{font-ota.lua} \endaltitem + \beginaltitem{font-ots.lua} \endaltitem + \beginaltitem{font-osd.lua} \endaltitem + \beginaltitem{font-lua.lua} \endaltitem \beginaltitem{font-def.lua} \endaltitem - \beginaltitem{font-otp.lua} \endaltitem + \beginaltitem{font-xtx.lua} \endaltitem + \beginaltitem{font-gbn.lua} \endaltitem \enddefinitions \enddoublecolumns \endnormalitem @@ -1248,8 +1334,8 @@ files not contained in the merge. Some of these have no equivalent in overrides the \CONTEXT logging functionality. \endaltitem \beginaltitem {luaotfload-loaders.lua} - registers the \OpenType font reader as handler for Postscript - fonts (\abbrev{pfa}, \abbrev{pfb}). + registers readers in the fontloader for various kinds of + font formats \endaltitem \beginaltitem {luaotfload-parsers.lua} various \abbrev{lpeg}-based parsers. @@ -1767,3 +1853,4 @@ Distributions probably package it as \fileent \endinput +% vim:ft=tex:tw=79:et:sw=2 |