summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2016-04-09 12:39:25 +0200
committerPhilipp Gesang <phg@phi-gamma.net>2016-04-09 17:44:32 +0200
commit61f0c68e868a58e7f1ddc929a441b3280a571331 (patch)
tree0181a9a454a910f1832a8c86a3db1078a5446404
parentd9789be6dbd9d77cb4091800f6b50580b25e1868 (diff)
downloadluaotfload-61f0c68e868a58e7f1ddc929a441b3280a571331.tar.gz
[aux] fix crash in patching code that sets \fontdimen8
Obviously, since Fontforge has been ditched, we need to adapt to the slightly different data structures created by the Lua reader. For the time being, we revise the code so it will not crash instantly due to the lack of a missing ``pfminfo`` table. Hans has been notified of our use of the ``capheight`` data and may add that value grudgingly again.
-rw-r--r--src/luaotfload-auxiliary.lua21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/luaotfload-auxiliary.lua b/src/luaotfload-auxiliary.lua
index 6ba21e0..35f8f2b 100644
--- a/src/luaotfload-auxiliary.lua
+++ b/src/luaotfload-auxiliary.lua
@@ -173,25 +173,30 @@ local set_capheight = function (fontdata)
local shared = fontdata.shared
local parameters = fontdata.parameters
local capheight
- if shared and shared.rawdata.metadata.pfminfo then
+ if shared
+ and shared.rawdata.metadata
+ and shared.rawdata.metadata.pfminfo
+ then
local units_per_em = parameters.units
local size = parameters.size
local os2_capheight = shared.rawdata.metadata.pfminfo.os2_capheight
- if os2_capheight > 0 then
+ if capheight and os2_capheight > 0 then
capheight = os2_capheight / units_per_em * size
else
- local X8 = stringbyte"X"
- if fontdata.characters[X8] then
- capheight = fontdata.characters[X8].height
+ local X8_str = stringbyte"X"
+ local X8_chr = fontdata.characters[X8_str]
+ if X8_chr then
+ capheight = X8_chr.height
else
capheight = parameters.ascender / units_per_em * size
end
end
else
- local X8 = stringbyte"X"
- if fontdata.characters[X8] then
- capheight = fontdata.characters[X8].height
+ local X8_str = stringbyte "X"
+ local X8_chr = fontdata.characters[X8_str]
+ if X8_chr then
+ capheight = X8_chr.height
end
end
if capheight then