diff options
author | Elie Roux <elie.roux@telecom-bretagne.eu> | 2013-05-13 08:42:17 -0700 |
---|---|---|
committer | Elie Roux <elie.roux@telecom-bretagne.eu> | 2013-05-13 08:42:17 -0700 |
commit | e94b87ca829b94e696d770d79f84f333df01b5cf (patch) | |
tree | ec8a9769a7205d08ee282b9ae8f287fed95f7f9e /luaotfload-auxiliary.lua | |
parent | c79890a917880f6f2a5802383e71841b45e9b836 (diff) | |
parent | 69e1a2d1249afc6d661e78483f74669ce7868284 (diff) | |
download | luaotfload-e94b87ca829b94e696d770d79f84f333df01b5cf.tar.gz |
Merge pull request #70 from phi-gamma/master
describe ``luaotfload-auxiliary.lua`` in documentation
Diffstat (limited to 'luaotfload-auxiliary.lua')
-rw-r--r-- | luaotfload-auxiliary.lua | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/luaotfload-auxiliary.lua b/luaotfload-auxiliary.lua index 11af445..a41520c 100644 --- a/luaotfload-auxiliary.lua +++ b/luaotfload-auxiliary.lua @@ -68,7 +68,7 @@ local add_fontdata_fallbacks = function (fontdata) metadata = fontdata.shared.rawdata.metadata fontdata.name = metadata.origname or fontdata.name fontdata.units = fontdata.units_per_em - fontdata.size = fontdata.size or fontparameters.size + fontdata.size = fontdata.size or fontparameters.size local resources = fontdata.resources --- for legacy fontspec.lua and unicode-math.lua fontdata.shared.otfdata = { @@ -449,21 +449,28 @@ aux.provides_feature = provides_feature --- font dimensions ----------------------------------------------------------------------- ---- string -> string -> int -local get_math_dimension = function (csname, dimenname) - local fontdata = identifiers[fontid(csname)] +--- int -> string -> int +local get_math_dimension = function (font_id, dimenname) + if type(font_id) == "string" then + font_id = fontid(font_id) --- safeguard + end + local fontdata = identifiers[font_id] local mathdata = fontdata.mathparameters - if mathdata then return mathdata[dimenname] or 0 end + if mathdata then + return mathdata[dimenname] or 0 + end return 0 end aux.get_math_dimension = get_math_dimension ---- string -> string -> unit -local sprint_math_dimension = function (csname, dimenname) - local dim = get_math_dimension(csname, dimenname) - texsprint(luatexbase.catcodetables["latex-package"], dim) - texsprint(luatexbase.catcodetables["latex-package"], "sp") +--- int -> string -> unit +local sprint_math_dimension = function (font_id, dimenname) + if type(font_id) == "string" then + font_id = fontid(font_id) + end + local dim = get_math_dimension(font_id, dimenname) + texsprint(luatexbase.catcodetables["latex-package"], dim, "sp") end aux.sprint_math_dimension = sprint_math_dimension |