summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/fontspec/README4
-rw-r--r--Master/texmf-dist/doc/latex/fontspec/fontspec-example.tex4
-rw-r--r--Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdfbin272820 -> 271681 bytes
-rw-r--r--Master/texmf-dist/doc/latex/fontspec/fontspec.pdfbin2801314 -> 1348784 bytes
-rw-r--r--Master/texmf-dist/source/latex/fontspec/Makefile4
-rw-r--r--Master/texmf-dist/source/latex/fontspec/fontspec.dtx262
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty2
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty4
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty2
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec.lua192
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec.sty4
11 files changed, 292 insertions, 186 deletions
diff --git a/Master/texmf-dist/doc/latex/fontspec/README b/Master/texmf-dist/doc/latex/fontspec/README
index cdd4c642542..8091d0b8ef2 100644
--- a/Master/texmf-dist/doc/latex/fontspec/README
+++ b/Master/texmf-dist/doc/latex/fontspec/README
@@ -72,6 +72,10 @@ Features may be added to the font currently in use with
Change history
--------------
+- v2.3b (2013/05/12)
+
+ * Compatibility with new (and future) version of luaotfload
+
- v2.3a (2013/03/16)
* Bug fix update to retain compatibility with new expl3
diff --git a/Master/texmf-dist/doc/latex/fontspec/fontspec-example.tex b/Master/texmf-dist/doc/latex/fontspec/fontspec-example.tex
index 7db95ae551d..a348d1f21b1 100644
--- a/Master/texmf-dist/doc/latex/fontspec/fontspec-example.tex
+++ b/Master/texmf-dist/doc/latex/fontspec/fontspec-example.tex
@@ -20,8 +20,8 @@ The basic command is
{\centering \verb|\fontspec[font features]{font display name}|.\par}
The default, sans serif, and typewriter fonts may be set with the
-\verb|\setmainfont|, \verb|\setsansfont| and \verb|\setmonofont|
-commands, respectively, as shown in the preamble. They take the
+commands \verb|\setmainfont|, \verb|\setsansfont| and \verb|\setmonofont|,
+respectively, as shown in the preamble. They take the
same syntax as the \verb|\fontspec| package. All expected font
shapes are available:
diff --git a/Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdf b/Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdf
index 2556562e468..b487aa2a993 100644
--- a/Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdf
+++ b/Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf b/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf
index 9c6880b6ad2..668dbe6d1e5 100644
--- a/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf
+++ b/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/fontspec/Makefile b/Master/texmf-dist/source/latex/fontspec/Makefile
index 2a0b321947e..e1c8eb5dbf7 100644
--- a/Master/texmf-dist/source/latex/fontspec/Makefile
+++ b/Master/texmf-dist/source/latex/fontspec/Makefile
@@ -73,8 +73,8 @@ CTAN_ZIP = $(NAME).zip
TDS_ZIP = $(NAME).tds.zip
ZIPS = $(CTAN_ZIP) $(TDS_ZIP)
-DO_PDFLATEX = pdflatex --interaction=nonstopmode $< $(REDIRECT)
-DO_PDFLATEX_WRITE18 = pdflatex --shell-escape --interaction=nonstopmode $< $(REDIRECT)
+DO_PDFLATEX = lualatex --interaction=nonstopmode $< $(REDIRECT)
+DO_PDFLATEX_WRITE18 = lualatex --shell-escape --interaction=nonstopmode $< $(REDIRECT)
DO_TEX = tex --interaction=nonstopmode $< $(REDIRECT)
DO_MAKEINDEX = makeindex -s gind.ist $(subst .dtx,,$<) $(REDIRECT) 2>&1
diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
index f31264b1d83..4682334a469 100644
--- a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
+++ b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
@@ -66,7 +66,7 @@ This work consists of this file fontspec.dtx
%<fontspec&luatex>\ProvidesPackage{fontspec-luatex}
%<patches>\ProvidesPackage{fontspec-patches}
%<*fontspec|patches>
- [2013/03/16 v2.3a Font selection for XeLaTeX and LuaLaTeX]
+ [2013/05/12 v2.3b Font selection for XeLaTeX and LuaLaTeX]
%</fontspec|patches>
%
%<*driver>
@@ -112,8 +112,7 @@ This work consists of this file fontspec.dtx
% \LuaTeX's features including font support; a kernel of his work in this area
% has been extracted to be useful for other \TeX\ macro systems as well, and
% this has enabled \pkg{fontspec} to be adapted for \LaTeX\ when run with the
-% \LuaTeX\ engine. Elie Roux and Khaled Hosny have been instrumental and
-% invaluable with this development work.
+% \LuaTeX\ engine.
%
% \section{Introduction}
%
@@ -199,7 +198,7 @@ This work consists of this file fontspec.dtx
% \paragraph{\LuaTeX\ users only}
% In order to load fonts by their name rather than by their filename (\eg,
% `Latin Modern Roman' instead of `ec-lmr10'), you may need to run the script
-% \texttt{mkluatexfontdb}, which is distributed with the \pkg{luaotfload}
+% \texttt{luaotfload-tool}, which is distributed with the \pkg{luaotfload}
% package. Note that if you do not execute this script beforehand, the first
% time you attempt to typeset the process will pause for (up to) several
% minutes. (But only the first time.)
@@ -209,10 +208,9 @@ This work consists of this file fontspec.dtx
% \emph{The \pkg{babel} package is not really supported!} Especially Vietnamese,
% Greek, and Hebrew at least might not work correctly, as far as I can tell.
% There's a better chance with Cyrillic and Latin-based languages,
-% however---\pkg{fontspec} ensures at least that fonts should load correctly,
-% but hyphenation and other matters aren't guaranteed. Under \XeTeX, the
-% \pkg{polyglossia} package is recommended instead as a modern replacement for
-% \pkg{babel}. For \LuaTeX, the situation is still unresolved.
+% however---\pkg{fontspec} ensures at least that fonts should load correctly.
+% The \pkg{polyglossia} package is recommended instead as a modern replacement
+% for \pkg{babel}.
%
%
%
@@ -285,7 +283,9 @@ This work consists of this file fontspec.dtx
%
% \subsection{By font name}
%
-% Fonts known to \LuaTeX\ or \XeTeX\ may be loaded by their standard names as you'd speak them out loud, such as \emph{Times New Roman} or \emph{Adobe Garamond}.
+% Fonts known to \LuaTeX\ or \XeTeX\ may be loaded by their standard names as
+% you'd speak them out loud, such as \emph{Times New Roman} or
+% \emph{Adobe Garamond}.
% `Known to' in this case generally means `exists in a standard fonts location'
% such as |~/Library/Fonts| on \MacOSX, or |C:\Windows\Fonts| on Windows.
%
@@ -307,7 +307,7 @@ This work consists of this file fontspec.dtx
% When you have a very large collection of fonts, you will sometimes not
% wish to have them all installed in your system's font directories.
% In this case, it is more convenient to load them from a different location on your disk.
-% This technique is also necessary in \XeTeX\ when loading OpenType fonts that are present within your \TeX\ distribution, such as \path{/usr/local/texlive/2010/texmf-dist/fonts/opentype/public}.
+% This technique is also necessary in \XeTeX\ when loading OpenType fonts that are present within your \TeX\ distribution, such as \path{/usr/local/texlive/2013/texmf-dist/fonts/opentype/public}.
% Fonts in such locations are visible to \XeTeX\ but cannot be loaded by font name, only file name; \LuaTeX\ does not have this restriction.
%
% When selecting fonts by file name, any font that can be found in the default
@@ -2477,7 +2477,7 @@ This work consists of this file fontspec.dtx
%
% \begin{macro}{\fontspec_if_opentype:TF}
% Test whether the currently selected font is an OpenType font.
-% Always true for LuaTeX fonts.
+% Always true for \LuaTeX{} fonts.
% \end{macro}
%
% \begin{macro}{\fontspec_if_feature:nTF}
@@ -2645,7 +2645,7 @@ This work consists of this file fontspec.dtx
{
\luatex_if_engine:TF
{
- \RequirePackage{luaotfload}
+ \RequirePackage{luaotfload}[2011/10/06]
\RequireLuaModule{fontspec}
}
{
@@ -6636,14 +6636,15 @@ This work consists of this file fontspec.dtx
% \end{macrocode}
% First we define some metadata.
% \begin{macrocode}
-fontspec = { }
+fontspec = fontspec or {}
+local fontspec = fontspec
fontspec.module = {
name = "fontspec",
- version = 2.0,
- date = "2009/12/04",
+ version = 2.4,
+ date = "2013/05/12",
description = "Advanced font selection for LuaLaTeX.",
- author = "Khaled Hosny",
- copyright = "Khaled Hosny",
+ author = "Khaled Hosny, Philipp Gesang",
+ copyright = "Khaled Hosny, Philipp Gesang",
license = "LPPL"
}
@@ -6656,68 +6657,89 @@ fontspec.log = log
fontspec.warning = warn
fontspec.error = err
-function fontspec.sprint (...) tex.sprint(luatexbase.catcodetables['latex-package'], ...) end
+function fontspec.sprint (...)
+ tex.sprint(luatexbase.catcodetables['latex-package'], ...)
+end
% \end{macrocode}
-% The following functions check for exsitence of certain script, language or
+% The following lines check for existence of a certain script, language or
% feature in a given font.
-% \begin{macrocode}
-local function check_script(id, script)
- local s = string.lower(script)
- if id and id > 0 then
- local otfdata = fonts.identifiers[id].shared.otfdata
- if otfdata then
- local features = otfdata.luatex.features
- for i,_ in pairs(features) do
- for j,_ in pairs(features[i]) do
- if features[i][j][s] then
- fontspec.log("script '%s' exists in font '%s'",
- script, fonts.identifiers[id].fullname)
- return true
+%
+% |luaotfload| provides basic functions for this, starting with version
+% 2.2. We use them if they are available, otherwise we still provide the code
+% for backward-compatibility with old versions of |luaotfload|.
+%
+% The first thing is to test for the presence of these functions.
+% \begin{macrocode}
+local luaotfload_aux
+if luaotfload and luaotfload.aux and luaotfload.aux.slot_of_name then
+ luaotfload_aux = true
+else
+ luaotfload_aux = false
+end
+
+local check_script, check_language, check_feature, ids
+
+if luaotfload_aux then
+ check_script = luaotfload.aux.provides_script
+ check_language = luaotfload.aux.provides_language
+ check_feature = luaotfload.aux.provides_feature
+else
+% \end{macrocode}
+% This else will be removed in the next version.
+% \begin{macrocode}
+ ids = fonts.identifiers or fonts.ids or fonts.hashes.identifiers -- first two are for backward compatibility
+ function check_script(id, script)
+ local s = string.lower(script)
+ if id and id > 0 then
+ local otfdata = ids[id].shared.rawdata
+ if otfdata then
+ local features = otfdata.resources.features
+ for i,_ in pairs(features) do
+ for j,_ in pairs(features[i]) do
+ if features[i][j][s] then
+ fontspec.log("script '%s' exists in font '%s'",
+ script, ids[id].fullname)
+ return true
+ end
end
end
end
end
end
-end
-% \end{macrocode}
-%
-% \begin{macrocode}
-local function check_language(id, language, script)
- local s = string.lower(script)
- local l = string.lower(language)
- if id and id > 0 then
- local otfdata = fonts.identifiers[id].shared.otfdata
- if otfdata then
- local features = otfdata.luatex.features
- for i,_ in pairs(features) do
- for j,_ in pairs(features[i]) do
- if features[i][j][s] and features[i][j][s][l] then
- fontspec.log("language '%s' for script '%s' exists in font '%s'",
- language, script, fonts.identifiers[id].fullname)
- return true
+ function check_language(id, script, language)
+ local s = string.lower(script)
+ local l = string.lower(language)
+ if id and id > 0 then
+ local otfdata = ids[id].shared.rawdata
+ if otfdata then
+ local features = otfdata.resources.features
+ for i,_ in pairs(features) do
+ for j,_ in pairs(features[i]) do
+ if features[i][j][s] and features[i][j][s][l] then
+ fontspec.log("language '%s' for script '%s' exists in font '%s'",
+ language, script, ids[id].fullname)
+ return true
+ end
end
end
end
end
end
-end
-% \end{macrocode}
-%
-% \begin{macrocode}
-local function check_feature(id, feature, language, script)
- local s = string.lower(script)
- local l = string.lower(language)
- local f = string.lower(feature:gsub("^[+-]", ""):gsub("=.*$", ""))
- if id and id > 0 then
- local otfdata = fonts.identifiers[id].shared.otfdata
- if otfdata then
- local features = otfdata.luatex.features
- for i,_ in pairs(features) do
- if features[i][f] and features[i][f][s] then
- if features[i][f][s][l] == true then
- fontspec.log("feature '%s' for language '%s' and script '%s' exists in font '%s'",
- feature, language, script, fonts.identifiers[id].fullname)
- return true
+ function check_feature(id, script, language, feature)
+ local s = string.lower(script)
+ local l = string.lower(language)
+ local f = string.lower(feature:gsub("^[+-]", ""):gsub("=.*$", ""))
+ if id and id > 0 then
+ local otfdata = ids[id].shared.rawdata
+ if otfdata then
+ local features = otfdata.resources.features
+ for i,_ in pairs(features) do
+ if features[i][f] and features[i][f][s] then
+ if features[i][f][s][l] == true then
+ fontspec.log("feature '%s' for language '%s' and script '%s' exists in font '%s'",
+ feature, language, script, ids[id].fullname)
+ return true
+ end
end
end
end
@@ -6743,7 +6765,7 @@ end
%
% \begin{macrocode}
function fontspec.check_ot_lang(fnt, lang, script)
- if check_language(font.id(fnt), lang, script) then
+ if check_language(font.id(fnt), script, lang) then
tempswatrue()
else
tempswafalse()
@@ -6759,7 +6781,7 @@ function fontspec.check_ot_feat(fnt, feat, lang, script)
return
end
end
- if check_feature(font.id(fnt), feat, lang, script) then
+ if check_feature(font.id(fnt), script, lang, feat) then
tempswatrue()
else
tempswafalse()
@@ -6768,49 +6790,77 @@ end
% \end{macrocode}
%
% \begin{macrocode}
-function fontspec.mathfontdimen(fnt, str)
- local mathdimens = fonts.identifiers[font.id(fnt)].MathConstants
- if mathdimens then
- local m = mathdimens[str]
- if m then
- fontspec.sprint(mathdimens[str])
- fontspec.sprint("sp")
+local get_math_dimension
+if luaotfload_aux then
+ get_math_dimension = luaotfload.aux.get_math_dimension
+else
+ get_math_dimension = function(fnt, str)
+ local mathdimens = ids[font.id(fnt)].MathConstants
+ if mathdimens then
+ return mathdimens[str]
else
- fontspec.sprint("0pt")
+ return nil
end
+ end
+end
+function fontspec.mathfontdimen(fnt, str)
+ local mathdimens = get_math_dimension(fnt, str)
+ if mathdimens then
+ fontspec.sprint(mathdimens)
+ fontspec.sprint("sp")
else
fontspec.sprint("0pt")
end
end
% \end{macrocode}
%
-% Here we patch fonts tfm table to emulate \XeTeX's \cs{fontdimen8},
-% which stores the caps-height of the font. (Cf.\ \cs{fontdimen5} which
-% stores the x-height.)
-%
-% Falls back to measuring the glyph if the font doesn't contain the
-% necessary information.
-% This needs to be extended for fonts that don't contain an `X'.
+% |luaotfload| takes care of setting |\fontdimen8| starting from version 2.2,
+% the following code is just for backward compatibility with old version.
%
% \begin{macrocode}
-local function set_capheight(fontdata)
- local capheight
- local units = fontdata.units
- local size = fontdata.size
- local otfdata = fontdata.shared.otfdata
+if not luaotfload_aux then
+ local function set_capheight(fontdata)
+ local capheight
+ local shared = fontdata.shared
+ if shared then
+ local metadata
+ local units_per_em
+ local os2_capheight
+ local size = fontdata.size or fontdata.parameters.size
- if otfdata.pfminfo.os2_capheight > 0 then
- capheight = otfdata.pfminfo.os2_capheight / units * size
- else
- if fontdata.characters[string.byte("X")] then
- capheight = fontdata.characters[string.byte("X")].height
+ if shared.rawdata then --- new otfl
+ metadata = shared.rawdata.metadata
+ units_per_em = shared.rawdata.metadata.units_per_em
+ os2_capheight = metadata.pfminfo.os2_capheight
+ else --- legacy
+ metadata = shared.otfdata.metadata
+ units_per_em = fontdata.units_per_em or fontdata.units
+ or fontdata.parameters.units
+ os2_capheight = shared.otfdata.pfminfo.os2_capheight
+ end
+
+ if os2_capheight > 0 then
+ capheight = os2_capheight / units_per_em * size
+ else
+ local X8 = string.byte"X"
+ if fontdata.characters[X8] then
+ capheight = fontdata.characters[X8].height
+ else
+ capheight = metadata.ascent / units_per_em * size
+ end
+ end
else
- capheight = otfdata.metadata.ascent / units * size
+ local X8 = string.byte"X"
+ if fontdata.characters[X8] then
+ capheight = fontdata.characters[X8].height
+ end
+ end
+ if capheight then
+ fontdata.parameters[8] = capheight
end
end
- fontdata.parameters[8] = capheight
+ luatexbase.add_to_callback("luaotfload.patch_font", set_capheight, "fontspec.set_capheight")
end
-luatexbase.add_to_callback("luaotfload.patch_font", set_capheight, "fontspec.set_capheight")
% \end{macrocode}
%
% \begin{macrocode}
@@ -6824,14 +6874,12 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_capheight, "fontspec.set
%<*patches>
% \end{macrocode}
%
-% \begin{macrocode}
-\ExplSyntaxOn
-% \end{macrocode}
-%
% \subsection{Unicode footnote symbols}
% \begin{macrocode}
\RequirePackage{fixltx2e}[2006/03/24]
+\ExplSyntaxOn
% \end{macrocode}
+%
% \subsection{Emph}
%
% \begin{macro}{\em}
@@ -7095,8 +7143,8 @@ The basic command is
{\centering \verb|\fontspec[font features]{font display name}|.\par}
The default, sans serif, and typewriter fonts may be set with the
-\verb|\setmainfont|, \verb|\setsansfont| and \verb|\setmonofont|
-commands, respectively, as shown in the preamble. They take the
+commands \verb|\setmainfont|, \verb|\setsansfont| and \verb|\setmonofont|,
+respectively, as shown in the preamble. They take the
same syntax as the \verb|\fontspec| package. All expected font
shapes are available:
@@ -7131,7 +7179,7 @@ information.
\usepackage{fontspec,fancyvrb,geometry,graphicx,calc,multicol}
\geometry{margin=2cm,a4paper}
\setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
-\setmonofont{Consolas}
+\setmonofont{Inconsolata}
\newcommand\meta[1]{$\langle$\emph{#1}$\rangle$}
@@ -7200,6 +7248,7 @@ If you want to run just a single test, use
% \begin{macrocode}
\ProvidesPackage{fontspec-style}
+\usepackage{fontspec}
\usepackage{booktabs,calc,caption,color,enumitem,fancyvrb,hologo,graphicx,ifthen,url,varioref,varwidth,microtype,tocloft}
% ToC formatting:
@@ -7216,8 +7265,9 @@ If you want to run just a single test, use
\newcommand\XeLaTeX{\hologo{XeLaTeX}}
\newcommand\LuaTeX{\hologo{LuaTeX}}
\newcommand\LuaLaTeX{\hologo{LuaLaTeX}}
-\usepackage{tgpagella,eulervm}
-\usepackage{inconsolata}
+\setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
+\setsansfont[Scale=MatchLowercase,Ligatures=TeX]{Iwona}
+\setmonofont[Scale=MatchLowercase]{Inconsolata}
\usepackage[
bookmarks=true,
colorlinks=true,
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
index 7ba03b2cf47..8fba89c97e5 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
@@ -14,7 +14,7 @@
%%
%%
\ProvidesPackage{fontspec-luatex}
- [2013/03/16 v2.3a Font selection for XeLaTeX and LuaLaTeX]
+ [2013/05/12 v2.3b Font selection for XeLaTeX and LuaLaTeX]
\ExplSyntaxOn
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty
index fc14aa67365..49c24813be7 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty
@@ -14,11 +14,11 @@
%%
%%
\ProvidesPackage{fontspec-patches}
- [2013/03/16 v2.3a Font selection for XeLaTeX and LuaLaTeX]
+ [2013/05/12 v2.3b Font selection for XeLaTeX and LuaLaTeX]
-\ExplSyntaxOn
\RequirePackage{fixltx2e}[2006/03/24]
+\ExplSyntaxOn
\DeclareRobustCommand \em
{
\@nomath\em
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
index e1f17ad5caa..ea1d1d2a609 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
@@ -14,7 +14,7 @@
%%
%%
\ProvidesPackage{fontspec-xetex}
- [2013/03/16 v2.3a Font selection for XeLaTeX and LuaLaTeX]
+ [2013/05/12 v2.3b Font selection for XeLaTeX and LuaLaTeX]
\ExplSyntaxOn
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
index cb6a24926e5..9bbb1c78260 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
@@ -15,14 +15,15 @@
--
-fontspec = { }
+fontspec = fontspec or {}
+local fontspec = fontspec
fontspec.module = {
name = "fontspec",
- version = 2.0,
- date = "2009/12/04",
+ version = 2.4,
+ date = "2013/05/12",
description = "Advanced font selection for LuaLaTeX.",
- author = "Khaled Hosny",
- copyright = "Khaled Hosny",
+ author = "Khaled Hosny, Philipp Gesang",
+ copyright = "Khaled Hosny, Philipp Gesang",
license = "LPPL"
}
@@ -32,58 +33,76 @@ fontspec.log = log
fontspec.warning = warn
fontspec.error = err
-function fontspec.sprint (...) tex.sprint(luatexbase.catcodetables['latex-package'], ...) end
-local function check_script(id, script)
- local s = string.lower(script)
- if id and id > 0 then
- local otfdata = fonts.identifiers[id].shared.otfdata
- if otfdata then
- local features = otfdata.luatex.features
- for i,_ in pairs(features) do
- for j,_ in pairs(features[i]) do
- if features[i][j][s] then
- fontspec.log("script '%s' exists in font '%s'",
- script, fonts.identifiers[id].fullname)
- return true
+function fontspec.sprint (...)
+ tex.sprint(luatexbase.catcodetables['latex-package'], ...)
+end
+local luaotfload_aux
+if luaotfload and luaotfload.aux and luaotfload.aux.slot_of_name then
+ luaotfload_aux = true
+else
+ luaotfload_aux = false
+end
+
+local check_script, check_language, check_feature, ids
+
+if luaotfload_aux then
+ check_script = luaotfload.aux.provides_script
+ check_language = luaotfload.aux.provides_language
+ check_feature = luaotfload.aux.provides_feature
+else
+ ids = fonts.identifiers or fonts.ids or fonts.hashes.identifiers -- first two are for backward compatibility
+ function check_script(id, script)
+ local s = string.lower(script)
+ if id and id > 0 then
+ local otfdata = ids[id].shared.rawdata
+ if otfdata then
+ local features = otfdata.resources.features
+ for i,_ in pairs(features) do
+ for j,_ in pairs(features[i]) do
+ if features[i][j][s] then
+ fontspec.log("script '%s' exists in font '%s'",
+ script, ids[id].fullname)
+ return true
+ end
end
end
end
end
end
-end
-local function check_language(id, language, script)
- local s = string.lower(script)
- local l = string.lower(language)
- if id and id > 0 then
- local otfdata = fonts.identifiers[id].shared.otfdata
- if otfdata then
- local features = otfdata.luatex.features
- for i,_ in pairs(features) do
- for j,_ in pairs(features[i]) do
- if features[i][j][s] and features[i][j][s][l] then
- fontspec.log("language '%s' for script '%s' exists in font '%s'",
- language, script, fonts.identifiers[id].fullname)
- return true
+ function check_language(id, script, language)
+ local s = string.lower(script)
+ local l = string.lower(language)
+ if id and id > 0 then
+ local otfdata = ids[id].shared.rawdata
+ if otfdata then
+ local features = otfdata.resources.features
+ for i,_ in pairs(features) do
+ for j,_ in pairs(features[i]) do
+ if features[i][j][s] and features[i][j][s][l] then
+ fontspec.log("language '%s' for script '%s' exists in font '%s'",
+ language, script, ids[id].fullname)
+ return true
+ end
end
end
end
end
end
-end
-local function check_feature(id, feature, language, script)
- local s = string.lower(script)
- local l = string.lower(language)
- local f = string.lower(feature:gsub("^[+-]", ""):gsub("=.*$", ""))
- if id and id > 0 then
- local otfdata = fonts.identifiers[id].shared.otfdata
- if otfdata then
- local features = otfdata.luatex.features
- for i,_ in pairs(features) do
- if features[i][f] and features[i][f][s] then
- if features[i][f][s][l] == true then
- fontspec.log("feature '%s' for language '%s' and script '%s' exists in font '%s'",
- feature, language, script, fonts.identifiers[id].fullname)
- return true
+ function check_feature(id, script, language, feature)
+ local s = string.lower(script)
+ local l = string.lower(language)
+ local f = string.lower(feature:gsub("^[+-]", ""):gsub("=.*$", ""))
+ if id and id > 0 then
+ local otfdata = ids[id].shared.rawdata
+ if otfdata then
+ local features = otfdata.resources.features
+ for i,_ in pairs(features) do
+ if features[i][f] and features[i][f][s] then
+ if features[i][f][s][l] == true then
+ fontspec.log("feature '%s' for language '%s' and script '%s' exists in font '%s'",
+ feature, language, script, ids[id].fullname)
+ return true
+ end
end
end
end
@@ -100,7 +119,7 @@ function fontspec.check_ot_script(fnt, script)
end
end
function fontspec.check_ot_lang(fnt, lang, script)
- if check_language(font.id(fnt), lang, script) then
+ if check_language(font.id(fnt), script, lang) then
tempswatrue()
else
tempswafalse()
@@ -113,44 +132,77 @@ function fontspec.check_ot_feat(fnt, feat, lang, script)
return
end
end
- if check_feature(font.id(fnt), feat, lang, script) then
+ if check_feature(font.id(fnt), script, lang, feat) then
tempswatrue()
else
tempswafalse()
end
end
-function fontspec.mathfontdimen(fnt, str)
- local mathdimens = fonts.identifiers[font.id(fnt)].MathConstants
- if mathdimens then
- local m = mathdimens[str]
- if m then
- fontspec.sprint(mathdimens[str])
- fontspec.sprint("sp")
+local get_math_dimension
+if luaotfload_aux then
+ get_math_dimension = luaotfload.aux.get_math_dimension
+else
+ get_math_dimension = function(fnt, str)
+ local mathdimens = ids[font.id(fnt)].MathConstants
+ if mathdimens then
+ return mathdimens[str]
else
- fontspec.sprint("0pt")
+ return nil
end
+ end
+end
+function fontspec.mathfontdimen(fnt, str)
+ local mathdimens = get_math_dimension(fnt, str)
+ if mathdimens then
+ fontspec.sprint(mathdimens)
+ fontspec.sprint("sp")
else
fontspec.sprint("0pt")
end
end
-local function set_capheight(fontdata)
- local capheight
- local units = fontdata.units
- local size = fontdata.size
- local otfdata = fontdata.shared.otfdata
+if not luaotfload_aux then
+ local function set_capheight(fontdata)
+ local capheight
+ local shared = fontdata.shared
+ if shared then
+ local metadata
+ local units_per_em
+ local os2_capheight
+ local size = fontdata.size or fontdata.parameters.size
- if otfdata.pfminfo.os2_capheight > 0 then
- capheight = otfdata.pfminfo.os2_capheight / units * size
- else
- if fontdata.characters[string.byte("X")] then
- capheight = fontdata.characters[string.byte("X")].height
+ if shared.rawdata then --- new otfl
+ metadata = shared.rawdata.metadata
+ units_per_em = shared.rawdata.metadata.units_per_em
+ os2_capheight = metadata.pfminfo.os2_capheight
+ else --- legacy
+ metadata = shared.otfdata.metadata
+ units_per_em = fontdata.units_per_em or fontdata.units
+ or fontdata.parameters.units
+ os2_capheight = shared.otfdata.pfminfo.os2_capheight
+ end
+
+ if os2_capheight > 0 then
+ capheight = os2_capheight / units_per_em * size
+ else
+ local X8 = string.byte"X"
+ if fontdata.characters[X8] then
+ capheight = fontdata.characters[X8].height
+ else
+ capheight = metadata.ascent / units_per_em * size
+ end
+ end
else
- capheight = otfdata.metadata.ascent / units * size
+ local X8 = string.byte"X"
+ if fontdata.characters[X8] then
+ capheight = fontdata.characters[X8].height
+ end
+ end
+ if capheight then
+ fontdata.parameters[8] = capheight
end
end
- fontdata.parameters[8] = capheight
+ luatexbase.add_to_callback("luaotfload.patch_font", set_capheight, "fontspec.set_capheight")
end
-luatexbase.add_to_callback("luaotfload.patch_font", set_capheight, "fontspec.set_capheight")
--
-- Copyright 2004--2013 Will Robertson <wspr81@gmail.com>
-- Copyright 2009--2013 Khaled Hosny <khaledhosny@eglug.org>
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty
index c145b8145e8..88392e43ba9 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty
@@ -14,7 +14,7 @@
%%
%%
\ProvidesPackage{fontspec}
- [2013/03/16 v2.3a Font selection for XeLaTeX and LuaLaTeX]
+ [2013/05/12 v2.3b Font selection for XeLaTeX and LuaLaTeX]
\RequirePackage{expl3}[2011/09/05]
@@ -32,7 +32,7 @@
{
\luatex_if_engine:TF
{
- \RequirePackage{luaotfload}
+ \RequirePackage{luaotfload}[2011/10/06]
\RequireLuaModule{fontspec}
}
{