summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2014-03-14 18:26:35 +0100
committerPhilipp Gesang <phg42.2a@gmail.com>2014-03-14 18:26:35 +0100
commitba5b4c808942d6abcc610385555df8cc8ca3c413 (patch)
treeb49851e381609669020f5745c5772033a8bb852b
parent2e78a8e0594fc066cbca25459dc76e79f1c3f375 (diff)
parent478c9cd68681cd182b1278f784c6768d48d207b4 (diff)
downloadluaotfload-ba5b4c808942d6abcc610385555df8cc8ca3c413.tar.gz
Merge pull request #205 from phi-gamma/texlive2014
sync; context setups for manual (alpha)
-rw-r--r--doc/luaotfload-context.tex457
-rw-r--r--doc/luaotfload-latex.tex2
-rw-r--r--doc/luaotfload-main.tex183
-rw-r--r--src/luaotfload-fontloader.lua203
4 files changed, 727 insertions, 118 deletions
diff --git a/doc/luaotfload-context.tex b/doc/luaotfload-context.tex
new file mode 100644
index 0000000..aeca7cb
--- /dev/null
+++ b/doc/luaotfload-context.tex
@@ -0,0 +1,457 @@
+% macros=mkvi
+%% Copyright (C) 2009-2014
+%%
+%% by Elie Roux <elie.roux@telecom-bretagne.eu>
+%% and Khaled Hosny <khaledhosny@eglug.org>
+%% and Philipp Gesang <philipp.gesang@alumni.uni-heidelberg.de>
+%%
+%% This file is part of Luaotfload.
+%%
+%% Home: https://github.com/lualatex/luaotfload
+%% Support: <lualatex-dev@tug.org>.
+%%
+%% Luaotfload is under the GPL v2.0 (exactly) license.
+%%
+%% ----------------------------------------------------------------------------
+%%
+%% Luaotfload is free software; you can redistribute it and/or
+%% modify it under the terms of the GNU General Public License
+%% as published by the Free Software Foundation; version 2
+%% of the License.
+%%
+%% Luaotfload is distributed in the hope that it will be useful,
+%% but WITHOUT ANY WARRANTY; without even the implied warranty of
+%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+%% GNU General Public License for more details.
+%%
+%% You should have received a copy of the GNU General Public License
+%% along with Luaotfload; if not, see <http://www.gnu.org/licenses/>.
+%%
+%% ----------------------------------------------------------------------------
+%%
+
+\unprotect
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% layout and paper
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\setuppapersize [A5] [A5] %% 148×210
+
+\definelayout [mainlayout] [
+ backspace=15mm, %% 133
+ textwidth=103mm,
+ topspace=15mm,
+]
+
+\setuplayout [mainlayout]
+
+\setuppagenumbering [location=,alternative=doublesided]
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% colors
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\usecolors [x11]
+\definecolor [primarycolor] [dodgerblue4]
+\definecolor [secondarycolor] [goldenrod4]
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% interaction
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\setupinteraction [
+ state=start,
+ page=no,
+ click=yes,
+ style=italic,
+ color=primarycolor,
+ contrastcolor=secondarycolor,
+ title={The Luaotfload package},
+ subtitle={OpenType layout system for Plain TeX and LaTeX},
+ author={Elie Roux & Khaled Hosny & Philipp Gesang},
+ keywords={luatex, lualatex, unicode, opentype},
+]
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% fonts
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\usemodule [simplefonts]
+
+\definefontfeature [default] [default] [mode=base,liga=yes,dlig=yes,tlig=yes,onum=yes]
+\definefontfeature [monospace] [liga=no,tlig=no,onum=no]
+
+\definefontfamily [mainface] [serif] [Linux Libertine O] [features=default]
+%\definefontfamily [mainface] [serif] [Liberation Serif] [feature=default]
+%\definefontfamily [mainface] [sans] [Iwona] [feature=default]
+\definefontfamily [mainface] [sans] [Iwona Medium] [
+ feature=default,
+ it=file:IwonaMedium-Italic.otf,
+ tf=file:IwonaMedium-Regular.otf,
+ bf=file:Iwona-Bold.otf,
+ bi=file:Iwona-BoldItalic.otf,
+]
+%definefontfamily [mainface] [sans] [DejaVu Sans] [feature=default]
+\definefontfamily [mainface] [mono] [Liberation Mono] [scale=0.85,features=monospace]
+
+\setupbodyfont [mainface,10pt]
+
+\def \LUA {Lua}
+\def \LUALATEX {Lua\LATEX}
+\def \OpenType {\identifier{Open\kern-.25ex Type}}
+
+\definealternativestyle [emphasis:texmacro] [\ss \it \letterbackslash] [\ss \it \letterbackslash]
+\definealternativestyle [emphasis:identifier] [\ss] [\ss]
+\definealternativestyle [emphasis:normal] [\sl] [\sl]
+\definealternativestyle [emphasis:abbrev] [{\feature [+][smallcaps]}] [{\feature [+][smallcaps]}]
+\definealternativestyle [emphasis:Largefont] [{\switchtobodyfont[14pt]}] [{\switchtobodyfont[14pt]}]
+\definealternativestyle [emphasis:smallcaps] [{\feature [+][smallcaps]}] [{\feature [+][smallcaps]}]
+%definealternativestyle [emphasis:nonproportional] [\mono] [\mono]
+\definealternativestyle [emphasis:nonproportional] [\tt] [\tt]
+\definealternativestyle [head:section] [{\roman\feature[+][smallcaps]}] [{\roman\feature[+][smallcaps]}]
+\definealternativestyle [head:subsection] [{\roman\feature[+][smallcaps]}] [{\roman\feature[+][smallcaps]}]
+\definealternativestyle [head:subsubsection] [{\roman\feature[+][smallcaps]}] [{\roman\feature[+][smallcaps]}]
+\definealternativestyle [typing:luafunction] [\italic] [\italic]
+\definealternativestyle [typing:fileent] [\tt] [\tt]
+
+\definehighlight [texmacro] [style=emphasis:texmacro] %% cs
+\definehighlight [identifier] [style=emphasis:identifier] %% names
+\definehighlight [abbrev] [style=emphasis:abbrev] %% acronyms
+\definehighlight [emphasis] [style=emphasis:normal] %% level 1 emph
+
+\definehighlight [Largefont] [style=emphasis:Largefont] %% font size
+\definehighlight [smallcaps] [style=emphasis:smallcaps] %% font feature
+\definehighlight [nonproportional] [style=emphasis:nonproportional] %% font switch
+
+\definetype [fileent] [style=typing:fileent]
+\definetype [luafunction] [style=typing:luafunction]
+\setuptyping [style=ttx]
+
+\definebodyfontenvironment [8pt]
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% headings
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\setuphead [section] [style=head:section, alternative=inmargin]
+\setuphead [subsection] [style=head:subsection, alternative=inmargin]
+\setuphead [subsubsection] [style=head:subsubsection,alternative=inmargin]
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% running headers
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\setupheadertexts
+ [{\tfx \getmarking[section]}] [pagenumber]
+ [pagenumber] [{\tfx \fileent{Luaotfload} Manual}]
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% structurals
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%% section
+\def \beginsection {\dosingleempty \section_begin_indeed}
+
+\def \section_begin_indeed [#ref]#title{%
+ \iffirstargument
+ \startsection [reference=#ref,title=#title]%
+ \else
+ \startsection [title=#title]%
+ \fi
+}
+
+\let \endsection \stopsection
+
+%% subsection
+\def \beginsubsection {\dosingleempty \section_begin_indeed}
+
+\def \subsection_begin_indeed [#ref]#title{%
+ \iffirstargument
+ \startsubsection [reference=#ref,title=#title]%
+ \else
+ \startsubsection [title=#title]%
+ \fi
+}
+
+\let \endsubsection \stopsection
+
+%% subsubsection
+\def \beginsubsubsection {\dosingleempty \section_begin_indeed}
+
+\def \subsubsection_begin_indeed [#ref]#title{%
+ \iffirstargument
+ \startsubsubsection [reference=#ref,title=#title]%
+ \else
+ \startsubsubsection [title=#title]%
+ \fi
+}
+
+\let \endsubsubsection \stopsection
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% inline verbatim
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%% Context offers both \type{…} and \type<<…>>, but not an unbalanced
+%% one that we could map directly onto Latex’s \verb|…|.
+
+\definetype [inlinecode] [style=emphasis:nonproportional]
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% codelistings
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Now *that’s* what I call easy.
+
+\unexpanded \def \beginlisting {%
+ \grabbufferdatadirect{listing}{beginlisting}{endlisting}%
+}
+
+\unexpanded \def \endlisting {\typebuffer [listing]}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% enumerations and lists
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\definedescription [descriptionitem] [
+ align=right,
+ alternative=hanging,
+ width=2em,
+]
+
+\def \begindescriptions {%
+ \begingroup
+ \def \beginnormalitem ##1\endnormalitem{%
+ \startitem##1\stopitem
+ }
+ \let \endnormalitem \relax
+ \let \beginaltitem \startdescriptionitem
+ \let \endaltitem \stopdescriptionitem
+}
+
+\let \enddescriptions \endgroup
+
+
+\definedescription [definitionitem] [
+ align=right,
+ alternative=hanging,
+]
+
+\def \begindefinitions {%
+ \begingroup
+ \def \beginnormalitem ##1\endnormalitem{%
+ \startitem##1\stopitem
+ }
+ \let \endnormalitem \relax
+ \let \beginaltitem \startdefinitionitem
+ \let \endaltitem \stopdefinitionitem
+}
+
+\let \enddefinitions \endgroup
+
+
+\definedescription [filelistitem] [
+ align=normal,
+ alternative=hanging,
+ headstyle=typing:fileent,
+ width=4cm,
+]
+
+\def \beginfilelist {%
+ \begingroup
+ \def \beginnormalitem ##1\endnormalitem{%
+ \startitem##1\stopitem
+ }
+ \let \endnormalitem \relax
+ \let \beginaltitem \startfilelistitem
+ \let \endaltitem \stopfilelistitem
+}
+
+\let \endfilelist \endgroup
+
+\definedescription [functionlistitem] [
+ align=normal,
+ alternative=hanging,
+ headstyle=typing:luafunction,
+ width=4cm,
+]
+
+\def \beginfunctionlist {%
+ \begingroup
+ \def \beginnormalitem ##1\endnormalitem{%
+ \startitem##1\stopitem
+ }
+ \let \endnormalitem \relax
+ \let \beginaltitem \startfunctionlistitem
+ \let \endaltitem \stopfunctionlistitem
+}
+
+\let \endfunctionlist \endgroup
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% columns
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\def \begindoublecolumns {\startcolumns [2]}
+\let \enddoublecolumns \stopcolumns
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% alignment
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\setupnarrower [before={\blank[line]},after={\blank[line]}]
+\let \beginnarrower \startnarrower
+\let \endnarrower \stopnarrower
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% special elements
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\def \meta #1{<{\italic #1}>}
+
+\def \beginabstractcontent {%
+ \grabbufferdatadirect{abstractcontent}{beginabstractcontent}{endabstractcontent}%
+}
+
+\let \endabstractcontent \relax
+
+\def \setdocumenttitle #1{\setvalue {document_title}{#1}}
+\def \setdocumentdate #1{\setvalue {document_date}{#1}}
+\def \setdocumentauthor #1{\setvalue {document_author}{#1}}
+
+\let \typesetdocumenttitle \relax
+\let \beginfrontmatter \relax
+
+\def \endfrontmatter {
+ \startstandardmakeup
+ \vfill
+ \strut \hfill
+ \startframed [frame=off,align=middle,width=.5\textwidth]
+ \Largefont{\getvalue {document_title}}
+ \stopframed
+ \hfill \strut \par
+
+ \blank [2*big]
+
+ \strut \hfill
+ \startframed [frame=off,align=middle,width=.65\textwidth]
+ \setuplocalinterlinespace [18pt]
+ \getvalue {document_author}
+ \stopframed
+ \hfill \strut \par
+
+ \vfill
+ \strut \hfill \getvalue {document_date} \hfill \strut
+ \blank [2*big]
+
+ \strut \hfill
+ \startframed [width=.7\textwidth,align=normal,style=tfx,frame=off]%
+ \getbuffer [abstractcontent]
+ \stopframed
+ \hfill \strut
+ \stopstandardmakeup
+}
+
+\let \typesetcontent \completecontent
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% floats
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% XXX we can improve on this part later
+
+\usemodule [vim]
+\definevimtyping [bnf] [syntax=bnf]
+\definefloat [syntax] [figure]
+
+\def \beginsyntaxfloat #reference#caption{%
+ \begingroup
+ \edef \currentreference {#reference}%
+ \edef \currentcaption {#caption}%
+ \grabbufferdatadirect{rawsyntaxdata}{beginsyntaxfloat}{endsyntaxfloat}%
+}
+
+\def \endsyntaxfloat {%
+ \savebuffer [rawsyntaxdata] [rawsyntaxdata]
+ \startplacesyntax [
+ reference=\currentreference,
+ title={\currentcaption},
+ ]
+ %% there’s no \typebnfbuffer in t-vim :(
+ \typebnffile {\jobname-rawsyntaxdata.tmp}
+ \stopplacesyntax
+ \endgroup%
+}
+
+\def \figurefloat #reference#caption#file{%
+ \startplacefigure [
+ reference=#reference,
+ title={#caption},
+ ]
+ \externalfigure [#file] [width=\textwidth]
+ \stopplacefigure
+}
+
+
+\def \tablefloat #reference#caption#content{%
+ \startplacetable [
+ reference=#reference,
+ title={#caption},
+ ]
+ #content
+ \stopplacetable
+}
+
+
+%% tables
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% tables
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\setupxtable [frame=off,option=stretch,textwidth=\dimexpr(\textwidth/2)]
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% hyperlinks and references
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\unexpanded \def \hyperlink{%
+ \dosingleempty \hyperlink_indeed%
+}
+
+\def \hyperlink_indeed [#text]#url{%
+ \iffirstargument
+ \useURL [temporary_url] [#url] [] [#text]%
+ \else
+ \useURL [temporary_url] [#url]%
+ \fi%
+ \from [temporary_url]%
+}
+
+
+\def \email #1{\goto{#1}[url(mailto:#1)]}
+
+\def \label #tag{\reference [#tag]\empty}
+\def \pageref #tag{\at{page}{#tag}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% escaped characters
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\let \charpercent \letterpercent
+\let \charbackslash \letterbackslash
+\let \chartilde \lettertilde
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% main
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\protect
+
+\newif \ifcontextmkiv \contextmkivtrue
+
+\starttext
+ \input luaotfload-main.tex
+\stoptext
+
diff --git a/doc/luaotfload-latex.tex b/doc/luaotfload-latex.tex
index 42799bf..3045c26 100644
--- a/doc/luaotfload-latex.tex
+++ b/doc/luaotfload-latex.tex
@@ -245,6 +245,8 @@
\def \first {####1}%
#2
}
+ \let \beginaltitem \altitem
+ \let \endaltitem \relax
}
\expandafter \def \csname end#1\endcsname {%
diff --git a/doc/luaotfload-main.tex b/doc/luaotfload-main.tex
index 0098405..0e74aa9 100644
--- a/doc/luaotfload-main.tex
+++ b/doc/luaotfload-main.tex
@@ -1,3 +1,16 @@
+%\beginsection {foo}
+ %bar baz
+%\endsection
+
+%\begindescriptions
+
+ %\beginaltitem {mode} foo
+ %%\identifier{luaotfload} has two \OpenType processing
+ %%\emphasis{modes}:
+%\enddescriptions
+
+%\endinput
+
%% Copyright (C) 2009-2014
%%
%% by Elie Roux <elie.roux@telecom-bretagne.eu>
@@ -514,7 +527,7 @@ obviously, \inlinecode{random}.
\begindescriptions
- \altitem {mode}
+ \beginaltitem {mode}
\identifier{luaotfload} has two \OpenType processing
\emphasis{modes}:
\identifier{base} and \identifier{node}.
@@ -536,8 +549,9 @@ obviously, \inlinecode{random}.
By default \identifier{luaotfload} is in \identifier{node}
mode, and \identifier{base} mode has to be requested where needed,
e.~g. for math fonts.
+ \endaltitem
- \altitem {script} \label{script-tag}
+ \beginaltitem {script} \label{script-tag}
An \OpenType script tag;\footnote{%
See \hyperlink {http://www.microsoft.com/typography/otspec/scripttags.htm}
for a list of valid values.
@@ -550,14 +564,16 @@ obviously, \inlinecode{random}.
Some fonts, including very popular ones by foundries like Adobe,
do not assign features to the \inlinecode{dflt} script, in
which case the script needs to be set explicitly.
+ \endaltitem
- \altitem {language}
+ \beginaltitem {language}
An \OpenType language system identifier,\footnote{%
Cf. \hyperlink {http://www.microsoft.com/typography/otspec/languagetags.htm}.
}
defaulting to \inlinecode{dflt}.
+ \endaltitem
- \altitem {featurefile}
+ \beginaltitem {featurefile}
A comma-separated list of feature files to be applied to the
font.
%
@@ -585,8 +601,9 @@ obviously, \inlinecode{random}.
It can be read and applied as follows:
\inlinecode{\\font \\test = Latin Modern Roman:featurefile=tkrn.fea;+tkrn}
+ \endaltitem
- \altitem {color}
+ \beginaltitem {color}
A font color, defined as a triplet of two-digit hexadecimal
\abbrev{rgb} values, with an optional fourth value for
transparency
@@ -598,8 +615,9 @@ obviously, \inlinecode{random}.
\beginlisting
\font \test = "Latin Modern Roman:color=FF0000BB"
\endlisting
+ \endaltitem
- \altitem {kernfactor \& letterspace}
+ \beginaltitem {kernfactor \& letterspace}
Define a font with letterspacing (tracking) enabled.
%
In \identifier{luaotfload}, letterspacing is implemented by
@@ -660,9 +678,10 @@ obviously, \inlinecode{random}.
%
The implementation of both functions is left entirely to the
user.
+ \endaltitem
- \altitem {protrusion \& expansion}
+ \beginaltitem {protrusion \& expansion}
These keys control microtypographic features of the font,
namely \emphasis{character protrusion} and \emphasis{font
expansion}.
@@ -698,6 +717,7 @@ obviously, \inlinecode{random}.
\beginlisting
\font \test = LatinModernRoman:protrusion=default
\endlisting
+ \endaltitem
\enddescriptions
\endsubsection
@@ -711,12 +731,13 @@ Currently (2014) there are three of them:
\begindescriptions
- \altitem {anum}
+ \beginaltitem {anum}
Substitutes the glyphs in the \abbrev{ascii} number range
with their counterparts from eastern Arabic or Persian,
depending on the value of \identifier{language}.
+ \endaltitem
- \altitem {tlig}
+ \beginaltitem {tlig}
Applies legacy \TEX ligatures:
\begintabulate [rlrl]
@@ -735,9 +756,11 @@ Currently (2014) there are three of them:
assignment \inlinecode {mapping=text-tex} using \XETEX's input
remapping feature.
}
+ \endaltitem
- \altitem {itlc}
+ \beginaltitem {itlc}
Computes italic correction values (active by default).
+ \endaltitem
\enddescriptions
@@ -1050,11 +1073,16 @@ categories.
\begindoublecolumns
\begindefinitions
- \altitem{l-lua.lua} \altitem{l-lpeg.lua}
- \altitem{l-function.lua} \altitem{l-string.lua}
- \altitem{l-table.lua} \altitem{l-io.lua}
- \altitem{l-file.lua} \altitem{l-boolean.lua}
- \altitem{l-math.lua} \altitem{util-str.lua}
+ \beginaltitem {l-lua.lua} \endaltitem
+ \beginaltitem {l-lpeg.lua} \endaltitem
+ \beginaltitem {l-function.lua} \endaltitem
+ \beginaltitem {l-string.lua} \endaltitem
+ \beginaltitem {l-table.lua} \endaltitem
+ \beginaltitem {l-io.lua} \endaltitem
+ \beginaltitem {l-file.lua} \endaltitem
+ \beginaltitem {l-boolean.lua} \endaltitem
+ \beginaltitem {l-math.lua} \endaltitem
+ \beginaltitem {util-str.lua} \endaltitem
\enddefinitions
\enddoublecolumns
@@ -1064,18 +1092,18 @@ categories.
with \identifier{luaotfload}.
\begindoublecolumns
\begindefinitions
- \altitem{luatex-basics-gen.lua}
- \altitem{luatex-basics-nod.lua}
- \altitem{luatex-fonts-enc.lua}
- \altitem{luatex-fonts-syn.lua}
- \altitem{luatex-fonts-tfm.lua}
- \altitem{luatex-fonts-chr.lua}
- \altitem{luatex-fonts-lua.lua}
- \altitem{luatex-fonts-inj.lua}
- \altitem{luatex-fonts-otn.lua}
- \altitem{luatex-fonts-def.lua}
- \altitem{luatex-fonts-ext.lua}
- \altitem{luatex-fonts-cbk.lua}
+ \beginaltitem{luatex-basics-gen.lua} \endaltitem
+ \beginaltitem{luatex-basics-nod.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
@@ -1084,12 +1112,17 @@ categories.
\CONTEXT.
\begindoublecolumns
\begindefinitions
- \altitem{data-con.lua} \altitem{font-ini.lua}
- \altitem{font-con.lua} \altitem{font-cid.lua}
- \altitem{font-map.lua} \altitem{font-oti.lua}
- \altitem{font-otf.lua} \altitem{font-otb.lua}
- \altitem{font-ota.lua} \altitem{font-def.lua}
- \altitem{font-otp.lua}
+ \beginaltitem{data-con.lua} \endaltitem
+ \beginaltitem{font-ini.lua} \endaltitem
+ \beginaltitem{font-con.lua} \endaltitem
+ \beginaltitem{font-cid.lua} \endaltitem
+ \beginaltitem{font-map.lua} \endaltitem
+ \beginaltitem{font-oti.lua} \endaltitem
+ \beginaltitem{font-otf.lua} \endaltitem
+ \beginaltitem{font-otb.lua} \endaltitem
+ \beginaltitem{font-ota.lua} \endaltitem
+ \beginaltitem{font-def.lua} \endaltitem
+ \beginaltitem{font-otp.lua} \endaltitem
\enddefinitions
\enddoublecolumns
\enddefinitions
@@ -1122,22 +1155,33 @@ files not contained in the merge. Some of these have no equivalent in
\beginfilelist
- \altitem {luaotfload-features.lua} font feature handling;
- incorporates some of the code from
- \fileent{font-otc} from \CONTEXT;
- \altitem {luaotfload-override.lua} overrides the \CONTEXT logging
- functionality.
- \altitem {luaotfload-loaders.lua} registers the \OpenType
- font reader as handler for
- Postscript fonts
- (\abbrev{pfa}, \abbrev{pfb}).
- \altitem {luaotfload-parsers.lua} various \abbrev{lpeg}-based parsers.
- \altitem {luaotfload-database.lua} font names database.
- \altitem {luaotfload-colors.lua} color handling.
- \altitem {luaotfload-auxiliary.lua} access to internal functionality
- for package authors
- (proposals for additions welcome).
- \altitem {luaotfload-letterspace.lua} font-based letterspacing.
+ \beginaltitem {luaotfload-features.lua}
+ font feature handling; incorporates some of the code from
+ \fileent{font-otc} from \CONTEXT;
+ \endaltitem
+ \beginaltitem {luaotfload-override.lua}
+ overrides the \CONTEXT logging functionality.
+ \endaltitem
+ \beginaltitem {luaotfload-loaders.lua}
+ registers the \OpenType font reader as handler for Postscript
+ fonts (\abbrev{pfa}, \abbrev{pfb}).
+ \endaltitem
+ \beginaltitem {luaotfload-parsers.lua}
+ various \abbrev{lpeg}-based parsers.
+ \endaltitem
+ \beginaltitem {luaotfload-database.lua}
+ font names database.
+ \endaltitem
+ \beginaltitem {luaotfload-colors.lua}
+ color handling.
+ \endaltitem
+ \beginaltitem {luaotfload-auxiliary.lua}
+ access to internal functionality for package authors (proposals
+ for additions welcome).
+ \endaltitem
+ \beginaltitem {luaotfload-letterspace.lua}
+ font-based letterspacing.
+ \endaltitem
\endfilelist
\beginfigurefloat
@@ -1243,14 +1287,17 @@ These are mostly concerned with establishing compatibility with \XETEX.
\beginfunctionlist
- \altitem {set_sscale_dimens}
- Calculate \texmacro{fontdimen}s 10 and 11 to emulate \XETEX.
+ \beginaltitem {set_sscale_dimens}
+ Calculate \texmacro{fontdimen}s 10 and 11 to emulate \XETEX.
+ \endaltitem
- \altitem {set_capheight}
- Calculates \texmacro{fontdimen} 8 like \XETEX.
+ \beginaltitem {set_capheight}
+ Calculates \texmacro{fontdimen} 8 like \XETEX.
+ \endaltitem
- \altitem {patch_cambria_domh}
- Correct some values of the font \emphasis{Cambria Math}.
+ \beginaltitem {patch_cambria_domh}
+ Correct some values of the font \emphasis{Cambria Math}.
+ \endaltitem
\endfunctionlist
@@ -1271,38 +1318,46 @@ are defined for which scripts.
\beginfunctionlist
- \altitem {aux.font_has_glyph (id : int, index : int)}
+ \beginaltitem {aux.font_has_glyph (id : int, index : int)}
Predicate that returns true if the font \luafunction{id}
has glyph \luafunction{index}.
+ \endaltitem
- \altitem {aux.slot_of_name(name : string)}
+ \beginaltitem {aux.slot_of_name(name : string)}
Translates an Adobe Glyph name to the corresponding glyph
slot.
+ \endaltitem
- \altitem {aux.name_of_slot(slot : int)}
+ \beginaltitem {aux.name_of_slot(slot : int)}
The inverse of \luafunction{slot_of_name}; note that this
might be incomplete as multiple glyph names may map to the
same codepoint, only one of which is returned by
\luafunction{name_of_slot}.
+ \endaltitem
- \altitem {aux.provides_script(id : int, script : string)}
+ \beginaltitem {aux.provides_script(id : int, script : string)}
Test if a font supports \luafunction{script}.
+ \endaltitem
- \altitem {aux.provides_language(id : int, script : string, language : string)}
+ \beginaltitem {aux.provides_language(id : int, script : string, language : string)}
Test if a font defines \luafunction{language} for a given
\luafunction{script}.
+ \endaltitem
- \altitem {aux.provides_feature(id : int, script : string,
+ \beginaltitem {aux.provides_feature(id : int, script : string,
language : string, feature : string)}
Test if a font defines \luafunction{feature} for
\luafunction{language} for a given \luafunction{script}.
+ \endaltitem
- \altitem {aux.get_math_dimension(id : int, dimension : string)}
+ \beginaltitem {aux.get_math_dimension(id : int, dimension : string)}
Get the dimension \luafunction{dimension} of font \luafunction{id}.
+ \endaltitem
- \altitem {aux.sprint_math_dimension(id : int, dimension : string)}
+ \beginaltitem {aux.sprint_math_dimension(id : int, dimension : string)}
Same as \luafunction{get_math_dimension()}, but output the value
in scaled points at the \TEX end.
+ \endaltitem
\endfunctionlist
@@ -1312,7 +1367,7 @@ are defined for which scripts.
% \beginsubsubsection{Database}
%
% \beginfunctionlist
-% \altitem {aux.scan_external_dir(dir : string)}
+% \beginaltitem {aux.scan_external_dir(dir : string)}
% Include fonts in directory \luafunction{dir} in font lookups without
% adding them to the database.
%
diff --git a/src/luaotfload-fontloader.lua b/src/luaotfload-fontloader.lua
index 3f408b9..d1b12bb 100644
--- a/src/luaotfload-fontloader.lua
+++ b/src/luaotfload-fontloader.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 02/14/14 17:07:59
+-- merge date : 03/07/14 11:42:21
do -- begin closure to overcome local limits and interference
@@ -901,6 +901,36 @@ local function sortedkeys(tab)
return {}
end
end
+local function sortedhashonly(tab)
+ if tab then
+ local srt,s={},0
+ for key,_ in next,tab do
+ if type(key)=="string" then
+ s=s+1
+ srt[s]=key
+ end
+ end
+ sort(srt)
+ return srt
+ else
+ return {}
+ end
+end
+local function sortedindexonly(tab)
+ if tab then
+ local srt,s={},0
+ for key,_ in next,tab do
+ if type(key)=="number" then
+ s=s+1
+ srt[s]=key
+ end
+ end
+ sort(srt)
+ return srt
+ else
+ return {}
+ end
+end
local function sortedhashkeys(tab,cmp)
if tab then
local srt,s={},0
@@ -926,6 +956,8 @@ function table.allkeys(t)
return sortedkeys(keys)
end
table.sortedkeys=sortedkeys
+table.sortedhashonly=sortedhashonly
+table.sortedindexonly=sortedindexonly
table.sortedhashkeys=sortedhashkeys
local function nothing() end
local function sortedhash(t,cmp)
@@ -1723,7 +1755,7 @@ local byte,find,gsub,format=string.byte,string.find,string.gsub,string.format
local concat=table.concat
local floor=math.floor
local type=type
-if string.find(os.getenv("PATH"),";") then
+if string.find(os.getenv("PATH"),";",1,true) then
io.fileseparator,io.pathseparator="\\",";"
else
io.fileseparator,io.pathseparator="/",":"
@@ -2607,11 +2639,39 @@ local pattern=Carg(1)/function(t)
function strings.tabtospace(str,tab)
return lpegmatch(pattern,str,1,tab or 7)
end
-function strings.striplong(str)
- str=gsub(str,"^%s*","")
- str=gsub(str,"[\n\r]+ *","\n")
- return str
+local newline=patterns.newline
+local endofstring=patterns.endofstring
+local whitespace=patterns.whitespace
+local spacer=patterns.spacer
+local space=spacer^0
+local nospace=space/""
+local endofline=nospace*newline
+local stripend=(whitespace^1*endofstring)/""
+local normalline=(nospace*((1-space*(newline+endofstring))^1)*nospace)
+local stripempty=endofline^1/""
+local normalempty=endofline^1
+local singleempty=endofline*(endofline^0/"")
+local doubleempty=endofline*endofline^-1*(endofline^0/"")
+local stripstart=stripempty
+local p_retain_normal=Cs ((normalline+normalempty )^0 )
+local p_retain_collapse=Cs ((normalline+doubleempty )^0 )
+local p_retain_noempty=Cs ((normalline+singleempty )^0 )
+local p_prune_normal=Cs (stripstart*(stripend+normalline+normalempty )^0 )
+local p_prune_collapse=Cs (stripstart*(stripend+normalline+doubleempty )^0 )
+local p_prune_noempty=Cs (stripstart*(stripend+normalline+singleempty )^0 )
+local striplinepatterns={
+ ["prune"]=p_prune_normal,
+ ["prune and collapse"]=p_prune_collapse,
+ ["prune and no empty"]=p_prune_noempty,
+ ["retain"]=p_retain_normal,
+ ["retain and collapse"]=p_retain_collapse,
+ ["retain and no empty"]=p_retain_noempty,
+}
+strings.striplinepatterns=striplinepatterns
+function strings.striplines(str,how)
+ return str and lpegmatch(how and striplinepatterns[how] or p_prune_collapse,str) or str
end
+strings.striplong=strings.striplines
function strings.nice(str)
str=gsub(str,"[:%-+_]+"," ")
return str
@@ -6504,7 +6564,7 @@ local report_otf=logs.reporter("fonts","otf loading")
local fonts=fonts
local otf=fonts.handlers.otf
otf.glists={ "gsub","gpos" }
-otf.version=2.751
+otf.version=2.754
otf.cache=containers.define("fonts","otf",otf.version,true)
local fontdata=fonts.hashes.identifiers
local chardata=characters and characters.data
@@ -7047,15 +7107,22 @@ actions["prepare glyphs"]=function(data,filename,raw)
local glyph=cidglyphs[index]
if glyph then
local unicode=glyph.unicode
+if unicode>=0x00E000 and unicode<=0x00F8FF then
+ unicode=-1
+elseif unicode>=0x0F0000 and unicode<=0x0FFFFD then
+ unicode=-1
+elseif unicode>=0x100000 and unicode<=0x10FFFD then
+ unicode=-1
+end
local name=glyph.name or cidnames[index]
- if not unicode or unicode==-1 or unicode>=criterium then
+ if not unicode or unicode==-1 then
unicode=cidunicodes[index]
end
if unicode and descriptions[unicode] then
report_otf("preventing glyph %a at index %H to overload unicode %U",name or "noname",index,unicode)
unicode=-1
end
- if not unicode or unicode==-1 or unicode>=criterium then
+ if not unicode or unicode==-1 then
if not name then
name=format("u%06X",private)
end
@@ -7101,7 +7168,7 @@ actions["prepare glyphs"]=function(data,filename,raw)
if glyph then
local unicode=glyph.unicode
local name=glyph.name
- if not unicode or unicode==-1 or unicode>=criterium then
+ if not unicode or unicode==-1 then
unicode=private
unicodes[name]=private
if trace_private then
@@ -7156,47 +7223,43 @@ actions["check encoding"]=function(data,filename,raw)
local unicodetoindex=mapdata and mapdata.map or {}
local indextounicode=mapdata and mapdata.backmap or {}
local encname=lower(data.enc_name or mapdata.enc_name or "")
- local criterium=0xFFFF
+ local criterium=0xFFFF
+ local privateoffset=constructors.privateoffset
if find(encname,"unicode") then
if trace_loading then
report_otf("checking embedded unicode map %a",encname)
end
- local hash={}
- for index,unicode in next,indices do
- hash[index]=descriptions[unicode]
- end
- local reported={}
- for unicode,index in next,unicodetoindex do
- if not descriptions[unicode] then
- local d=hash[index]
+ local reported={}
+ for maybeunicode,index in next,unicodetoindex do
+ if descriptions[maybeunicode] then
+ else
+ local unicode=indices[index]
+ if not unicode then
+ elseif maybeunicode==unicode then
+ elseif unicode>privateoffset then
+ else
+ local d=descriptions[unicode]
if d then
- if d.unicode~=unicode then
- local c=d.copies
- if c then
- c[unicode]=true
- else
- d.copies={ [unicode]=true }
- end
+ local c=d.copies
+ if c then
+ c[maybeunicode]=true
+ else
+ d.copies={ [maybeunicode]=true }
end
- elseif not reported[i] then
+ elseif index and not reported[index] then
report_otf("missing index %i",index)
- reported[i]=true
+ reported[index]=true
end
end
end
- for index,data in next,hash do
- data.copies=sortedkeys(data.copies)
- end
- for index,unicode in next,indices do
- local description=hash[index]
- local copies=description.copies
- if copies then
- duplicates[unicode]=copies
- description.copies=nil
- else
- report_otf("copies but no unicode parent %U",unicode)
- end
+ end
+ for unicode,data in next,descriptions do
+ local d=data.copies
+ if d then
+ duplicates[unicode]=sortedkeys(d)
+ data.copies=nil
end
+ end
elseif properties.cidinfo then
report_otf("warning: no unicode map, used cidmap %a",properties.cidinfo.usedname)
else
@@ -7238,7 +7301,7 @@ actions["add duplicates"]=function(data,filename,raw)
end
end
end
- if u>0 then
+ if u>0 then
local duplicate=table.copy(description)
duplicate.comment=format("copy of U+%05X",unicode)
descriptions[u]=duplicate
@@ -7440,10 +7503,16 @@ actions["reorganize subtables"]=function(data,filename,raw)
report_otf("skipping weird lookup number %s",k)
elseif features then
local f={}
+ local o={}
for i=1,#features do
local df=features[i]
local tag=strip(lower(df.tag))
- local ft=f[tag] if not ft then ft={} f[tag]=ft end
+ local ft=f[tag]
+ if not ft then
+ ft={}
+ f[tag]=ft
+ o[#o+1]=tag
+ end
local dscripts=df.scripts
for i=1,#dscripts do
local d=dscripts[i]
@@ -7463,6 +7532,7 @@ actions["reorganize subtables"]=function(data,filename,raw)
subtables=subtables,
markclass=markclass,
features=f,
+ order=o,
}
else
lookups[name]={
@@ -9042,9 +9112,9 @@ function injections.setkern(current,factor,rlmode,x,tfmchr)
return 0,0
end
end
-function injections.setmark(start,base,factor,rlmode,ba,ma,index,baseismark)
- local dx,dy=factor*(ba[1]-ma[1]),factor*(ba[2]-ma[2])
- local bound=base[a_markbase]
+function injections.setmark(start,base,factor,rlmode,ba,ma)
+ local dx,dy=factor*(ba[1]-ma[1]),factor*(ba[2]-ma[2])
+ local bound=base[a_markbase]
local index=1
if bound then
local mb=marks[bound]
@@ -9063,7 +9133,7 @@ function injections.setmark(start,base,factor,rlmode,ba,ma,index,baseismark)
base[a_markbase]=bound
start[a_markmark]=bound
start[a_markdone]=index
- marks[bound]={ [index]={ dx,dy,rlmode,baseismark } }
+ marks[bound]={ [index]={ dx,dy,rlmode } }
return dx,dy,bound
end
local function dir(n)
@@ -11412,10 +11482,13 @@ end)
local autofeatures=fonts.analyzers.features
local function initialize(sequence,script,language,enabled)
local features=sequence.features
- if features then
- for kind,scripts in next,features do
+ local order=features.order
+ if order then
+ for i=1,#order do
+ local kind=order[i]
local valid=enabled[kind]
if valid then
+ local scripts=features[kind]
local languages=scripts[script] or scripts[wildcard]
if languages and (languages[language] or languages[wildcard]) then
return { valid,autofeatures[kind] or false,sequence.chain or 0,kind,sequence }
@@ -11447,12 +11520,12 @@ function otf.dataset(tfmdata,font)
}
rs[language]=rl
local sequences=tfmdata.resources.sequences
-for s=1,#sequences do
- local v=enabled and initialize(sequences[s],script,language,enabled)
- if v then
- rl[#rl+1]=v
- end
-end
+ for s=1,#sequences do
+ local v=enabled and initialize(sequences[s],script,language,enabled)
+ if v then
+ rl[#rl+1]=v
+ end
+ end
end
return rl
end
@@ -12479,6 +12552,14 @@ local function packdata(data)
features[script]=pack_normal(feature)
end
end
+ local order=sequence.order
+ if order then
+ sequence.order=pack_indexed(order)
+ end
+ local markclass=sequence.markclass
+ if markclass then
+ sequence.markclass=pack_boolean(markclass)
+ end
end
end
local lookups=resources.lookups
@@ -12891,6 +12972,20 @@ local function unpackdata(data)
end
end
end
+ local order=feature.order
+ if order then
+ local tv=tables[order]
+ if tv then
+ feature.order=tv
+ end
+ end
+ local markclass=feature.markclass
+ if markclass then
+ local tv=tables[markclass]
+ if tv then
+ feature.markclass=tv
+ end
+ end
end
end
local lookups=resources.lookups