summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-05-13 16:15:12 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-05-13 16:15:12 +0200
commit6f39e53c424a7bf460f757a36ab4534ca81492ff (patch)
tree2072d28222a962b7ca7a1c8a7aa29b55a49c0fe2
parent78cb8b8b5dace588d4b028394daf8a4f9ff18d1a (diff)
downloadluaotfload-6f39e53c424a7bf460f757a36ab4534ca81492ff.tar.gz
address fonts by ids instead of csnames
-rw-r--r--luaotfload-auxiliary.lua27
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