diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/font-imp-dimensions.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/font-imp-dimensions.lua | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-imp-dimensions.lua b/Master/texmf-dist/tex/context/base/mkiv/font-imp-dimensions.lua index a7125625da7..24891a2cdf3 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-imp-dimensions.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-imp-dimensions.lua @@ -48,13 +48,42 @@ local function initialize(tfmdata,key,value) elseif value == "mono" then newwidth = emwidth else + -- there are fonts out there with no x_height ... local spec = settings_to_array(value) - newwidth = tonumber(spec[1]) - newheight = tonumber(spec[2]) - newdepth = tonumber(spec[3]) - if newwidth then newwidth = newwidth * emwidth end - if newheight then newheight = newheight * exheight end - if newdepth then newdepth = newdepth * exheight end + newwidth = spec[1] + newheight = spec[2] + newdepth = spec[3] + local quad = parameters.quad or 0 + local ascender = parameters.ascender or 0 + local descender = parameters.descender or 0 + if newwidth == "max" then + newwidth = quad + else + newwidth = tonumber(newwidth) + if newwidth then + newwidth = newwidth * emwidth + end + end + if newheight == "max" then + newheight = ascender + else + newheight = tonumber(newheight) + if newheight then + newheight = newheight * exheight + end + end + if newdepth == "max" then + newdepth = descender + else + newdepth = tonumber(newdepth) + if newdepth then + newdepth = newdepth * exheight + end + end + if parameters.x_heigth == 0 then + -- maybe a fourth parameter + parameters.x_heigth = (ascender + descender) / 2 + end end if newwidth or newheight or newdepth then for unicode, character in next, characters do @@ -107,7 +136,7 @@ end registerotffeature { name = "realdimensions", - description = "accept negative dimenions", + description = "accept negative dimensions", initializers = { base = initialize, node = initialize, |