From 61f0c68e868a58e7f1ddc929a441b3280a571331 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 9 Apr 2016 12:39:25 +0200 Subject: [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. --- src/luaotfload-auxiliary.lua | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/luaotfload-auxiliary.lua') 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 -- cgit v1.2.3