From c63c0a57f15b491b56b82104a6896e3f0630a778 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 12 May 2013 22:44:11 +0000 Subject: luaotfload (12may13) git-svn-id: svn://tug.org/texlive/trunk@30425 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/luatex/luaotfload/Makefile | 38 +++++-- .../source/luatex/luaotfload/luaotfload.dtx | 125 ++++++++++++++------- 2 files changed, 112 insertions(+), 51 deletions(-) (limited to 'Master/texmf-dist/source/luatex/luaotfload') diff --git a/Master/texmf-dist/source/luatex/luaotfload/Makefile b/Master/texmf-dist/source/luatex/luaotfload/Makefile index 98b54911ba0..c1e98f652fe 100644 --- a/Master/texmf-dist/source/luatex/luaotfload/Makefile +++ b/Master/texmf-dist/source/luatex/luaotfload/Makefile @@ -3,23 +3,29 @@ NAME = luaotfload DOC = $(NAME).pdf DTX = $(NAME).dtx -OTFL = $(wildcard luaotfload-*.lua) luaotfload-blacklist.cnf $(GLYPHS) -SCRIPT = luaotfload-tool.lua +OTFL = $(wildcard luaotfload-*.lua) luaotfload-blacklist.cnf GLYPHSCRIPT = mkglyphlist GLYPHSOURCE = glyphlist.txt -GRAPH = filegraph -DOTPDF = $(GRAPH).pdf -DOT = $(GRAPH).dot +SCRIPTNAME = luaotfload-tool +SCRIPT = $(SCRIPTNAME).lua +MANSOURCE = $(SCRIPTNAME).rst +MANPAGE = $(SCRIPTNAME).1 +OLDSCRIPT = luaotfload-legacy-tool.lua + +GRAPH = filegraph +DOTPDF = $(GRAPH).pdf +DOT = $(GRAPH).dot # Files grouped by generation mode -GLYPHS = font-age.lua +GLYPHS = luaotfload-glyphlist.lua GRAPHED = $(DOTPDF) +MAN = $(MANPAGE) COMPILED = $(DOC) UNPACKED = luaotfload.sty luaotfload.lua -GENERATED = $(GRAPHED) $(UNPACKED) $(COMPILED) $(GLYPHS) -SOURCE = $(DTX) $(OTFL) README Makefile NEWS $(SCRIPT) $(GLYPHSCRIPT) +GENERATED = $(GRAPHED) $(UNPACKED) $(COMPILED) $(GLYPHS) $(MAN) +SOURCE = $(DTX) $(MANSOURCE) $(OTFL) README Makefile NEWS $(SCRIPT) $(OLDSCRIPT) $(GLYPHSCRIPT) # test files TESTDIR = tests @@ -28,9 +34,10 @@ TESTFILES_SYS = $(TESTDIR)/systemfonts.tex $(TESTDIR)/fontconfig_conf_reading.t TESTFILES_TL = $(filter-out $(TESTFILES_SYS), $(TESTFILES)) # Files grouped by installation location -SCRIPTFILES = $(SCRIPT) $(GLYPHSCRIPT) +SCRIPTFILES = $(SCRIPT) $(OLDSCRIPT) $(GLYPHSCRIPT) RUNFILES = $(UNPACKED) $(OTFL) DOCFILES = $(DOC) $(DOTPDF) README NEWS +MANFILES = $(MANPAGE) SRCFILES = $(DTX) Makefile # The following definitions should be equivalent @@ -42,6 +49,7 @@ FORMAT = luatex SCRIPTDIR = $(TEXMFROOT)/scripts/$(NAME) RUNDIR = $(TEXMFROOT)/tex/$(FORMAT)/$(NAME) DOCDIR = $(TEXMFROOT)/doc/$(FORMAT)/$(NAME) +MANDIR = $(TEXMFROOT)/doc/man/man1/ SRCDIR = $(TEXMFROOT)/source/$(FORMAT)/$(NAME) TEXMFROOT = $(shell kpsewhich --var-value TEXMFHOME) @@ -49,18 +57,20 @@ CTAN_ZIP = $(NAME).zip TDS_ZIP = $(NAME).tds.zip ZIPS = $(CTAN_ZIP) $(TDS_ZIP) -DO_TEX = tex --interaction=batchmode $< >/dev/null +DO_TEX = luatex --interaction=batchmode $< >/dev/null # (with the next version of latexmk: -pdf -pdflatex=lualatex) DO_LATEX = latexmk -pdf -e '$$pdflatex = q(lualatex %O %S)' -silent $< >/dev/null DO_GRAPHVIZ = dot -Tpdf -o $@ $< > /dev/null DO_GLYPHLIST = texlua ./mkglyphlist > /dev/null +DO_DOCUTILS = rst2man2 $< >$@ 2>/dev/null all: $(GENERATED) graph: $(GRAPHED) -doc: $(GRAPHED) $(COMPILED) +doc: $(GRAPHED) $(COMPILED) $(MAN) +manual: $(MAN) unpack: $(UNPACKED) glyphs: $(GLYPHS) -ctan: check $(CTAN_ZIP) +ctan: $(CTAN_ZIP) tds: $(TDS_ZIP) world: all ctan @@ -76,6 +86,9 @@ $(COMPILED): $(DTX) $(UNPACKED): $(DTX) $(DO_TEX) +$(MAN): $(MANSOURCE) + $(DO_DOCUTILS) + $(CTAN_ZIP): $(SOURCE) $(COMPILED) $(TDS_ZIP) @echo "Making $@ for CTAN upload." @$(RM) -- $@ @@ -86,6 +99,7 @@ define run-install @mkdir -p $(RUNDIR) && cp $(RUNFILES) $(RUNDIR) @mkdir -p $(DOCDIR) && cp $(DOCFILES) $(DOCDIR) @mkdir -p $(SRCDIR) && cp $(SRCFILES) $(SRCDIR) +@mkdir -p $(MANDIR) && cp $(MANFILES) $(MANDIR) endef $(TDS_ZIP): TEXMFROOT=./tmp-texmf diff --git a/Master/texmf-dist/source/luatex/luaotfload/luaotfload.dtx b/Master/texmf-dist/source/luatex/luaotfload/luaotfload.dtx index 2f88225781a..7ccd6e88c65 100644 --- a/Master/texmf-dist/source/luatex/luaotfload/luaotfload.dtx +++ b/Master/texmf-dist/source/luatex/luaotfload/luaotfload.dtx @@ -133,7 +133,7 @@ and the derived files \usepackage{fontspec} \usepackage{unicode-math} \setmainfont[ - Numbers = OldStyle, +% Numbers = OldStyle, %% buggy with font cache Ligatures = TeX, BoldFont = {Linux Libertine O Bold}, ItalicFont = {Linux Libertine O Italic}, @@ -146,14 +146,15 @@ and the derived files \usepackage{hologo} -\newcommand\TEX {\TeX\xspace} -\newcommand\LUA {Lua\xspace} -\newcommand\PDFTEX {pdf\TeX\xspace} -\newcommand\LUATEX {Lua\TeX\xspace} -\newcommand\XETEX {\XeTeX\xspace} -\newcommand\LATEX {\LaTeX\xspace} -\newcommand\CONTEXT {Con\TeX t\xspace} -\newcommand\OpenType{\identifier{Open\kern-.25ex Type}\xspace} +\newcommand\TEX {\TeX\xspace} +\newcommand\LUA {Lua\xspace} +\newcommand\PDFTEX {pdf\TeX\xspace} +\newcommand\LUATEX {Lua\TeX\xspace} +\newcommand\XETEX {\XeTeX\xspace} +\newcommand\LATEX {\LaTeX\xspace} +\newcommand\LUALATEX {Lua\LaTeX\xspace} +\newcommand\CONTEXT {Con\TeX t\xspace} +\newcommand\OpenType {\identifier{Open\kern-.25ex Type}\xspace} \def\definehighlight[#1][#2]% {\ifcsname #1\endcsname\else @@ -258,7 +259,7 @@ and the derived files % functionality like ligatures, old-style numbers, small capitals, % etc., and support more complex writing systems like Arabic and % Indic\footnote{% -% Unfortunately, \identifier{luaotfload} doesn't support Indic +% Unfortunately, \identifier{luaotfload} doesn‘t support many Indic % scripts right now. % Assistance in implementing the prerequisites is greatly % appreciated. @@ -282,6 +283,27 @@ and the derived files % Additionally, it provides means for accessing fonts known to the operating % system conveniently by indexing the metadata. % +% +% \section{Thanks} +% +% \identifier{Luaotfload} is part of \LUALATEX, the community-driven +% project to provide a foundation for using the \LATEX format with the +% full capabilites of the \LUATEX engine. +% As such, the distinction between end users, contributors, and project +% maintainers is intentionally kept less strict, lest we unduly +% personalize the common effort. +% +% Nevertheless, the current maintainers would like to express their +% gratitude to Khaled Hosny, Akira Kakuto, Hironori Kitagawa and Dohyun +% Kim. +% Their contributions -- be it patches, advice, or systematic +% testing -- made the switch from version 1.x to 2.2 possible. +% Also, Hans Hagen, the author of the font loader, made porting the +% code to \LATEX a breeze due to the extra effort he invested into +% isolating it from the rest of \CONTEXT, not to mention his assistance +% in the task and willingness to respond to our suggestions. +% +% % \section{Loading Fonts} % % \identifier{luaotfload} supports an extended font request syntax: @@ -407,7 +429,7 @@ and the derived files % \fileent{GFSBodoni.otf}, and % \fileent{PTZ56F.ttf}. % -% \subsection{\hologo{XeTeX} Compatibility Layer} +% \subsection{Compatibility Layer} % % In addition to the regular prefixed requests, \identifier{luaotfload} % accepts loading fonts the \XETEX way. @@ -947,6 +969,11 @@ and the derived files % % \verb|luaotfload-tool --help| will list the available command line % switches, including some not discussed in detail here. +% For a full documentation of \identifier{luaotfload-tool} and its +% capabilities refer to the manpage +% (\verb|man 1 luaotfload-tool|).\footnote{% +% Or see \verb|luaotfload-tool.rst| in the source directory. +% } % % \subsection{Blacklisting Fonts} % \label{font-blacklist} @@ -1105,14 +1132,14 @@ and the derived files % % Also, the merged file at some point % loads the Adobe Glyph List from a \LUA table that is contained in -% \fileent{font-age.lua}, which is automatically generated by the +% \fileent{luaotfload-glyphlist.lua}, which is automatically generated by the % % script \fileent{mkglyphlist}.\footnote{% % See \fileent{luaotfload-font-enc.lua}. -% The hard-coded file name is why the file lacks the \fileent{luaotfload-} -% prefix. +% The hard-coded file name is why we have to replace the procedure +% that loads the file in \fileent{luaotfload-override.lua}. % } % There is a make target \identifier{glyphs} that will create a fresh -% \fileent{font-age.lua} so we don’t need to import it from \CONTEXT +% glyph list so we don’t need to import it from \CONTEXT % any longer. % % In addition to these, \identifier{luaotfload} requires a number of @@ -1219,11 +1246,12 @@ local luaotfload = luaotfload config = config or { } config.luaotfload = config.luaotfload or { } -------.luaotfload.resolver = config.luaotfload.resolver or "normal" -config.luaotfload.resolver = config.luaotfload.resolver or "cached" -config.luaotfload.definer = config.luaotfload.definer or "patch" +------.luaotfload.resolver = config.luaotfload.resolver or "normal" +config.luaotfload.resolver = config.luaotfload.resolver or "cached" +config.luaotfload.definer = config.luaotfload.definer or "patch" +config.luaotfload.compatibility = config.luaotfload.compatibility or false config.luaotfload.loglevel = config.luaotfload.loglevel or 1 -config.luaotfload.color_callback = config.luaotfload.color_callback or "pre_linebreak_filter" +config.luaotfload.color_callback = config.luaotfload.color_callback or "pre_linebreak_filter" --luaotfload.prefer_merge = config.luaotfload.prefer_merge or true luaotfload.module = { @@ -1254,17 +1282,6 @@ local reset_callback, call_callback = local dummy_function = function () end -% \end{macrocode} -% No final decision has been made on how to handle font definition. At -% the moment, there are three candidates: The \identifier{generic} -% callback as hard-coded in the font loader, the \identifier{old} -% wrapper, and a simplified version of the latter (\identifier{patch}) -% that does nothing besides applying font patches. -% -% \begin{macrocode} - -luaotfload.font_definer = "patch" --- | “generic” | “old” - local error, warning, info, log = luatexbase.provides_module(luaotfload.module) @@ -1294,6 +1311,23 @@ if tex.luatexversion < luatex_version then luatex_version /100) end +% \end{macrocode} +% Prepare directories: the cache function in Luatex-Fonts checks for a +% writable directory only once during startup. If there is no +% \fileent{texmf-var} at this time it will create a subdirectory +% \fileent{./luatex-cache} instead. +% Thus everything has to be laid out before we load the fontloader. +% +% \begin{macrocode} + +local cachepath = kpse.expand_var"$TEXMFVAR" +if not lfs.isdir(cachepath) then + dir.mkdirs(cachepath) + if not lfs.isdir(cachepath) then + error( "ERROR could not create directory %s", cachepath) + end +end + % \end{macrocode} % \subsection{Module loading} % We load the files imported from \CONTEXT with this function. @@ -1606,13 +1640,22 @@ formats.ofm = "type1" % most cases when looking up font files, only when generating the database. % % \begin{macrocode} -request_resolvers.file = function (specification) - local found = fonts.names.crude_file_lookup(specification.name) - --local found = fonts.names.crude_file_lookup_verbose(specification.name) - specification.name = found[1] - --if format then specification.forced = format end + +local resolvefile = fonts.names.crude_file_lookup +--local resolvefile = fonts.names.crude_file_lookup_verbose + +function request_resolvers.file(specification) + local name=resolvefile(specification.name) + local suffix=file.suffix(name) + if formats[suffix] then + specification.forced=suffix + specification.name=file.removesuffix(name) + else + specification.name=name + end end + % \end{macrocode} % We classify as \verb|anon:| those requests that have neither a % prefix nor brackets. According to Khaled\footnote{% @@ -1699,8 +1742,6 @@ local patch_defined_font = function (specification, size, id) return tfmdata end -caches.compilemethod = "both" - reset_callback("define_font") % \end{macrocode} @@ -1751,10 +1792,16 @@ loadmodule"auxiliary.lua" --- additionaly high-level functionality (new) \else \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luaotfload}% - [2013/04/16 v2.2 OpenType layout system] + [2013/05/10 v2.2 OpenType layout system] \RequirePackage{luatexbase} \fi -\RequireLuaModule{luaotfload} +\ifnum\luatexversion<76 + %% here some deprecation warning would be in order + \RequireLuaModule{lualibs} + \RequireLuaModule{luaotfload-legacy} +\else + \RequireLuaModule{luaotfload} +\fi \endinput % \end{macrocode} % \iffalse -- cgit v1.2.3