From bdbac97964c26fa5a6a22244ed374e7f477b43d2 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 28 Apr 2016 23:01:59 +0200 Subject: [*] update news --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 13c288e..f558e3b 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ Change History * Adapt packaging to changed upstream file layout. * Remove support for builtin Fontforge libraries (this includes the PFA, PFB, DFONT, and feature file readers). + * Allow configuration of anonymous lookups. 2015/12/09, luaotfload v2.6 * Add ``sign`` target to makefile for automated package signing. -- cgit v1.2.3 From 9deb7fdf2296191efffd3324bb4d77e3d2bb224f Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Mon, 2 May 2016 18:39:42 +0200 Subject: [fontloader] sync with Context as of 2016-05-02 --- src/fontloader/misc/fontloader-font-afm.lua | 16 +++++++++---- src/fontloader/misc/fontloader-font-dsp.lua | 4 ++-- src/fontloader/misc/fontloader-font-otj.lua | 8 ++++--- src/fontloader/misc/fontloader-font-otl.lua | 2 +- src/fontloader/misc/fontloader-font-ots.lua | 2 +- src/fontloader/misc/fontloader-l-file.lua | 2 +- src/fontloader/runtime/fontloader-reference.lua | 30 ++++++++++++++++--------- 7 files changed, 41 insertions(+), 23 deletions(-) diff --git a/src/fontloader/misc/fontloader-font-afm.lua b/src/fontloader/misc/fontloader-font-afm.lua index 99b8577..0d6b7cb 100644 --- a/src/fontloader/misc/fontloader-font-afm.lua +++ b/src/fontloader/misc/fontloader-font-afm.lua @@ -228,7 +228,8 @@ do -- old font loader - local fontloader = fontloader + local fontloader = fontloader + local get_indexes_old = false if fontloader then @@ -236,7 +237,7 @@ do local open_font = fontloader.open local close_font = fontloader.close - local function get_indexes_old(data,pfbname) + get_indexes_old = function(data,pfbname) local pfbblob = open_font(pfbname) if pfbblob then local characters = data.characters @@ -394,7 +395,7 @@ do end end - if fontloader then + if get_indexes_old then afm.use_new_indexer = true get_indexes_new = get_indexes @@ -598,7 +599,15 @@ unify = function(data, filename) resources.private = private end +local everywhere = { ["*"] = { ["*"] = true } } -- or: { ["*"] = { "*" } } +local noflags = { false, false, false, false } + +afm.experimental_normalize = false + normalize = function(data) + if type(afm.experimental_normalize) == "function" then + afm.experimental_normalize(data) + end end fixnames = function(data) @@ -616,7 +625,6 @@ fixnames = function(data) end end - --[[ldx--

These helpers extend the basic table with extra ligatures, texligatures and extra kerns. This saves quite some lookups later.

diff --git a/src/fontloader/misc/fontloader-font-dsp.lua b/src/fontloader/misc/fontloader-font-dsp.lua index 85a80bd..330a940 100644 --- a/src/fontloader/misc/fontloader-font-dsp.lua +++ b/src/fontloader/misc/fontloader-font-dsp.lua @@ -1144,8 +1144,8 @@ local function handlemark(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyp end for i=1,nofbaserecords do local components = baserecords[i] - local b = basecoverage[i] if components then + local b = basecoverage[i] for c=1,#components do local classes = components[c] if classes then @@ -1160,7 +1160,7 @@ local function handlemark(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyp end end end - components[i] = classes +-- components[i] = classes end end end diff --git a/src/fontloader/misc/fontloader-font-otj.lua b/src/fontloader/misc/fontloader-font-otj.lua index ebda723..6ff80d8 100644 --- a/src/fontloader/misc/fontloader-font-otj.lua +++ b/src/fontloader/misc/fontloader-font-otj.lua @@ -1202,9 +1202,11 @@ local function inject_everything(head,where) else -- local i = rawget(p,"emptyinjections") local i = p.emptyinjections - local leftkern = i.leftkern - if leftkern and leftkern ~= 0 then - setfield(prev,"replace",newkern(leftkern)) -- maybe also leftkern + if i then + local leftkern = i.leftkern + if leftkern and leftkern ~= 0 then + setfield(prev,"replace",newkern(leftkern)) -- maybe also leftkern + end end end if done then diff --git a/src/fontloader/misc/fontloader-font-otl.lua b/src/fontloader/misc/fontloader-font-otl.lua index bcea275..f7b6eb5 100644 --- a/src/fontloader/misc/fontloader-font-otl.lua +++ b/src/fontloader/misc/fontloader-font-otl.lua @@ -53,7 +53,7 @@ local report_otf = logs.reporter("fonts","otf loading") local fonts = fonts local otf = fonts.handlers.otf -otf.version = 3.018 -- beware: also sync font-mis.lua and in mtx-fonts +otf.version = 3.019 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otl", otf.version, true) local otfreaders = otf.readers diff --git a/src/fontloader/misc/fontloader-font-ots.lua b/src/fontloader/misc/fontloader-font-ots.lua index 90fcde2..21225c2 100644 --- a/src/fontloader/misc/fontloader-font-ots.lua +++ b/src/fontloader/misc/fontloader-font-ots.lua @@ -3347,7 +3347,7 @@ local function txtdirstate(start,stack,top,rlparmode) new = rlparmode end if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, level %a",dir,mref(rlparmode),mref(new),topstack) + report_process("directions after txtdir %a: parmode %a, txtmode %a, level %a",dir,mref(rlparmode),mref(new),top) end return getnext(start), top, new end diff --git a/src/fontloader/misc/fontloader-l-file.lua b/src/fontloader/misc/fontloader-l-file.lua index 7ed6370..b6822e9 100644 --- a/src/fontloader/misc/fontloader-l-file.lua +++ b/src/fontloader/misc/fontloader-l-file.lua @@ -436,7 +436,7 @@ local deslasher = lpeg.replacer(S("\\/")^1,"/") function file.join(one, two, three, ...) if not two then - return one == "" and one or lpegmatch(stripper,one) + return one == "" and one or lpegmatch(reslasher,one) end if one == "" then return lpegmatch(stripper,three and concat({ two, three, ... },"/") or two) diff --git a/src/fontloader/runtime/fontloader-reference.lua b/src/fontloader/runtime/fontloader-reference.lua index 5be6493..5f35ded 100644 --- a/src/fontloader/runtime/fontloader-reference.lua +++ b/src/fontloader/runtime/fontloader-reference.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 04/27/16 10:18:10 +-- merge date : 05/01/16 09:52:32 do -- begin closure to overcome local limits and interference @@ -2545,7 +2545,7 @@ local reslasher=lpeg.replacer(S("\\/"),"/") local deslasher=lpeg.replacer(S("\\/")^1,"/") function file.join(one,two,three,...) if not two then - return one=="" and one or lpegmatch(stripper,one) + return one=="" and one or lpegmatch(reslasher,one) end if one=="" then return lpegmatch(stripper,three and concat({ two,three,... },"/") or two) @@ -7114,11 +7114,12 @@ end local get_indexes do local fontloader=fontloader + local get_indexes_old=false if fontloader then local font_to_table=fontloader.to_table local open_font=fontloader.open local close_font=fontloader.close - local function get_indexes_old(data,pfbname) + get_indexes_old=function(data,pfbname) local pfbblob=open_font(pfbname) if pfbblob then local characters=data.characters @@ -7235,7 +7236,7 @@ do end end end - if fontloader then + if get_indexes_old then afm.use_new_indexer=true get_indexes_new=get_indexes get_indexes=function(data,pfbname) @@ -7415,7 +7416,13 @@ unify=function(data,filename) resources.marks={} resources.private=private end +local everywhere={ ["*"]={ ["*"]=true } } +local noflags={ false,false,false,false } +afm.experimental_normalize=false normalize=function(data) + if type(afm.experimental_normalize)=="function" then + afm.experimental_normalize(data) + end end fixnames=function(data) for k,v in next,data.descriptions do @@ -12678,8 +12685,8 @@ local function handlemark(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyp end for i=1,nofbaserecords do local components=baserecords[i] - local b=basecoverage[i] if components then + local b=basecoverage[i] for c=1,#components do local classes=components[c] if classes then @@ -12694,7 +12701,6 @@ local function handlemark(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofglyp end end end - components[i]=classes end end end @@ -15639,7 +15645,7 @@ local trace_defining=false registertracker("fonts.defining",function(v) trace_de local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts local otf=fonts.handlers.otf -otf.version=3.018 +otf.version=3.019 otf.cache=containers.define("fonts","otl",otf.version,true) local otfreaders=otf.readers local hashes=fonts.hashes @@ -17657,9 +17663,11 @@ local function inject_everything(head,where) end else local i=p.emptyinjections - local leftkern=i.leftkern - if leftkern and leftkern~=0 then - setfield(prev,"replace",newkern(leftkern)) + if i then + local leftkern=i.leftkern + if leftkern and leftkern~=0 then + setfield(prev,"replace",newkern(leftkern)) + end end end if done then @@ -21029,7 +21037,7 @@ local function txtdirstate(start,stack,top,rlparmode) new=rlparmode end if trace_directions then - report_process("directions after txtdir %a: parmode %a, txtmode %a, level %a",dir,mref(rlparmode),mref(new),topstack) + report_process("directions after txtdir %a: parmode %a, txtmode %a, level %a",dir,mref(rlparmode),mref(new),top) end return getnext(start),top,new end -- cgit v1.2.3 From 4ab4495fbd7df630ad313b9a93a2950c644fbd64 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Mon, 2 May 2016 20:59:14 +0200 Subject: [letterspace] fix crash with fonts with missing glyphs Fix issue #351 The letterspace node handler dereferences kern values of non-existant character information under some circumstances, causing Luatex to crash. To avoid this crash, check more thoroughly for the presence of the fields accessed. Discovered by @schlcht --- src/luaotfload-letterspace.lua | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/luaotfload-letterspace.lua b/src/luaotfload-letterspace.lua index 007fa51..bda56b2 100644 --- a/src/luaotfload-letterspace.lua +++ b/src/luaotfload-letterspace.lua @@ -411,11 +411,20 @@ kerncharacters = function (head) if keeptogether and keeptogether(prev, start) then -- keep 'm elseif identifiers[lastfont] then - local kerns = chardata[lastfont] and chardata[lastfont][prevchar].kerns - local kern = kerns and kerns[lastchar] or 0 - krn = kern + quaddata[lastfont]*krn -- here - insert_node_before(head,start,kern_injector(fillup,krn)) - done = true + local lastfontchars = chardata[lastfont] + if lastfontchars then + local prevchardata = lastfontchars[prevchar] + if not prevchardata then + --- font doesn’t contain the glyph + else + local kern = 0 + local kerns = prevchardata.kerns + if kerns then kern = kerns[lastchar] end + krn = kern + quaddata[lastfont]*krn -- here + insert_node_before(head,start,kern_injector(fillup,krn)) + done = true + end + end end else krn = quaddata[lastfont]*krn -- here @@ -477,10 +486,19 @@ kerncharacters = function (head) and getid(prv) == glyph_code and getfont(prv) == lastfont then + local kern = 0 local prevchar = getchar(prv) local lastchar = getchar(start) - local kerns = chardata[lastfont] and chardata[lastfont][prevchar].kerns - local kern = kerns and kerns[lastchar] or 0 + local lastfontchars = chardata[lastfont] + if lastfontchars then + local prevchardata = lastfontchars[prevchar] + if not prevchardata then + --- font doesn’t contain the glyph + else + local kerns = prevchardata.kerns + if kerns then kern = kerns[lastchar] end + end + end krn = kern + quaddata[lastfont]*krn -- here else krn = quaddata[lastfont]*krn -- here -- cgit v1.2.3 From 687430a81dcd658d664e6a8c7dca6f53bc093a8c Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Mon, 2 May 2016 21:07:14 +0200 Subject: [letterspace] remove useless state variable --- src/luaotfload-letterspace.lua | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/luaotfload-letterspace.lua b/src/luaotfload-letterspace.lua index bda56b2..40b3015 100644 --- a/src/luaotfload-letterspace.lua +++ b/src/luaotfload-letterspace.lua @@ -277,7 +277,7 @@ local kernfactors = { } --- fontid -> factor local kerncharacters kerncharacters = function (head) - local start, done = head, false + local start = head local lastfont = nil local keepligature = letterspace.keepligature --- function local keeptogether = letterspace.keeptogether --- function @@ -352,7 +352,6 @@ kerncharacters = function (head) start = c setfield(s, "components", nil) free_node(s) - done = true c = getfield (start, "components") end end @@ -378,7 +377,6 @@ kerncharacters = function (head) local shrunk = (getfield(spec,"shrink") * newwd) / wd setfield(prev, "spec", spec_injector(fillup, newwd, stretched, shrunk)) - done = true end elseif pid == kern_code then @@ -400,7 +398,6 @@ kerncharacters = function (head) local prev_kern = getfield(prev, "kern") prev_kern = prev_kern + quaddata[lastfont] * krn setfield (prev, "kern", prev_kern) - done = true end end @@ -422,14 +419,12 @@ kerncharacters = function (head) if kerns then kern = kerns[lastchar] end krn = kern + quaddata[lastfont]*krn -- here insert_node_before(head,start,kern_injector(fillup,krn)) - done = true end end end else krn = quaddata[lastfont]*krn -- here insert_node_before(head,start,kern_injector(fillup,krn)) - done = true end elseif pid == disc_code then @@ -514,7 +509,7 @@ kerncharacters = function (head) start = getnext(start) end end - return head, done + return head end ---=================================================================--- @@ -566,7 +561,7 @@ local enablefontkerning = function ( ) logreport ("term", 5, "letterspace", "kerncharacters() invoked with node.direct interface \z (``%s`` -> ``%s``)", tostring (hd), tostring (direct_hd)) - local direct_hd, _done = kerncharacters (direct_hd) + local direct_hd = kerncharacters (direct_hd) if not direct_hd then --- bad logreport ("both", 0, "letterspace", "kerncharacters() failed to return a valid new head") -- cgit v1.2.3