diff options
Diffstat (limited to 'luaotfload-merged.lua')
-rw-r--r-- | luaotfload-merged.lua | 142 |
1 files changed, 85 insertions, 57 deletions
diff --git a/luaotfload-merged.lua b/luaotfload-merged.lua index 146ba36..2a68f8b 100644 --- a/luaotfload-merged.lua +++ b/luaotfload-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 08/01/13 01:31:02 +-- merge date : 08/20/13 13:38:20 do -- begin closure to overcome local limits and interference @@ -3676,6 +3676,7 @@ function constructors.scale(tfmdata,specification) if tonumber(specification) then specification={ size=specification } end + target.specification=specification local scaledpoints=specification.size local relativeid=specification.relativeid local properties=tfmdata.properties or {} @@ -3801,7 +3802,7 @@ function constructors.scale(tfmdata,specification) end target.type=isvirtual and "virtual" or "real" target.postprocessors=tfmdata.postprocessors - local targetslant=(parameters.slant or parameters[1] or 0) + local targetslant=(parameters.slant or parameters[1] or 0)*factors.pt local targetspace=(parameters.space or parameters[2] or 0)*hdelta local targetspace_stretch=(parameters.space_stretch or parameters[3] or 0)*hdelta local targetspace_shrink=(parameters.space_shrink or parameters[4] or 0)*hdelta @@ -4119,7 +4120,7 @@ function constructors.finalize(tfmdata) parameters.slantfactor=tfmdata.slant or 0 end if not parameters.designsize then - parameters.designsize=tfmdata.designsize or 655360 + parameters.designsize=tfmdata.designsize or (factors.pt*10) end if not parameters.units then parameters.units=tfmdata.units_per_em or 1000 @@ -5184,7 +5185,7 @@ local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts local otf=fonts.handlers.otf otf.glists={ "gsub","gpos" } -otf.version=2.743 +otf.version=2.745 otf.cache=containers.define("fonts","otf",otf.version,true) local fontdata=fonts.hashes.identifiers local chardata=characters and characters.data @@ -5204,6 +5205,7 @@ local packdata=true local syncspace=true local forcenotdef=false local includesubfonts=false +local overloadkerns=false local wildcard="*" local default="dflt" local fontloaderfields=fontloader.fields @@ -5215,6 +5217,7 @@ registerdirective("fonts.otf.loader.usemetatables",function(v) usemetatables=v e registerdirective("fonts.otf.loader.pack",function(v) packdata=v end) registerdirective("fonts.otf.loader.syncspace",function(v) syncspace=v end) registerdirective("fonts.otf.loader.forcenotdef",function(v) forcenotdef=v end) +registerdirective("fonts.otf.loader.overloadkerns",function(v) overloadkerns=v end) local function load_featurefile(raw,featurefile) if featurefile and featurefile~="" then if trace_loading then @@ -6495,74 +6498,93 @@ actions["merge kern classes"]=function(data,filename,raw) local resources=data.resources local unicodes=resources.unicodes local splitter=data.helpers.tounicodetable + local ignored=0 + local blocked=0 for gp=1,#gposlist do local gpos=gposlist[gp] local subtables=gpos.subtables if subtables then + local first_done={} + local split={} for s=1,#subtables do local subtable=subtables[s] local kernclass=subtable.kernclass + local lookup=subtable.lookup or subtable.name if kernclass then - local split={} - for k=1,#kernclass do - local kcl=kernclass[k] - local firsts=kcl.firsts - local seconds=kcl.seconds - local offsets=kcl.offsets - local lookups=kcl.lookup - if type(lookups)~="table" then - lookups={ lookups } - end - for n,s in next,firsts do - split[s]=split[s] or lpegmatch(splitter,s) - end - local maxseconds=0 - for n,s in next,seconds do - if n>maxseconds then - maxseconds=n - end - split[s]=split[s] or lpegmatch(splitter,s) + if #kernclass>0 then + kernclass=kernclass[1] + lookup=type(kernclass.lookup)=="string" and kernclass.lookup or lookup + report_otf("fixing kernclass table of lookup %a",lookup) + end + local firsts=kernclass.firsts + local seconds=kernclass.seconds + local offsets=kernclass.offsets + for n,s in next,firsts do + split[s]=split[s] or lpegmatch(splitter,s) + end + local maxseconds=0 + for n,s in next,seconds do + if n>maxseconds then + maxseconds=n end - for l=1,#lookups do - local lookup=lookups[l] - for fk=1,#firsts do - local fv=firsts[fk] - local splt=split[fv] - if splt then - local extrakerns={} - local baseoffset=(fk-1)*maxseconds - for sk=2,maxseconds do - local sv=seconds[sk] - local splt=split[sv] - if splt then - local offset=offsets[baseoffset+sk] - if offset then - for i=1,#splt do - extrakerns[splt[i]]=offset - end - end + split[s]=split[s] or lpegmatch(splitter,s) + end + for fk=1,#firsts do + local fv=firsts[fk] + local splt=split[fv] + if splt then + local extrakerns={} + local baseoffset=(fk-1)*maxseconds + for sk=2,maxseconds do + local sv=seconds[sk] + local splt=split[sv] + if splt then + local offset=offsets[baseoffset+sk] + if offset then + for i=1,#splt do + extrakerns[splt[i]]=offset end end - for i=1,#splt do - local first_unicode=splt[i] - local description=descriptions[first_unicode] - if description then - local kerns=description.kerns - if not kerns then - kerns={} - description.kerns=kerns - end - local lookupkerns=kerns[lookup] - if not lookupkerns then - lookupkerns={} - kerns[lookup]=lookupkerns - end + end + end + for i=1,#splt do + local first_unicode=splt[i] + if first_done[first_unicode] then + report_otf("lookup %a: ignoring further kerns of %C",lookup,first_unicode) + blocked=blocked+1 + else + first_done[first_unicode]=true + local description=descriptions[first_unicode] + if description then + local kerns=description.kerns + if not kerns then + kerns={} + description.kerns=kerns + end + local lookupkerns=kerns[lookup] + if not lookupkerns then + lookupkerns={} + kerns[lookup]=lookupkerns + end + if overloadkerns then for second_unicode,kern in next,extrakerns do lookupkerns[second_unicode]=kern end - elseif trace_loading then - report_otf("no glyph data for %U",first_unicode) + else + for second_unicode,kern in next,extrakerns do + local k=lookupkerns[second_unicode] + if not k then + lookupkerns[second_unicode]=kern + elseif k~=kern then + if trace_loading then + report_otf("lookup %a: ignoring overload of kern between %C and %C, rejecting %a, keeping %a",lookup,first_unicode,second_unicode,k,kern) + end + ignored=ignored+1 + end + end end + elseif trace_loading then + report_otf("no glyph data for %U",first_unicode) end end end @@ -6573,6 +6595,12 @@ actions["merge kern classes"]=function(data,filename,raw) end end end + if ignored>0 then + report_otf("%s kern overloads ignored",ignored) + end + if blocked>0 then + report_otf("%s succesive kerns blocked",blocked) + end end end actions["check glyphs"]=function(data,filename,raw) |