summaryrefslogtreecommitdiff
path: root/luaotfload.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'luaotfload.dtx')
-rw-r--r--luaotfload.dtx18
1 files changed, 10 insertions, 8 deletions
diff --git a/luaotfload.dtx b/luaotfload.dtx
index 2be5db8..a593b4e 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -570,19 +570,21 @@ luaotfload.loadmodule('font-clr.lua')
local function def_font(...)
local fontdata = fonts.define.read(...)
if fontdata then
+ local capheight
local units = fontdata.units
local size = fontdata.size
local otfdata = fontdata.shared.otfdata
- local capheight = otfdata.pfminfo.os2_capheight
-
- local dimen8 = capheight/units*size
-
- if capheight <= 0 then
- dimen8 = fontdata.characters[string.byte("X")].height
+ if otfdata.pfminfo.os2_capheight > 0 then
+ 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
+ end
end
-
- fontdata.parameters[8] = dimen8
+ fontdata.parameters[8] = capheight
end
return fontdata
end