From 7255cf2df5467e43c2f688419d638cedb349baef Mon Sep 17 00:00:00 2001 From: Marius Date: Fri, 10 May 2013 15:40:21 +0300 Subject: beta 2013.05.10 14:22 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4132 -> 4138 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/font-mis.lua | 2 +- tex/context/base/font-otf.lua | 50 ++++++++++++--- tex/context/base/font-otp.lua | 23 +++++++ tex/context/base/status-files.pdf | Bin 24701 -> 24693 bytes tex/context/base/status-lua.pdf | Bin 211513 -> 211462 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 70 ++++++++++++++++++--- 9 files changed, 128 insertions(+), 21 deletions(-) diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 584c7a6d7..569bee1c9 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2013.05.10 10:26} +\newcontextversion{2013.05.10 14:22} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index fbb746f4a..769012d4c 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 6c6d66b15..01aee686b 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.05.10 10:26} +\edef\contextversion{2013.05.10 14:22} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-mis.lua b/tex/context/base/font-mis.lua index c22548ac5..83df65341 100644 --- a/tex/context/base/font-mis.lua +++ b/tex/context/base/font-mis.lua @@ -22,7 +22,7 @@ local handlers = fonts.handlers handlers.otf = handlers.otf or { } local otf = handlers.otf -otf.version = otf.version or 2.742 +otf.version = otf.version or 2.743 otf.cache = otf.cache or containers.define("fonts", "otf", otf.version, true) function otf.loadcached(filename,format,sub) diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua index b08b6e15d..720ad991a 100644 --- a/tex/context/base/font-otf.lua +++ b/tex/context/base/font-otf.lua @@ -48,7 +48,7 @@ local otf = fonts.handlers.otf otf.glists = { "gsub", "gpos" } -otf.version = 2.742 -- beware: also sync font-mis.lua +otf.version = 2.743 -- beware: also sync font-mis.lua otf.cache = containers.define("fonts", "otf", otf.version, true) local fontdata = fonts.hashes.identifiers @@ -72,6 +72,7 @@ local usemetatables = false -- .4 slower on mk but 30 M less mem so we migh local packdata = true local syncspace = true local forcenotdef = false +local includesubfonts = false local wildcard = "*" local default = "dflt" @@ -207,6 +208,7 @@ local valid_fields = table.tohash { local ordered_enhancers = { "prepare tables", + "prepare glyphs", "prepare lookups", @@ -232,8 +234,8 @@ local ordered_enhancers = { "check metadata", "check extra features", -- after metadata + "check encoding", -- moved "add duplicates", - "check encoding", "cleanup tables", } @@ -603,8 +605,7 @@ local function somecopy(old) -- fast one end end --- not setting hasitalics and class (when nil) during --- table cronstruction can save some mem +-- not setting hasitalics and class (when nil) during table cronstruction can save some mem actions["prepare glyphs"] = function(data,filename,raw) local rawglyphs = raw.glyphs @@ -623,7 +624,7 @@ actions["prepare glyphs"] = function(data,filename,raw) if rawsubfonts then - metadata.subfonts = { } + metadata.subfonts = includesubfonts and { } properties.cidinfo = rawcidinfo if rawcidinfo.registry then @@ -635,7 +636,9 @@ actions["prepare glyphs"] = function(data,filename,raw) for cidindex=1,#rawsubfonts do local subfont = rawsubfonts[cidindex] local cidglyphs = subfont.glyphs - metadata.subfonts[cidindex] = somecopy(subfont) + if includesubfonts then + metadata.subfonts[cidindex] = somecopy(subfont) + end for index=0,subfont.glyphcnt-1 do -- we could take the previous glyphcnt instead of 0 local glyph = cidglyphs[index] if glyph then @@ -725,6 +728,8 @@ actions["prepare glyphs"] = function(data,filename,raw) local u = a.unicode local v = a.variant if v then + -- tricky: no addition to d? needs checking but in practice such dups are either very simple + -- shapes or e.g cjk with not that many features local vv = variants[v] if vv then vv[u] = unicode @@ -762,6 +767,7 @@ actions["check encoding"] = function(data,filename,raw) local properties = data.properties local unicodes = resources.unicodes -- name to unicode local indices = resources.indices -- index to unicodes + local duplicates = resources.duplicates -- begin of messy (not needed when cidmap) @@ -780,10 +786,36 @@ actions["check encoding"] = function(data,filename,raw) for unicode, index in next, unicodetoindex do -- altuni already covers this if unicode <= criterium and not descriptions[unicode] then local parent = indices[index] -- why nil? - if parent then - report_otf("weird, unicode %U points to %U with index %H",unicode,parent,index) - else + if not parent then report_otf("weird, unicode %U points to nowhere with index %H",unicode,index) + else + local parentdescription = descriptions[parent] + if parentdescription then + local altuni = parentdescription.altuni + if not altuni then + altuni = { { unicode = parent } } + parentdescription.altuni = altuni + duplicates[parent] = { unicode } + else + local done = false + for i=1,#altuni do + if altuni[i].unicode == parent then + done = true + break + end + end + if not done then + -- let's assume simple cjk reuse + altuni[#altuni+1] = { unicode = parent } + table.insert(duplicates[parent],unicode) + end + end + if trace_loading then + report_otf("weird, unicode %U points to nowhere with index %H",unicode,index) + end + else + report_otf("weird, unicode %U points to %U with index %H",unicode,index) + end end end end diff --git a/tex/context/base/font-otp.lua b/tex/context/base/font-otp.lua index b02ae97ac..217bb7535 100644 --- a/tex/context/base/font-otp.lua +++ b/tex/context/base/font-otp.lua @@ -354,6 +354,12 @@ local function packdata(data) end end end + local altuni = description.altuni + if altuni then + for i=1,#altuni do + altuni[i] = pack_flat(altuni[i]) + end + end end local lookups = data.lookups if lookups then @@ -459,6 +465,10 @@ local function packdata(data) mlookups[tag] = pack_normal(mlookup) end end + local altuni = description.altuni + if altuni then + description.altuni = pack_normal(altuni) + end end local lookups = data.lookups if lookups then @@ -656,6 +666,19 @@ local function unpackdata(data) end end end + local altuni = description.altuni + if altuni then + local altuni = tables[altuni] + if altuni then + description.altuni = altuni + for i=1,#altuni do + local tv = tables[altuni[i]] + if tv then + altuni[i] = tv + end + end + end + end end local lookups = data.lookups if lookups then diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index de864528e..c12e77a4f 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 2642ab006..b682d2974 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index e3f22be76..c0c595e5f 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 05/10/13 10:26:54 +-- merge date : 05/10/13 14:22:06 do -- begin closure to overcome local limits and interference @@ -5046,7 +5046,7 @@ local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts local otf=fonts.handlers.otf otf.glists={ "gsub","gpos" } -otf.version=2.742 +otf.version=2.743 otf.cache=containers.define("fonts","otf",otf.version,true) local fontdata=fonts.hashes.identifiers local chardata=characters and characters.data @@ -5065,6 +5065,7 @@ local usemetatables=false local packdata=true local syncspace=true local forcenotdef=false +local includesubfonts=false local wildcard="*" local default="dflt" local fontloaderfields=fontloader.fields @@ -5191,8 +5192,8 @@ local ordered_enhancers={ "check glyphs", "check metadata", "check extra features", - "add duplicates", "check encoding", + "add duplicates", "cleanup tables", } local actions=allocate() @@ -5536,7 +5537,7 @@ actions["prepare glyphs"]=function(data,filename,raw) local duplicates=resources.duplicates local variants=resources.variants if rawsubfonts then - metadata.subfonts={} + metadata.subfonts=includesubfonts and {} properties.cidinfo=rawcidinfo if rawcidinfo.registry then local cidmap=fonts.cid.getmap(rawcidinfo) @@ -5547,7 +5548,9 @@ actions["prepare glyphs"]=function(data,filename,raw) for cidindex=1,#rawsubfonts do local subfont=rawsubfonts[cidindex] local cidglyphs=subfont.glyphs - metadata.subfonts[cidindex]=somecopy(subfont) + if includesubfonts then + metadata.subfonts[cidindex]=somecopy(subfont) + end for index=0,subfont.glyphcnt-1 do local glyph=cidglyphs[index] if glyph then @@ -5659,7 +5662,8 @@ actions["check encoding"]=function(data,filename,raw) local resources=data.resources local properties=data.properties local unicodes=resources.unicodes - local indices=resources.indices + local indices=resources.indices + local duplicates=resources.duplicates local mapdata=raw.map or {} local unicodetoindex=mapdata and mapdata.map or {} local encname=lower(data.enc_name or mapdata.enc_name or "") @@ -5671,10 +5675,35 @@ actions["check encoding"]=function(data,filename,raw) for unicode,index in next,unicodetoindex do if unicode<=criterium and not descriptions[unicode] then local parent=indices[index] - if parent then - report_otf("weird, unicode %U points to %U with index %H",unicode,parent,index) - else + if not parent then report_otf("weird, unicode %U points to nowhere with index %H",unicode,index) + else + local parentdescription=descriptions[parent] + if parentdescription then + local altuni=parentdescription.altuni + if not altuni then + altuni={ { unicode=parent } } + parentdescription.altuni=altuni + duplicates[parent]={ unicode } + else + local done=false + for i=1,#altuni do + if altuni[i].unicode==parent then + done=true + break + end + end + if not done then + altuni[#altuni+1]={ unicode=parent } + table.insert(duplicates[parent],unicode) + end + end + if trace_loading then + report_otf("weird, unicode %U points to nowhere with index %H",unicode,index) + end + else + report_otf("weird, unicode %U points to %U with index %H",unicode,index) + end end end end @@ -10691,6 +10720,12 @@ local function packdata(data) end end end + local altuni=description.altuni + if altuni then + for i=1,#altuni do + altuni[i]=pack_flat(altuni[i]) + end + end end local lookups=data.lookups if lookups then @@ -10795,6 +10830,10 @@ local function packdata(data) mlookups[tag]=pack_normal(mlookup) end end + local altuni=description.altuni + if altuni then + description.altuni=pack_normal(altuni) + end end local lookups=data.lookups if lookups then @@ -10986,6 +11025,19 @@ local function unpackdata(data) end end end + local altuni=description.altuni + if altuni then + local altuni=tables[altuni] + if altuni then + description.altuni=altuni + for i=1,#altuni do + local tv=tables[altuni[i]] + if tv then + altuni[i]=tv + end + end + end + end end local lookups=data.lookups if lookups then -- cgit v1.2.3