From 56bfa6694124a5ff1d91dce903958cb12061a797 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Mon, 14 Jun 2010 10:40:44 +0300 Subject: Populate MathConstants table A temporary fix. --- luaotfload.dtx | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'luaotfload.dtx') 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 -- cgit v1.2.3