summaryrefslogtreecommitdiff
path: root/luaotfload.dtx
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2010-06-14 10:40:44 +0300
committerKhaled Hosny <khaledhosny@eglug.org>2010-06-14 10:41:12 +0300
commit56bfa6694124a5ff1d91dce903958cb12061a797 (patch)
treeb40f5bb199549b940a9ca03f7abd5c1af2a3c056 /luaotfload.dtx
parent01023cf94a72f03d93c0204807fd914049cbeaec (diff)
downloadluaotfload-56bfa6694124a5ff1d91dce903958cb12061a797.tar.gz
Populate MathConstants table
A temporary fix.
Diffstat (limited to 'luaotfload.dtx')
-rw-r--r--luaotfload.dtx37
1 files changed, 30 insertions, 7 deletions
diff --git a/luaotfload.dtx b/luaotfload.dtx
index 12aae2a..0918a4b 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -556,9 +556,18 @@ luaotfload.loadmodule('font-clr.lua')
% \end{macrocode}
%
-% \subsection{Emulating font dimensions}
+% \subsection{Post-processing TFM table}
%
-% And here add some code to emulate \XeTeX's \cs{fontdimen8},
+% Here we do some final touches to the loaded TFM table before passing it
+% to the \TeX\ end.
+%
+% \begin{macrocode}
+local function def_font(...)
+ local fontdata = fonts.define.read(...)
+ if type(fontdata) == "table" and fontdata.shared then
+% \end{macrocode}
+%
+% First, we add some code to emulate \XeTeX's \cs{fontdimen8},
% which stores the caps-height of the font. (Cf.\ \cs{fontdimen5} which
% stores the x-height.)
%
@@ -567,24 +576,38 @@ luaotfload.loadmodule('font-clr.lua')
% This needs to be extended for fonts that don't contain an `X'.
%
% \begin{macrocode}
-local function def_font(...)
- local fontdata = fonts.define.read(...)
- if type(fontdata) == "table" and fontdata.shared then
local capheight
local units = fontdata.units
local size = fontdata.size
local otfdata = fontdata.shared.otfdata
if otfdata.pfminfo.os2_capheight > 0 then
- capheight = otfdata.pfminfo.os2_capheight/units*size
+ capheight = otfdata.pfminfo.os2_capheight / units * size
else
if fontdata.characters[string.byte("X")] then
capheight = fontdata.characters[string.byte("X")].height
else
- capheight = otfdata.metadata.ascent/units*size
+ capheight = otfdata.metadata.ascent / units * size
end
end
fontdata.parameters[8] = capheight
+% \end{macrocode}
+%
+% Then we populate \texttt{MathConstants} table, which is required for
+% OpenType math.
+%
+% \begin{macrocode}
+ if otfdata.metadata.math then
+ for k,v in next, otfdata.metadata.math do
+ if k == "RadicalDegreeBottomRaisePercent" then
+ -- this is a percent
+ fontdata.MathConstants[k] = v
+ else
+ fontdata.MathConstants[k] = v / units * size
+ end
+ end
+ end
+
end
return fontdata
end