From 9e7781a95addbf3c500abf5a49cfe2f68fe506c0 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 17 Aug 2009 19:06:00 +0200 Subject: beta 2009.08.17 19:06 --- tex/context/base/anch-pgr.mkii | 2 +- tex/context/base/attr-ini.lua | 17 ++++++--- tex/context/base/back-pdf.lua | 4 +- tex/context/base/cont-new.tex | 2 +- tex/context/base/context.tex | 2 +- tex/context/base/font-afm.lua | 1 + tex/context/base/font-otb.lua | 4 +- tex/context/base/font-otf.lua | 1 + tex/context/base/font-tfm.lua | 8 +++- tex/context/base/lpdf-ini.lua | 58 +++++++++++++---------------- tex/context/base/lpdf-ini.mkiv | 1 + tex/context/base/lpdf-mis.lua | 3 +- tex/generic/context/luatex-fonts-merged.lua | 15 +++++--- 13 files changed, 65 insertions(+), 53 deletions(-) diff --git a/tex/context/base/anch-pgr.mkii b/tex/context/base/anch-pgr.mkii index bd5d7d3b9..194f19755 100644 --- a/tex/context/base/anch-pgr.mkii +++ b/tex/context/base/anch-pgr.mkii @@ -651,7 +651,7 @@ \def\initializeparbackgrounds {\ifcase\totalnofparbackgrounds\else - \enableparposition + \enableparpositions \fi} \unexpanded\def\starttextbackground diff --git a/tex/context/base/attr-ini.lua b/tex/context/base/attr-ini.lua index 9a8cadcf0..61bbb5f79 100644 --- a/tex/context/base/attr-ini.lua +++ b/tex/context/base/attr-ini.lua @@ -268,8 +268,15 @@ local data = transparencies.data local values = transparencies.values local template = "%s:%s" -local function inject_transparency (...) inject_transparency = nodeinjections.transparency return inject_transparency (...) end -local function register_transparency(...) register_transparency = registrations.transparency return register_transparency(...) end +local function inject_transparency (...) + inject_transparency = nodeinjections.transparency + return inject_transparency(...) +end + +local function register_transparency(...) + register_transparency = registrations.transparency + return register_transparency(...) +end function transparencies.register(name,a,t) local stamp = format(template,a,t) @@ -278,7 +285,7 @@ function transparencies.register(name,a,t) n = #values + 1 values[n] = { a, t } registered[stamp] = n - register_transparency(n,a,t) + register_transparency(n,a,t) -- needed here for metapost converter end return registered[stamp] end @@ -366,8 +373,8 @@ shipouts.handle_overprint = nodes.install_attribute_handler { name = "overprint", namespace = overprints, initializer = states.initialize, - finalizer = states.finalize , - processor = states.process , + finalizer = states.finalize, + processor = states.process, } --- negative / positive diff --git a/tex/context/base/back-pdf.lua b/tex/context/base/back-pdf.lua index b2e103d36..0b6a41c71 100644 --- a/tex/context/base/back-pdf.lua +++ b/tex/context/base/back-pdf.lua @@ -386,7 +386,7 @@ local transparencies = { [0] = } local documenttransparencies = { } -local transparencyhash = { } -- not needed +local transparencyhash = { } -- share objects local done = false @@ -406,7 +406,7 @@ function registrations.transparency(n,a,t) lpdf.adddocumentextgstate("Tr0",mr) done = true end - if n > 0 then + if n > 0 and not transparencyhash[n] then local d = pdfdictionary { Type = pdf_extgstate, ca = tonumber(t), diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index dd9610bef..54a26704d 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2009.08.16 18:21} +\newcontextversion{2009.08.17 19:06} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 408a28944..3f6608a1c 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2009.08.16 18:21} +\edef\contextversion{2009.08.17 19:06} %D For those who want to use this: diff --git a/tex/context/base/font-afm.lua b/tex/context/base/font-afm.lua index 931f7d118..81b47a269 100644 --- a/tex/context/base/font-afm.lua +++ b/tex/context/base/font-afm.lua @@ -477,6 +477,7 @@ function afm.copy_to_tfm(data) tfm.fullname = metadata.fullname tfm.filename = metadata.filename tfm.name = tfm.fullname + tfm.psname = tfm.fullname tfm.type = "real" tfm.units = 1000 tfm.stretch = stretch -- nil diff --git a/tex/context/base/font-otb.lua b/tex/context/base/font-otb.lua index 5ef44a011..a4606d319 100644 --- a/tex/context/base/font-otb.lua +++ b/tex/context/base/font-otb.lua @@ -361,8 +361,8 @@ function fonts.initializers.base.otf.features(tfmdata,value) -- eventually (and subset later on). If needed we can use a more -- verbose name as long as we don't use <()<>[]{}/%> and the length -- is < 128. - tfmdata.fullname = tfmdata.fullname .. "-" .. base ---~ logs.report("otf define","fullname base hash: '%s', featureset '%s'",tfmdata.fullname,hash) + tfmdata.fullname = tfmdata.fullname .. "-" .. base -- tfmdata.psname is the original + --~ logs.report("otf define","fullname base hash: '%s', featureset '%s'",tfmdata.fullname,hash) end if trace_preparing then logs.report("otf define","preparation time is %0.3f seconds for %s",os.clock()-t,tfmdata.fullname or "?") diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua index f3b3f5481..e8867c53d 100644 --- a/tex/context/base/font-otf.lua +++ b/tex/context/base/font-otf.lua @@ -1464,6 +1464,7 @@ function otf.copy_to_tfm(data,cache_id) -- we can save a copy when we reorder th -- we need a runtime lookup because of running from cdrom or zip, brrr tfm.filename = resolvers.findbinfile(luatex.filename,"") or luatex.filename tfm.fullname = metadata.fontname or metadata.fullname + tfm.psname = tfm.fullname tfm.encodingbytes = 2 tfm.cidinfo = data.cidinfo tfm.cidinfo.registry = tfm.cidinfo.registry or "" diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua index 8b799df5a..b2015723e 100644 --- a/tex/context/base/font-tfm.lua +++ b/tex/context/base/font-tfm.lua @@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['font-tfm'] = { local utf = unicode.utf8 -local next, format, match, lower = next, string.format, string.match, string.lower +local next, format, match, lower, gsub = next, string.format, string.match, string.lower, string.gsub local concat, sortedkeys, utfbyte, serialize = table.concat, table.sortedkeys, utf.byte, table.serialize local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) @@ -225,7 +225,7 @@ end local charactercache = { } -- The scaler is only used for otf and afm and virtual fonts. If --- a virtual font has italic correction make sur eto set the +-- a virtual font has italic correction make sure to set the -- has_italic flag. Some more flags will be added in the future. function tfm.do_scale(tfmtable, scaledpoints) @@ -553,6 +553,10 @@ end end t.nomath, t.MathConstants = true, nil end + -- fullname is used in the subsetting + if not t.psname then + t.psname = t.fullname -- else bad luck + end return t, delta end diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua index 753b09180..49f722c6a 100644 --- a/tex/context/base/lpdf-ini.lua +++ b/tex/context/base/lpdf-ini.lua @@ -394,9 +394,9 @@ backends.pdf = backends.pdf or { helpers = { }, } --- +-- three priority levels, default=2 -local pagefinalizers, documentfinalizers = { }, { } +local pagefinalizers, documentfinalizers = { { }, { }, { } }, { { }, { }, { } } local pageresources, pageattributes, pagesattributes @@ -416,22 +416,26 @@ function lpdf.addtopageresources (k,v) pageresources [k] = v end function lpdf.addtopageattributes (k,v) pageattributes [k] = v end function lpdf.addtopagesattributes(k,v) pagesattributes[k] = v end -local function set(where, f) - where[#where+1] = f +local function set(where,f,when) + local w = where[when or 2] + w[#w+1] = f end local function run(where) for i=1,#where do - where[i]() + local w = where[i] + for j=1,#w do + w[j]() + end end end -function lpdf.registerpagefinalizer(f) - set(pagefinalizers,f) +function lpdf.registerpagefinalizer(f,when) + set(pagefinalizers,f,when) end -function lpdf.registerdocumentfinalizer(f) - set(documentfinalizers,f) +function lpdf.registerdocumentfinalizer(f,when) + set(documentfinalizers,f,when) end function lpdf.finalizepage() @@ -466,22 +470,10 @@ local function checkcolorspaces() if next(d_colorspaces) then lpdf.addtopagereso local function checkpatterns () if next(d_patterns ) then lpdf.addtopageresources("Pattern", p_patterns ) end end local function checkshades () if next(d_shades ) then lpdf.addtopageresources("Shading", p_shades ) end end -local function flushextgstates () pdfimmediateobj(r_extgstates, tostring(d_extgstates )) end -local function flushcolorspaces() pdfimmediateobj(r_colorspaces,tostring(d_colorspaces)) end -local function flushpatterns () pdfimmediateobj(r_patterns, tostring(d_patterns )) end -local function flushshades () pdfimmediateobj(r_shades, tostring(d_shades )) end - ---~ function lpdf.collectedresources() ---~ local collected = pdfdictionary { ---~ ExtGState = (next(d_extgstates) and p_extgstates ) or nil, ---~ ColorSpace = (next(d_colorspaces) and p_colorspaces) or nil, ---~ Pattern = (next(d_patterns) and p_patterns ) or nil, ---~ Shading = (next(d_shades) and p_shades ) or nil, ---~ } ---~ if next(collected) then ---~ tex.sprint(tex.ctxcatcodes,collected()) ---~ end ---~ end +local function flushextgstates () if next(d_extgstates ) then pdfimmediateobj(r_extgstates, tostring(d_extgstates )) end end +local function flushcolorspaces() if next(d_colorspaces) then pdfimmediateobj(r_colorspaces,tostring(d_colorspaces)) end end +local function flushpatterns () if next(d_patterns ) then pdfimmediateobj(r_patterns, tostring(d_patterns )) end end +local function flushshades () if next(d_shades ) then pdfimmediateobj(r_shades, tostring(d_shades )) end end local collected = pdfdictionary { ExtGState = p_extgstates, @@ -499,15 +491,15 @@ function lpdf.adddocumentcolorspace(k,v) d_colorspaces[k] = v end function lpdf.adddocumentpattern (k,v) d_patterns [k] = v end function lpdf.adddocumentshade (k,v) d_shades [k] = v end -lpdf.registerdocumentfinalizer(flushextgstates) -lpdf.registerdocumentfinalizer(flushcolorspaces) -lpdf.registerdocumentfinalizer(flushpatterns) -lpdf.registerdocumentfinalizer(flushshades) +lpdf.registerdocumentfinalizer(flushextgstates,3) +lpdf.registerdocumentfinalizer(flushcolorspaces,3) +lpdf.registerdocumentfinalizer(flushpatterns,3) +lpdf.registerdocumentfinalizer(flushshades,3) -lpdf.registerpagefinalizer(checkextgstates) -lpdf.registerpagefinalizer(checkcolorspaces) -lpdf.registerpagefinalizer(checkpatterns) -lpdf.registerpagefinalizer(checkshades) +lpdf.registerpagefinalizer(checkextgstates,3) +lpdf.registerpagefinalizer(checkcolorspaces,3) +lpdf.registerpagefinalizer(checkpatterns,3) +lpdf.registerpagefinalizer(checkshades,3) -- diff --git a/tex/context/base/lpdf-ini.mkiv b/tex/context/base/lpdf-ini.mkiv index 52ed6c383..771ed3c58 100644 --- a/tex/context/base/lpdf-ini.mkiv +++ b/tex/context/base/lpdf-ini.mkiv @@ -24,6 +24,7 @@ \registerctxluafile{lpdf-fld}{1.001} \registerctxluafile{lpdf-u3d}{1.001} + \unprotect % for the moment here diff --git a/tex/context/base/lpdf-mis.lua b/tex/context/base/lpdf-mis.lua index e47da1c49..1bc1e99c6 100644 --- a/tex/context/base/lpdf-mis.lua +++ b/tex/context/base/lpdf-mis.lua @@ -58,6 +58,7 @@ local function initializenegative() lpdf.adddocumentextgstate("GSPositive", pdfreference(pdfimmediateobj(tostring(positive)))) end + local function initializeoverprint() local g = pdfconstant("ExtGState") local knockout = pdfdictionary { Type = g, OP = false, OPM = 0 } @@ -76,7 +77,7 @@ function codeinjections.addtransparencygroup() I = true, K = true, } - lpdf.registerpagefinalizer(function() lpdf.addtopageattributes("Group",d) end) + lpdf.registerpagefinalizer(function() lpdf.addtopageattributes("Group",d) end) -- hm end -- actions (todo: store and update when changed) diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 84371481e..a44570a48 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua --- merge date : 08/16/09 18:24:09 +-- merge date : 08/17/09 19:08:24 do -- begin closure to overcome local limits and interference @@ -3051,7 +3051,7 @@ if not modules then modules = { } end modules ['font-tfm'] = { local utf = unicode.utf8 -local next, format, match, lower = next, string.format, string.match, string.lower +local next, format, match, lower, gsub = next, string.format, string.match, string.lower, string.gsub local concat, sortedkeys, utfbyte, serialize = table.concat, table.sortedkeys, utf.byte, table.serialize local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) @@ -3268,7 +3268,7 @@ end local charactercache = { } -- The scaler is only used for otf and afm and virtual fonts. If --- a virtual font has italic correction make sur eto set the +-- a virtual font has italic correction make sure to set the -- has_italic flag. Some more flags will be added in the future. function tfm.do_scale(tfmtable, scaledpoints) @@ -3596,6 +3596,10 @@ end end t.nomath, t.MathConstants = true, nil end + -- fullname is used in the subsetting + if not t.psname then + t.psname = t.fullname -- else bad luck + end return t, delta end @@ -6442,6 +6446,7 @@ function otf.copy_to_tfm(data,cache_id) -- we can save a copy when we reorder th -- we need a runtime lookup because of running from cdrom or zip, brrr tfm.filename = resolvers.findbinfile(luatex.filename,"") or luatex.filename tfm.fullname = metadata.fontname or metadata.fullname + tfm.psname = tfm.fullname tfm.encodingbytes = 2 tfm.cidinfo = data.cidinfo tfm.cidinfo.registry = tfm.cidinfo.registry or "" @@ -7094,8 +7099,8 @@ function fonts.initializers.base.otf.features(tfmdata,value) -- eventually (and subset later on). If needed we can use a more -- verbose name as long as we don't use <()<>[]{}/%> and the length -- is < 128. - tfmdata.fullname = tfmdata.fullname .. "-" .. base ---~ logs.report("otf define","fullname base hash: '%s', featureset '%s'",tfmdata.fullname,hash) + tfmdata.fullname = tfmdata.fullname .. "-" .. base -- tfmdata.psname is the original + --~ logs.report("otf define","fullname base hash: '%s', featureset '%s'",tfmdata.fullname,hash) end if trace_preparing then logs.report("otf define","preparation time is %0.3f seconds for %s",os.clock()-t,tfmdata.fullname or "?") -- cgit v1.2.3