diff options
Diffstat (limited to 'tex')
34 files changed, 411 insertions, 321 deletions
diff --git a/tex/context/base/bibl-bib.mkiv b/tex/context/base/bibl-bib.mkiv index 0ac60cfe1..5b40a3739 100644 --- a/tex/context/base/bibl-bib.mkiv +++ b/tex/context/base/bibl-bib.mkiv @@ -822,17 +822,17 @@ \def\inbibtexlink#1#2% {\doifreferencefoundelse{\bibtexrefprefix#1} {\goto{#2}[\bibtexrefprefix#1]} - {!#1!\unknownreference{#1}}} + {!#1!}} \def\dobibtexgotolink#1#2% {\doifreferencefoundelse{\bibtexrefprefix#1} {\goto{#2}[\bibtexrefprefix#1]} - {!#1!\unknownreference{#1}}} + {!#1!}} \def\dobibattexlink#1#2% {\doifreferencefoundelse{\bibtexrefprefix#1} {\at{#2}[\bibtexrefprefix#1]} - {!#1!\unknownreference{#1}}} + {!#1!}} \def\dobibtexurllink#1#2% {\expanded{\useURL[bibtex:url:#1][#2]}% @@ -940,7 +940,7 @@ % \setuppublications[\c!refcommand=num]% % \cite[#1]% % \endgroup} -% {\unknownreference{#1}}} +% {}} % compress years % andtext namesep diff --git a/tex/context/base/bibl-tra.mkiv b/tex/context/base/bibl-tra.mkiv index f74fc56eb..3a373346b 100644 --- a/tex/context/base/bibl-tra.mkiv +++ b/tex/context/base/bibl-tra.mkiv @@ -1285,9 +1285,9 @@ %D %D The final task is looping over that list until a match is found. -\def\gotobiblink#1[#2]{\doifreferencefoundelse{\bibrefprefix#2}{\goto{#1}[\bibrefprefix#2]}{\unknownreference{#2}}} -\def\atbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\at [\bibrefprefix#1]}{\unknownreference{#1}}} -\def\inbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\expanded{\goto{\currentreferencetext}}[\bibrefprefix#1]}{\unknownreference{#1}}} +\def\gotobiblink#1[#2]{\doifreferencefoundelse{\bibrefprefix#2}{\goto{#1}[\bibrefprefix#2]}{}} +\def\atbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\at [\bibrefprefix#1]}{}} +\def\inbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\expanded{\goto{\currentreferencetext}}[\bibrefprefix#1]}{}} %D \macros{bibauthoryearref,bibauthoryearsref,bibauthorref,bibyearref} %D @@ -1388,7 +1388,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\gotobiblink{\bibgetvars{#1}}[#1]} - {\unknownreference{#1}}} + {}} \def\bibserialref[#1]% {\bibalternative\v!left @@ -1399,7 +1399,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\gotobiblink{\bibgetvarn{#1}}[#1]} - {\unknownreference{#1}}} + {}} \def\bibkeyref[#1]% {\bibalternative\v!left @@ -1426,7 +1426,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\expanded{\bibgotoDOI{#1}{\bibgetvaro{#1}}}} - {\unknownreference{#1}}} + {}} \def\biburlref[#1]% {\bibalternative\v!left @@ -1442,7 +1442,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\expanded{\bibgotoURL{#1}{\bibgetvaru{#1}}}} - {\unknownreference{#1}}} + {}} \def\bibtyperef[#1]% {\bibalternative\v!left @@ -1453,7 +1453,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\gotobiblink{\bibgetvart{#1}}[#1]} - {\unknownreference{#1}}} + {}} \def\bibpageref[#1]% {\bibalternative\v!left @@ -1475,7 +1475,7 @@ {\bibinsertrefsep \doifbibreferencefoundelse{#1} {\dotypesetapublication{#1}} - {\unknownreference{#1}}} + {}} \let\bibnoneref\nocite @@ -1531,7 +1531,7 @@ \setuppublications[\c!refcommand=num]% \cite[#1]% \endgroup} - {\unknownreference{#1}}} + {}} %D And some defaults are loaded from bibl-apa: diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 6ef0310ec..c0591e9bd 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{2010.09.09 23:45} +\newcontextversion{2010.09.13 11: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 23afbe8c8..7e5da14e9 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{2010.09.09 23:45} +\edef\contextversion{2010.09.13 11:06} %D For those who want to use this: diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index 951390f5e..787b1b424 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -721,4 +721,5 @@ function fonts.reportusedfeatures() end end end + luatex.registerstopactions(fonts.reportusedfeatures) diff --git a/tex/context/base/font-fbk.lua b/tex/context/base/font-fbk.lua index fe8f64550..2a5b3cc22 100644 --- a/tex/context/base/font-fbk.lua +++ b/tex/context/base/font-fbk.lua @@ -53,7 +53,7 @@ end fallbacks['textcent'] = function (g) local c = ("c"):byte() - local t = table.fastcopy(g.characters[c]) + local t = table.fastcopy(g.characters[c],true) local a = - tan(rad(g.italicangle or 0)) local vfspecials = backends.tables.vfspecials local green, black @@ -118,7 +118,7 @@ end fallbacks['texteuro'] = function (g) local c = ("C"):byte() - local t = table.fastcopy(g.characters[c]) + local t = table.fastcopy(g.characters[c],true) local d = cos(rad(90+(g.italicangle))) local vfspecials = backends.tables.vfspecials local green, black diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua index 46cc34070..dec564993 100644 --- a/tex/context/base/font-otf.lua +++ b/tex/context/base/font-otf.lua @@ -24,13 +24,13 @@ local ioflush = io.flush local allocate = utilities.storage.allocate -local trace_private = false trackers.register("otf.private", function(v) trace_private = v end) -local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end) -local trace_features = false trackers.register("otf.features", function(v) trace_features = v end) -local trace_dynamics = false trackers.register("otf.dynamics", function(v) trace_dynamics = v end) -local trace_sequences = false trackers.register("otf.sequences", function(v) trace_sequences = v end) -local trace_math = false trackers.register("otf.math", function(v) trace_math = v end) -local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) +local trace_private = false trackers.register("otf.private", function(v) trace_private = v end) +local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end) +local trace_features = false trackers.register("otf.features", function(v) trace_features = v end) +local trace_dynamics = false trackers.register("otf.dynamics", function(v) trace_dynamics = v end) +local trace_sequences = false trackers.register("otf.sequences", function(v) trace_sequences = v end) +local trace_math = false trackers.register("otf.math", function(v) trace_math = v end) +local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) local report_otf = logs.new("load otf") @@ -580,6 +580,9 @@ local function somecopy(old) -- fast one end end +-- not setting italic_correction and class (when nil) during +-- table cronstruction can save some mem + actions["prepare glyphs"] = function(data,filename,raw) -- we can also move the names to data.luatex.names which might -- save us some more memory (at the cost of harder tracing) diff --git a/tex/context/base/font-syn.lua b/tex/context/base/font-syn.lua index 03aa528be..b246a1d82 100644 --- a/tex/context/base/font-syn.lua +++ b/tex/context/base/font-syn.lua @@ -31,6 +31,7 @@ using a table that has keys filtered from the font related files.</p> local texsprint = (tex and tex.sprint) or print +fonts = fonts or { } -- this module is also used in mtxrun local fonts = fonts fonts.names = fonts.names or { } diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua index a48d3c3f4..d887e45d3 100644 --- a/tex/context/base/font-tfm.lua +++ b/tex/context/base/font-tfm.lua @@ -229,6 +229,10 @@ local lastfont = nil -- base mode) but it complicates vf building where the new characters -- demand this data .. solution: functions that access them +-- we don't need the glyph data as we can use the description .. but we will +-- have to wait till we can access the internal tfm table efficiently in which +-- case characters will become a metatable afterwards + function tfm.cleanuptable(tfmdata) -- we need a cleanup callback, now we miss the last one if tfm.autocleanup then -- ok, we can hook this into everyshipout or so ... todo if tfmdata.type == 'virtual' or tfmdata.virtualized then diff --git a/tex/context/base/font-vf.lua b/tex/context/base/font-vf.lua index ccbe9a3e6..89260d2f8 100644 --- a/tex/context/base/font-vf.lua +++ b/tex/context/base/font-vf.lua @@ -58,7 +58,7 @@ local function combine_assign(g, name, from, to, start, force) g.fonts[hn] = { id = id } -- no need to be sparse for i=from,to do if fc[i] and (force or not gc[i]) then - gc[i] = fastcopy(fc[i]) -- can be optimized + gc[i] = fastcopy(fc[i],true) -- can be optimized gc[i].commands = { { 'slot', hn, start } } gd[i] = fd[i] end @@ -91,7 +91,7 @@ local function combine_names(g,name,force) local hn = #g.fonts for k, v in next, fc do if force or not gc[k] then - gc[k] = fastcopy(v) + gc[k] = fastcopy(v,true) gc[k].commands = { { 'slot', hn, k } } gd[i] = fd[i] end diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua index f1847cb40..08efa1a22 100644 --- a/tex/context/base/grph-inc.lua +++ b/tex/context/base/grph-inc.lua @@ -122,6 +122,13 @@ figures.defaultdepth = 0 figures.nofprocessed = 0 figures.preferquality = true -- quality over location +figures.existers = allocate() local existers = figures.existers +figures.checkers = allocate() local checkers = figures.checkers +figures.includers = allocate() local includers = figures.includers +figures.converters = allocate() local converters = figures.converters +figures.identifiers = allocate() local identifiers = figures.identifiers +figures.programs = allocate() local programs = figures.programs + figures.localpaths = allocate { ".", "..", "../.." } @@ -356,11 +363,11 @@ local function register(askedname,specification) if not newformat or newformat == "" then newformat = defaultformat end - local converter = (newformat ~= format) and converters[format] if trace_conversion then report_graphics("checking conversion of '%s': old format '%s', new format '%s', conversion '%s'", askedname,format,newformat,conversion or "default") end + local converter = (newformat ~= format) and converters[format] if converter then if converter[newformat] then converter = converter[newformat] @@ -372,6 +379,8 @@ local function register(askedname,specification) newformat = defaultformat end end + elseif trace_conversion then + report_graphics("no converter for '%s' -> '%s'",format,newformat) end if converter then local oldname = specification.fullname @@ -398,7 +407,7 @@ local function register(askedname,specification) newname = file.collapse_path(newname) local oldtime = lfs.attributes(oldname,'modification') or 0 local newtime = lfs.attributes(newname,'modification') or 0 - if oldtime > newtime then + if newtime == 0 or oldtime > newtime then if trace_conversion then report_graphics("converting '%s' from '%s' to '%s'",askedname,format,newformat) end @@ -657,24 +666,6 @@ end -- -- -- plugins -- -- -- -figures.existers = allocate() -local existers = figures.existers - -figures.checkers = allocate() -local checkers = figures.checkers - -figures.includers = allocate() -local includers = figures.includers - -figures.converters = allocate() -local converters = figures.converters - -figures.identifiers = allocate() -local identifiers = figures.identifiers - -figures.programs = allocate() -local programs = figures.programs - function identifiers.default(data) local dr, du, ds = data.request, data.used, data.status local l = locate(dr) @@ -990,9 +981,11 @@ programs.inkscape = { function svgconverter.pdf(oldname,newname) local inkscape = programs.inkscape + local oldname = dir.expandname(oldname) + local newname = dir.expandname(newname) runprogram ( - '%s "%s" --export-pdf="%s" %s', - inkscape.command, oldname, newname, makeoptions(inkscape.options) + '%s "%s" %s -A "%s"', + inkscape.command, oldname, makeoptions(inkscape.options), newname ) end diff --git a/tex/context/base/lpdf-ano.lua b/tex/context/base/lpdf-ano.lua index 5a98a6e81..03dd19eaa 100644 --- a/tex/context/base/lpdf-ano.lua +++ b/tex/context/base/lpdf-ano.lua @@ -40,25 +40,25 @@ local specials = references.specials local handlers = references.handlers local executers = references.executers -local pdfdictionary = lpdf.dictionary -local pdfarray = lpdf.array -local pdfreference = lpdf.reference -local pdfunicode = lpdf.unicode -local pdfconstant = lpdf.constant -local pdfflushobject = lpdf.flushobject -local pdfshareobjectref = lpdf.shareobjectreference -local pdfimmediateobject = lpdf.immediateobject -local pdfreserveobject = lpdf.reserveobject -local pdfpagereference = lpdf.pagereference - -local pdfregisterannot = pdf.registerannot - local nodepool = nodes.pool local pdfannotation_node = nodepool.pdfannotation local pdfdestination_node = nodepool.pdfdestination local latelua_node = nodepool.latelua +local pdfdictionary = lpdf.dictionary +local pdfarray = lpdf.array +local pdfreference = lpdf.reference +local pdfunicode = lpdf.unicode +local pdfconstant = lpdf.constant +local pdfflushobject = lpdf.flushobject +local pdfshareobjectreference = lpdf.shareobjectreference +local pdfimmediateobject = lpdf.immediateobject +local pdfreserveobject = lpdf.reserveobject +local pdfpagereference = lpdf.pagereference +local pdfdelayedobject = lpdf.delayedobject +local pdfregisterannotation = lpdf.registerannotation + local pdf_annot = pdfconstant("Annot") local pdf_uri = pdfconstant("URI") local pdf_gotor = pdfconstant("GoToR") @@ -68,6 +68,9 @@ local pdf_javascript = pdfconstant("JavaScript") local pdf_link = pdfconstant("Link") local pdf_n = pdfconstant("N") local pdf_t = pdfconstant("T") +local pdf_fit = pdfconstant("Fit") +local pdf_named = pdfconstant("Named") + local pdf_border = pdfarray { 0, 0, 0 } local getinnermethod = references.getinnermethod @@ -80,9 +83,9 @@ local function pagedestination(n) -- only cache fit if not pd then local a = pdfarray { pdfreference(pdfpagereference(n)), - pdfconstant("Fit") + pdf_fit, } - pd = pdfshareobjectref(a) + pd = pdfshareobjectreference(a) cache[n] = pd end return pd @@ -91,7 +94,7 @@ end lpdf.pagedestination = pagedestination -local defaultdestination = pdfarray { 0, pdfconstant("Fit") } +local defaultdestination = pdfarray { 0, pdf_fit } local function link(url,filename,destination,page,actions) if filename and filename ~= "" then @@ -119,7 +122,7 @@ local function link(url,filename,destination,page,actions) destination = nil end if not destination and page then - destination = pdfarray { page - 1, pdfconstant("Fit") } + destination = pdfarray { page - 1, pdf_fit } end return pdfdictionary { S = pdf_gotor, -- can also be pdf_launch @@ -162,7 +165,7 @@ local function link(url,filename,destination,page,actions) S = pdf_goto, D = pdfarray { pdfreference(pdfpagereference(p)), - pdfconstant("Fit") + pdf_fit, } } end @@ -238,85 +241,13 @@ function codeinjections.prerollreference(actions) -- share can become option Subtype = pdf_link, Border = pdf_border, H = (not actions.highlight and pdf_n) or nil, - A = pdfshareobjectref(main), + A = pdfshareobjectreference(main), F = 4, -- print (mandate in pdf/a) } return main("A") end end ---~ local lln = latelua_node() if not node.has_field(lln,'string') then - ---~ function nodeinjections.reference(width,height,depth,prerolled) -- keep this one ---~ if prerolled then ---~ if trace_references then ---~ report_references("w=%s, h=%s, d=%s, a=%s",width,height,depth,prerolled) ---~ end ---~ return pdfannotation_node(width,height,depth,prerolled) ---~ end ---~ end - ---~ function codeinjections.finishreference() ---~ end - ---~ else - ---~ report_references("hashing annotations") - ---~ local delayed = { } ---~ local hashed = { } ---~ local sharing = true -- we can do this for special refs (so we need an extra argument) - ---~ local function flush() ---~ local n = 0 ---~ for k,v in next, delayed do ---~ pdfimmediateobject(k,v) ---~ n = n + 1 ---~ end ---~ if trace_references then ---~ report_references("%s annotations flushed",n) ---~ end ---~ delayed = { } ---~ end - ---~ lpdf.registerpagefinalizer (flush,3,"annotations") -- somehow this lags behind .. I need to look into that some day ---~ lpdf.registerdocumentfinalizer(flush,3,"annotations") -- so we need a final flush too - ---~ local factor = number.dimenfactors.bp - ---~ function codeinjections.finishreference(width,height,depth,prerolled) ---~ local h, v = pdf.h, pdf.v ---~ local llx, lly = h*factor, (v - depth)*factor ---~ local urx, ury = (h + width)*factor, (v + height)*factor ---~ local annot = format("<< /Type /Annot %s /Rect [%s %s %s %s] >>",prerolled,llx,lly,urx,ury) ---~ local n = sharing and hashed[annot] ---~ if not n then ---~ n = pdfreserveobject() -- todo: share ---~ delayed[n] = annot ---~ --~ n = pdf.obj(annot) ---~ --~ pdf.refobj(n) ---~ if sharing then ---~ hashed[annot] = n ---~ end ---~ end ---~ pdfregisterannot(n) ---~ end - ---~ _bpnf_ = codeinjections.finishreference - ---~ function nodeinjections.reference(width,height,depth,prerolled) ---~ if prerolled then ---~ if trace_references then ---~ report_references("w=%s, h=%s, d=%s, a=%s",width,height,depth,prerolled) ---~ end ---~ -- local luacode = format("backends.pdf.codeinjections.finishreference(%s,%s,%s,'%s')",width,height,depth,prerolled) ---~ local luacode = format("_bpnf_(%s,%s,%s,'%s')",width,height,depth,prerolled) ---~ return latelua_node(luacode) ---~ end ---~ end - ---~ end node.free(lln) - local function use_normal_annotations() local function reference(width,height,depth,prerolled) -- keep this one @@ -335,43 +266,27 @@ local function use_normal_annotations() end -local delayed, hashed, sharing = { }, { }, true -- we can do this for special refs (so we need an extra argument) - -local function flush() - local n = 0 - for k,v in next, delayed do - pdfimmediateobject(k,v) - n = n + 1 - end - if trace_references then - report_references("%s annotations flushed",n) - end - delayed = { } -end +-- evenrually we can do this for special refs only -lpdf.registerdocumentfinalizer(flush,3,"annotations") -- so we need a final flush too -lpdf.registerpagefinalizer (flush,3,"annotations") -- somehow this lags behind .. I need to look into that some day +local hashed, nofunique, nofused = { }, 0, 0 local function use_shared_annotations() local factor = number.dimenfactors.bp - local function finishreference(width,height,depth,prerolled) + local function finishreference(width,height,depth,prerolled) -- %0.2f looks okay enough (no scaling anyway) local h, v = pdf.h, pdf.v local llx, lly = h*factor, (v - depth)*factor local urx, ury = (h + width)*factor, (v + height)*factor - local annot = format("<< /Type /Annot %s /Rect [%s %s %s %s] >>",prerolled,llx,lly,urx,ury) - local n = sharing and hashed[annot] + local annot = format("<< /Type /Annot %s /Rect [%0.2f %0.2f %0.2f %0.2f] >>",prerolled,llx,lly,urx,ury) + local n = hashed[annot] if not n then - n = pdfreserveobject() -- todo: share - delayed[n] = annot - --~ n = pdf.obj(annot) - --~ pdf.refobj(n) - if sharing then - hashed[annot] = n - end + n = pdfdelayedobject(annot) + hashed[annot] = n + nofunique = nofunique + 1 end - pdfregisterannot(n) + nofused = nofused + 1 + pdfregisterannotation(n) end _bpnf_ = finishreference @@ -381,12 +296,21 @@ local function use_shared_annotations() if trace_references then report_references("w=%s, h=%s, d=%s, a=%s",width,height,depth,prerolled) end - -- local luacode = format("backends.pdf.codeinjections.finishreference(%s,%s,%s,'%s')",width,height,depth,prerolled) local luacode = format("_bpnf_(%s,%s,%s,'%s')",width,height,depth,prerolled) return latelua_node(luacode) end end + statistics.register("pdf annotations", function() + if nofused > 0 then + -- table.print(hashed,"hashed_annotations") + return string.format("%s embedded, %s unique",nofused,nofunique) + else + return nil + end + end) + + return reference, finishreference end @@ -564,8 +488,6 @@ end specials.JS = specials.javascript -local pdf_named = pdfconstant("Named") - executers.importform = pdfdictionary { S = pdf_named, N = pdfconstant("AcroForm:ImportFDF") } executers.exportform = pdfdictionary { S = pdf_named, N = pdfconstant("AcroForm:ExportFDF") } executers.first = pdfdictionary { S = pdf_named, N = pdfconstant("FirstPage") } diff --git a/tex/context/base/lpdf-fmt.lua b/tex/context/base/lpdf-fmt.lua index aaa134f77..0b1dada0e 100644 --- a/tex/context/base/lpdf-fmt.lua +++ b/tex/context/base/lpdf-fmt.lua @@ -36,6 +36,29 @@ local lower, gmatch, format, find = string.lower, string.gmatch, string.format, local concat, serialize = table.concat, table.serialize local settings_to_array, settings_to_hash = utilities.parsers.settings_to_array, utilities.parsers.settings_to_hash +--[[ + Comments by Peter: + + output intent : only one profile per color space (and device class) + default color space : (theoretically) several profiles per color space possible + + The default color space profiles define the current gamuts (part of/all the + colors we have in the document), while the output intent profile declares the + gamut of the output devices (the colors that we get normally a printer or + monitor). + + Example: + + I have two RGB pictures (both 'painted' in /DeviceRGB) and I declare sRGB as + default color space for one picture and AdobeRGB for the other. As output + intent I use ISO_coated_v2_eci.icc. + + If I had more than one output intent profile for the combination CMYK/printer I + can't decide which one to use. But it is no problem to use several default color + space profiles for the same color space as it's just a different color + transformation. The relation between picture and profile is clear. +]]-- + local channels = { gray = 1, grey = 1, diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua index 0a98f150b..882fdfab5 100644 --- a/tex/context/base/lpdf-ini.lua +++ b/tex/context/base/lpdf-ini.lua @@ -13,8 +13,13 @@ local texwrite, texset, texsprint, ctxcatcodes = tex.write, tex.set, tex.sprint, local sind, cosd = math.sind, math.cosd local lpegmatch = lpeg.match -local pdfreserveobject = pdf and pdf.reserveobj or function() return 1 end -- for testing -local pdfimmediateobject = pdf and pdf.immediateobj or function() return 2 end -- for testing +--~ local pdfreserveobject = pdf and pdf.reserveobj or function() return 1 end -- for testing +--~ local pdfimmediateobject = pdf and pdf.immediateobj or function() return 2 end -- for testing + +local pdfreserveobject = pdf.reserveobj +local pdfimmediateobject = pdf.immediateobj +local pdfdeferredobject = pdf.obj +local pdfreferenceobject = pdf.refobj local trace_finalizers = false trackers.register("backend.finalizers", function(v) trace_finalizers = v end) local trace_resources = false trackers.register("backend.resources", function(v) trace_resources = v end) @@ -363,26 +368,18 @@ function lpdf.reserveannotation() return pdfreserveobject("annot") end -lpdf.immediateobject = pdf.immediateobj -lpdf.object = pdf.obj -- the table interface, todo: auto attr() and so -lpdf.pagereference = pdf.pageref or tex.pdfpageref - ---~ local pdfobj = pdf.obj - ---~ function lpdf.object(t) ---~ local attr = t.attr ---~ if type(attr) == "function" then ---~ t.attr = attr() ---~ end ---~ local str = t.string ---~ if str then ---~ t.string = tostring(str) ---~ end ---~ if not t.type then ---~ t.type = "raw" ---~ end ---~ pdfobj(t) ---~ end +lpdf.immediateobject = pdfimmediateobject +lpdf.object = pdfdeferredobject -- the table interface, todo: auto attr() and so +lpdf.deferredobject = pdfdeferredobject +lpdf.referenceobject = pdfreferenceobject +lpdf.pagereference = pdf.pageref or tex.pdfpageref +lpdf.registerannotation = pdf.registerannot + +function lpdf.delayedobject(data) + local n = pdfdeferredobject(data) + pdfreferenceobject(n) + return n +end function lpdf.flushobject(name,data) if data then @@ -441,7 +438,6 @@ function lpdf.shareobjectreference(content) return r end - --~ local d = lpdf.dictionary() --~ local e = lpdf.dictionary { ["e"] = "abc", x = lpdf.dictionary { ["f"] = "ABC" } } --~ local f = lpdf.dictionary { ["f"] = "ABC" } @@ -737,3 +733,30 @@ end -- lpdf.addtoinfo("ConTeXt.Time", os.date("%Y.%m.%d %H:%M")) -- :%S -- lpdf.addtoinfo("ConTeXt.Jobname", tex.jobname) -- lpdf.addtoinfo("ConTeXt.Url", "www.pragma-ade.com") + +if not pdfreferenceobject then + + local delayed = { } + + local function flush() + local n = 0 + for k,v in next, delayed do + pdfimmediateobject(k,v) + n = n + 1 + end + if trace_objects then + report_backends("%s objects flushed",n) + end + delayed = { } + end + + lpdf.registerdocumentfinalizer(flush,3,"objects") -- so we need a final flush too + lpdf.registerpagefinalizer (flush,3,"objects") -- somehow this lags behind .. I need to look into that some day + + function lpdf.delayedobject(data) + local n = pdfreserveobject() + delayed[n] = data + return n + end + +end diff --git a/tex/context/base/mtx-context-arrange.tex b/tex/context/base/mtx-context-arrange.tex index 7b764c495..4bb4dec69 100644 --- a/tex/context/base/mtx-context-arrange.tex +++ b/tex/context/base/mtx-context-arrange.tex @@ -1,5 +1,3 @@ -engine=luatex - %D \module %D [ file=mtx-context-arrange, %D version=2009.03.21, diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index 22d7ee3b4..23c6073fb 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -3235,6 +3235,7 @@ % 0=no-split, 1=no-split+indent, 2=split, 3=split+indent + \setnewconstant\backgroundsplitmode\plusthree %D The \type{\vbox to \lineheight{}\vskip\zeropoint} @@ -3278,11 +3279,11 @@ \loop \ifdim\pagetotal=\zeropoint % empty page \scratchdimen\textheight - \backgroundsplit\plusone % split to max height + \backgroundsplitmode\plusone % split to max height \else \setbox\scratchbox\vbox{\@@agbefore}% \scratchdimen\dimexpr\pagegoal-\ht\scratchbox-\pagetotal\relax - \backgroundsplit\plustwo % split to partial height + \backgroundsplitmode\plustwo % split to partial height \fi \advance\scratchdimen\dimexpr-\@@agtopoffset-\@@agbottomoffset\relax \ifdim\scratchdimen>2\lineheight\relax % reasonable, will be configurable @@ -3290,9 +3291,9 @@ \setbox2\vsplit0 to \scratchdimen \else \setbox2\box0 - \backgroundsplit\zerocount % no split + \backgroundsplitmode\zerocount % no split \fi - \setbox2\vbox \ifcase\backgroundsplit\or to \textheight \fi % max split + \setbox2\vbox \ifcase\backgroundsplitmode\or to \textheight \fi % max split {\vskip\@@agtopoffset \unvcopy2 \prevdepth\dp2 @@ -3300,7 +3301,7 @@ \vskip\@@agbottomoffset \vfill} \@@agbefore - \ifcase\backgroundsplit\or\or % partial split + \ifcase\backgroundsplitmode\or\or % partial split \ifdim\pagegoal<\maxdimen \pagegoal=1.2\pagegoal % be a bit more tolerant \fi @@ -3310,7 +3311,7 @@ \ifnum\backgroundsplitmode=\plusthree \hskip\dimen2 \fi % \localframed[\??ag][\c!offset=\v!overlay]{\box2}% new ** \stoplinecorrection - \ifcase\backgroundsplit % no split + \ifcase\backgroundsplitmode % no split \@@agafter \else % some split \vfill\eject % geen \page ! diff --git a/tex/context/base/page-lin.mkiv b/tex/context/base/page-lin.mkiv index e3ea155c9..220d6c1f8 100644 --- a/tex/context/base/page-lin.mkiv +++ b/tex/context/base/page-lin.mkiv @@ -485,8 +485,8 @@ {\edef\tline{\currentreferencelinenumber}% %[\fline,\tline] \ifx\fline\tline#2\else#3\fi} - {\unknownreference{#1}#2}} - {\unknownreference{#1}#2}} + {#2}} + {#2}} \def\inline#1[#2]% {\doifelsenothing{#1} diff --git a/tex/context/base/s-pre-61.tex b/tex/context/base/s-pre-61.tex index fa52d158a..216bb9a00 100644 --- a/tex/context/base/s-pre-61.tex +++ b/tex/context/base/s-pre-61.tex @@ -221,7 +221,7 @@ [bottom] [text] [background=topics] -% \doifnotmode{demo}{\endinput} +\doifnotmode{demo}{\endinput} \starttext diff --git a/tex/context/base/s-pre-62.tex b/tex/context/base/s-pre-62.tex index 64bb3495b..8bcfb48ee 100644 --- a/tex/context/base/s-pre-62.tex +++ b/tex/context/base/s-pre-62.tex @@ -207,22 +207,8 @@ \def\TitlePage {\doTitlePage\TitleFont\relax} \def\SubTitlePage{\doTitlePage\TitleFont\SubTitleFont} -\doifnotmode{demo} {\endinput} - -\starttext - -\StartTitlePage -bla\\bla bla\\bla -\StopTitlePage +\long\def\StartTitlePage #1\StopTitlePage {\TitlePage {#1}} +\long\def\StartSubTitlePage#1\StopSubTitlePage{\SubTitlePage{#1}} -\StartRemark {Bla Bla} - Bla Bla Bla. \FlushStep - Bla Bla Bla. \FlushStep -\StopRemark - -\StartRemark {Bla Bla} - Bla Bla Bla. \FlushStep - Bla Bla Bla. \FlushStep -\StopRemark +\doifnotmode{demo} {\endinput} -\stoptext diff --git a/tex/context/base/s-pre-63.tex b/tex/context/base/s-pre-63.tex index 76de8b991..eb4c9f589 100644 --- a/tex/context/base/s-pre-63.tex +++ b/tex/context/base/s-pre-63.tex @@ -11,6 +11,10 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +this module is under reconstruction + +\endinput + \usemodule[pre-61,streams] \definemeasure[textgap] [\dimexpr24pt\relax] @@ -58,12 +62,12 @@ \def\StartPair {} \def\StopPair {\setups[place:both]} -\doifnotmode {demo} {\endinput} +% \doifnotmode {demo} {\endinput} \setupbodyfont[8pt] \definefont[BigFont][Normal sa 4] \starttext - +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! \StartPage \StartPair \StartLeft ZAPF \StopLeft \StartRight \input zapf \StopRight \StopPair \StartPair \StartLeft DAVIS \StopLeft \StartRight \input davis \StopRight \StopPair diff --git a/tex/context/base/s-pre-64.tex b/tex/context/base/s-pre-64.tex index b9dc10002..1ad00fbab 100644 --- a/tex/context/base/s-pre-64.tex +++ b/tex/context/base/s-pre-64.tex @@ -169,35 +169,37 @@ \definefont[titlefont][palatinosanscom-bold*default at 48pt] \stopmode -\endinput +\doifnotmode{demo}{\endinput} -% \starttext +\starttext -% \SetBanner{tug 2007 san diego} +\usemodule[abr-01] -% \Title {hans hagen} +\SetBanner{tug 2007 san diego} -% \startstandardmakeup \titlefont \setupinterlinespace[line=3ex] \vfill +\Title {hans hagen} -% \StartItem \dontleavehmode \quad {\morecolor zapfino, a} \StopItem -% \StartItem \dontleavehmode \quad {\morecolor torture test} \StopItem -% \StartItem \dontleavehmode \quad {\morecolor for luatex} \StopItem +\startstandardmakeup \titlefont \setupinterlinespace[line=3ex] \vfill -% \vfill \stopstandardmakeup +\StartItem \dontleavehmode \quad {\morecolor zapfino, a} \StopItem +\StartItem \dontleavehmode \quad {\morecolor torture test} \StopItem +\StartItem \dontleavehmode \quad {\morecolor for luatex} \StopItem -% \Title{loading fonts} +\vfill \stopstandardmakeup -% \StartSteps +\Title{loading fonts} -% \StartItem the \OPENTYPE\ font reader is borrowed from \FONTFORGE\ \FlushStep \StopItem -% \StartItem once it was ready, we could look into such a font \FlushStep \StopItem -% \StartItem it tooks while to figure out the format due to rather fuzzy specs \FlushStep \StopItem -% \StartItem it took us even more time to find out that the loader was flawed \FlushStep \StopItem -% \StartItem one reason was that fonts themselves may have bugs or be incomplete \FlushStep \StopItem -% \StartItem then we changed to \FONTFORGE\ version 2 \FlushStep \StopItem -% \StartItem this made the missing pieces surface in more complex feature handling \FlushStep \StopItem -% \StartItem while implementing features the new table format was cleaned up \FlushStep \StopItem +\StartSteps -% \StopSteps +\StartItem the \OPENTYPE\ font reader is borrowed from \FONTFORGE\ \FlushStep \StopItem +\StartItem once it was ready, we could look into such a font \FlushStep \StopItem +\StartItem it tooks while to figure out the format due to rather fuzzy specs \FlushStep \StopItem +\StartItem it took us even more time to find out that the loader was flawed \FlushStep \StopItem +\StartItem one reason was that fonts themselves may have bugs or be incomplete \FlushStep \StopItem +\StartItem then we changed to \FONTFORGE\ version 2 \FlushStep \StopItem +\StartItem this made the missing pieces surface in more complex feature handling \FlushStep \StopItem +\StartItem while implementing features the new table format was cleaned up \FlushStep \StopItem -% \stoptext +\StopSteps + +\stoptext diff --git a/tex/context/base/s-pre-67.tex b/tex/context/base/s-pre-67.tex index 2168b170d..b22d37ce2 100644 --- a/tex/context/base/s-pre-67.tex +++ b/tex/context/base/s-pre-67.tex @@ -141,6 +141,15 @@ \let\Title\title \let\TitlePage\titlepage -% \starttext \input tufte \stoptext +\doifnotmode{demo}{\endinput} + +\starttext + \chapter{Test} + \startitemize + \startitem test \stopitem + \startitem test \stopitem + \startitem test \stopitem + \stopitemize +\stoptext \endinput diff --git a/tex/context/base/s-pre-69.tex b/tex/context/base/s-pre-69.tex index d65940520..9cf6fdfd5 100644 --- a/tex/context/base/s-pre-69.tex +++ b/tex/context/base/s-pre-69.tex @@ -255,18 +255,28 @@ \def\StartItems#1% {\setvariable{document}{topic}{\tfb#1} \startstandardmakeup[top=,bottom=\vss] + \startelement[items][title={#1}]% \ctxlua{document.SetParShape()} \StartSteps} \def\StopItems {\StopSteps + \stopelement \stopstandardmakeup} \def\StartItem - {\dontleavehmode\llap{\symbol[mysymbol]\quad}\ignorespaces} + {\dontleavehmode + \startelement[item]% + \llap{\symbol[mysymbol]\quad}% graphic + \ignorespaces} \def\StopItem - {\removeunwantedspaces\nobreak\crlf\crlf\FlushStep} + {\removeunwantedspaces + \nobreak + \crlf + \stopelement + \crlf + \FlushStep} \def\ShapeParagraph {\ctxlua{document.SetParShape()}} @@ -277,17 +287,28 @@ {\setvariable{document}{topic}{\tfb#1} \startstandardmakeup[top=,bottom=\vss] %\ctxlua{document.SetParShape()} + \startelement[paragraphs]% \StartSteps} \def\StopParagraphs {\StopSteps + \stopelement \stopstandardmakeup} \def\StartParagraph - {} + {\startelement[paragraph]} \def\StopParagraph - {\par\FlushStep} + {\par + \stopelement + \FlushStep} + +% experiment .. likely to change + +\setelementexporttag[items] [nature][display] +\setelementexporttag[item] [nature][mixed] +\setelementexporttag[paragraphs][nature][display] +\setelementexporttag[paragraph] [nature][mixed] \doifnotmode{demo}{\endinput} diff --git a/tex/context/base/s-pre-70.tex b/tex/context/base/s-pre-70.tex index 1a842388b..7e3049ab0 100644 --- a/tex/context/base/s-pre-70.tex +++ b/tex/context/base/s-pre-70.tex @@ -13,13 +13,15 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\usemodule[punk] \usetypescript[punk] \setupbodyfont[punk,20pt] - %D At the cost of more runtime and a larger output file, we %D turn on randomization. The instances are cached in the %D MkIV cache, so successive runs use the same shapes. -\EnableRandomPunk +% \usemodule[punk] \usetypescript[punk] \setupbodyfont[punk,20pt] +% +% \EnableRandomPunk + +\setupbodyfont[punknova,20pt] % we now use the opentype variant %D We use the regular screen size paper and layout setup. @@ -97,7 +99,9 @@ %D We don't want these reversed clicked areas in Acrobat. \setupinteraction - [click=no] + [click=no, + color=white, % pagecolor, + contrastcolor=white] % pagecolor, %D We define a rather simple navigational panel at the %D bottom diff --git a/tex/context/base/s-pre-71.tex b/tex/context/base/s-pre-71.tex index 91075d54d..db65c8e28 100644 --- a/tex/context/base/s-pre-71.tex +++ b/tex/context/base/s-pre-71.tex @@ -185,6 +185,9 @@ \definefont[TitleFont][SansBold at 60pt] \definefont[TempFont] [SansBold at 12pt] +\let\StartText\starttext +\let\StopText \stoptext + \doifnotmode{demo}{\endinput} \starttext diff --git a/tex/context/base/scrn-bar.mkiv b/tex/context/base/scrn-bar.mkiv index 0b2dfc627..75261b42e 100644 --- a/tex/context/base/scrn-bar.mkiv +++ b/tex/context/base/scrn-bar.mkiv @@ -85,7 +85,7 @@ \begingroup \doifnot{#1}\v!reset % obsolete, no caching any more {\doifassignmentelse{#1} - {\getparameters[\??ib][#2]% + {\getparameters[\??ib][#1]% \edef\currentinteractionbar{\interactionbarparameter\c!alternative}}% {\edef\currentinteractionbar{#1}% \ifsecondargument\getparameters[\??ib#1][#2]\fi}% diff --git a/tex/context/base/scrn-men.mkiv b/tex/context/base/scrn-men.mkiv index b3e97f608..3ab7e3e22 100644 --- a/tex/context/base/scrn-men.mkiv +++ b/tex/context/base/scrn-men.mkiv @@ -425,8 +425,7 @@ \global\settrue\skippedmenuitem \fi \fi}% - {\unknownreference{#4}% - \ifcase\csname\??am:\c!location:\menuparameter\c!unknownreference\endcsname\relax + {\ifcase\csname\??am:\c!location:\menuparameter\c!unknownreference\endcsname\relax \localframed[#1][#2]{#3}% \or \locboxyesempty{#1}{#2}{#3} diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua index 67436e0e3..6cc1004e9 100644 --- a/tex/context/base/strc-ref.lua +++ b/tex/context/base/strc-ref.lua @@ -941,11 +941,22 @@ end references.identify = identify +local unknowns, nofunknowns = { }, 0 + function references.doifelse(prefix,reference,highlight,newwindow,layer) local set, bug = identify(prefix,reference) local unknown = bug or #set == 0 if unknown then currentreference = nil -- will go away + local str = format("[%s][%s]",prefix,reference) + local u = unknowns[str] + if not u then + interfaces.showmessage("references",1,str) -- 1 = unknown, 4 = illegal + unknowns[str] = 1 + nofunknowns = nofunknowns + 1 + else + unknowns[str] = u + 1 + end else set.highlight, set.newwindow,set.layer = highlight, newwindow, layer currentreference = set[1] @@ -954,6 +965,20 @@ function references.doifelse(prefix,reference,highlight,newwindow,layer) commands.doifelse(not unknown) end +function references.reportproblems() -- might become local + if nofunknowns > 0 then + interfaces.showmessage("references",5,nofunknowns) -- 5 = unknown, 6 = illegal + -- -- we need a proper logger specific for the log file + -- texio.write_nl("log",format("%s unknown references",nofunknowns)) + -- for k, v in table.sortedpairs(unknowns) do + -- texio.write_nl("log",format("%s (n=%s)",k,v)) + -- end + -- texio.write_nl("log","") + end +end + +luatex.registerstopactions(references.reportproblems) + local innermethod = "names" function references.setinnermethod(m) diff --git a/tex/context/base/strc-ref.mkiv b/tex/context/base/strc-ref.mkiv index dfa1704c5..437782ff7 100644 --- a/tex/context/base/strc-ref.mkiv +++ b/tex/context/base/strc-ref.mkiv @@ -489,28 +489,14 @@ %D An unknown reference is reported on the screen, in the log %D file and, when enabled, in the left margin of the text. -\def\reportreferenceerror#1#2#3% only once (keep track in lua) - {\iftrialtypesetting \else - \ifinpagebody \else - \doifconcepttracing{\doifsomething{#3}{\inleft{\infofont\doboundtext{#3}{\dimexpr\leftmarginwidth-2em\relax}{..}->}}}% - \fi - \global\advance#1\plusone - \showmessage\m!references{#2}{[\referenceprefix][#3]}% - \fi} - -\newcount\nofunknownreferences -\newcount\nofillegalreferences +% \def\unknownreference#1% +% {\iftrialtypesetting \else +% \ifinpagebody \else +% \doifconcepttracing{\doifsomething{#1}{\inleft{\infofont\doboundtext{#1}{\dimexpr\leftmarginwidth-2em\relax}{..}->}}}% +% \fi +% \fi} -\def\unknownreference{\reportreferenceerror\nofunknownreferences1} -\def\illegalreference{\reportreferenceerror\nofillegalreferences4} - -\def\reportreferenceproblems - {\ifcase\nofunknownreferences\else\showmessage\m!references5{\number\nofunknownreferences}\fi - \ifcase\nofillegalreferences\else\showmessage\m!references6{\number\nofillegalreferences}\fi} - -\appendtoks - \reportreferenceproblems -\to \everystoptext +\let\unknownreference\gobbleoneargument %D When a reference is not found, we typeset a placeholder %D (two glyphs are often enough to represent the reference @@ -763,7 +749,7 @@ {\ifsecondargument \doifreferencefoundelse{#2} {\executeifdefined{reftype#1}\reftypep} - {\unknownreference{#2}\dummyreference}% + {\dummyreference}% \else \dummyreference \fi} @@ -923,10 +909,10 @@ %D label, only the text, or the label and the text. % \def\dounknownreference#1#2[#3]% -% {\unknownreference{#3}\dotextprefix{#2}\dummyreference}% +% {\dotextprefix{#2}\dummyreference}% \def\dounknownreference#1#2[#3]% - {\unknownreference{#3}\dotextprefix{#2}{\leftofreference\dummyreference\rightofreference}} + {\dotextprefix{#2}{\leftofreference\dummyreference\rightofreference}} \def\docompletereference#1#2[#3]% {\goto{\dotextprefix{#2}#1}[#3]} @@ -1196,7 +1182,7 @@ \setstrut % can be option \global\lastsavedreferenceattribute\lastreferenceattribute \attribute\referenceattribute\lastreferenceattribute}% - {\unknownreference{#3}}% + {}% \fi #1% %\egroup\unhbox\referencebox} @@ -1216,7 +1202,7 @@ \setlocationattributes\??ia \global\lastsavedreferenceattribute\lastreferenceattribute \attribute\referenceattribute\lastreferenceattribute}% - {\unknownreference{#3}}% + {}% \fi #1% \endgroup} @@ -1285,7 +1271,7 @@ \setlocationattributes\??ia \global\lastsavedreferenceattribute\lastreferenceattribute \hbox attr \referenceattribute \lastreferenceattribute {#1}}% - {\unknownreference{#2}}% + {}% \else #1% \fi @@ -1301,7 +1287,7 @@ \setbox\scratchbox\null\wd\scratchbox#1\ht\scratchbox#2% \global\lastsavedreferenceattribute\lastreferenceattribute \hbox attr \referenceattribute \lastreferenceattribute {\box\scratchbox}}% - {\unknownreference{#3}}% + {}% \endgroup} %D An reference to another document can be specified as a file @@ -1637,8 +1623,7 @@ {\setlocationboxnop#1[#2]{#3}[#4]} {\doifreferencefoundelse{#4} % INEFFICIENT {\setlocationboxyes#1[#2]{#3}[#4]} - {\unknownreference{#4}% - \setlocationboxnop#1[#2]{#3}[#4]}}}% + {\setlocationboxnop#1[#2]{#3}[#4]}}}% \fi \endgroup} diff --git a/tex/context/base/strc-tag.lua b/tex/context/base/strc-tag.lua index d6dcab81f..495da37c0 100644 --- a/tex/context/base/strc-tag.lua +++ b/tex/context/base/strc-tag.lua @@ -13,6 +13,7 @@ local gsub, find, topattern, format = string.gsub, string.find, string.topattern local lpegmatch = lpeg.match local texattribute, texsprint, ctxcatcodes = tex.attribute, tex.sprint, tex.ctxcatcodes local allocate = utilities.storage.allocate +local settings_to_hash = utilities.parsers.settings_to_hash local trace_tags = false trackers.register("structures.tags", function(v) trace_tags = v end) @@ -143,8 +144,14 @@ function tags.settagproperty(tag,key,value) end local lasttags = { } +local userdata = { } -function tags.start(tag,label,detail) +tags.userdata = userdata + +function tags.start(tag,specification) + local label = specification.label + local detail = specification.detail + local user = specification.userdata if not enabled then codeinjections.enabletags() enabled = true @@ -161,9 +168,15 @@ function tags.start(tag,label,detail) ids[fulltag] = n lasttags[tag] = n --~ print("SETTING",tag,n) - chain[#chain+1] = fulltag .. "-" .. n -- insert(chain,tag .. ":" .. n) + local completetag = fulltag .. "-" .. n + chain[#chain+1] = completetag -- insert(chain,tag .. ":" .. n) stack[#stack+1] = t -- insert(stack,t) taglist[t] = { unpack(chain) } -- we can add key values for alt and actualtext if needed + if user and user ~= "" then + -- maybe we should merge this into taglistor or whatever ... anyway there is room to optimize + -- taglist.userdata = settings_to_hash(user) + userdata[completetag] = settings_to_hash(user) + end texattribute[a_tagged] = t return t end diff --git a/tex/context/base/strc-tag.mkiv b/tex/context/base/strc-tag.mkiv index 94bd94c7c..5072dcd45 100644 --- a/tex/context/base/strc-tag.mkiv +++ b/tex/context/base/strc-tag.mkiv @@ -111,25 +111,40 @@ % todo: indirect macro for trialtypesetting -\unexpanded\def\dostartelement{\iftrialtypesetting\expandafter\noostartelement\else\expandafter\dodostartelement\fi} -\unexpanded\def\dostopelement {\iftrialtypesetting \else\expandafter\dodostopelement \fi} +\unexpanded\def\dostartelement{\iftrialtypesetting\expandafter\renostartelement\else\expandafter\redostartelement\fi} +\unexpanded\def\dostopelement {\iftrialtypesetting\expandafter\nonostopelement \else\expandafter\dodostopelement \fi} -\unexpanded\def\dodostartelement[#1]{\ctxlua{structures.tags.start("#1","\dogetupsometaglabeltext{#1}")}} -\unexpanded\def\dodostopelement {\ctxlua{structures.tags.stop()}} +\unexpanded\def\redostartelement{\dodoubleempty\dodostartelement} +\unexpanded\def\renostartelement{\dodoubleempty\nonostartelement} -\unexpanded\def\nostartelement[#1]{} -\unexpanded\def\nostopelement {} +\unexpanded\def\dodostartelement[#1][#2]% + {\ctxlua{structures.tags.start("#1",{ + label = "\dogetupsometaglabeltext{#1}", + userdata = \!!bs#2\!!es, + })}} + +\unexpanded\def\dodostopelement + {\ctxlua{structures.tags.stop()}} + +\unexpanded\def\nonostartelement[#1][#2]{} +\unexpanded\def\nonostopelement {} % beware: making this one unexpanded spoils tables (noalign problem) -\def\dodostarttagged{\iftrialtypesetting\expandafter\nodostarttagged\else\expandafter\dododostarttagged\fi} -\def\dodostoptagged {\iftrialtypesetting \else\expandafter\dododostoptagged \fi} +\def\dodostarttagged{\iftrialtypesetting\expandafter\nododostarttagged\else\expandafter\dododostarttagged\fi} +\def\dodostoptagged {\iftrialtypesetting\expandafter\nododostoptagged \else\expandafter\dododostoptagged \fi} + +\def\dododostarttagged#1#2% + {\ctxlua{structures.tags.start("#1",{ + label = "\dogetupsometaglabeltext{#1}", + detail = "#2", + })}} -\def\dododostarttagged#1#2{\ctxlua{structures.tags.start("#1","\dogetupsometaglabeltext{#1}","#2")}} -\def\dododostoptagged {\ctxlua{structures.tags.stop()}} +\def\dododostoptagged + {\ctxlua{structures.tags.stop()}} -\def\nodostarttagged#1#2{} -\def\nodostoptagged {} +\def\nododostarttagged#1#2{} +\def\nododostoptagged {} \newtoks\everysetupstructure @@ -143,16 +158,16 @@ \let\stopelement \dostopelement} \def\dodisableelements - {\let\startelement\nostartelement - \let\stopelement \nostopelement} + {\let\startelement\renostartelement + \let\stopelement \nonostopelement} \def\doenabletagged {\let\dostarttagged\dodostarttagged \let\dostoptagged \dodostoptagged } \def\dodisabletagged - {\let\dostarttagged\nodostarttagged - \let\dostoptagged \nodostoptagged } + {\let\dostarttagged\nododostarttagged + \let\dostoptagged \nododostoptagged } \newtoks\everyenableelements \newtoks\everydisableelements diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index 3989294e3..8dd3c57d5 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -3154,6 +3154,15 @@ \let\then\relax % so that we can say: \ifnum1>2\then -) +% demands that each conditional is defined .. it would be handy to have +% a primitive \unless\ifcase .. then we could use better values +% +% \def\settrue #1{#1\zerocount} +% \def\setfalse#1{#1\plusone} +% +% \def\newconditional#1{\ifdefined#1\else\newcount#1\fi\setfalse#1} +% \let\ifconditional \ifcase + %D \macros %D {ifzeropt} %D diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv index 656c56bfd..5e25539fd 100644 --- a/tex/context/base/tabl-tbl.mkiv +++ b/tex/context/base/tabl-tbl.mkiv @@ -1215,20 +1215,23 @@ % \starttabulate[||] \dorecurse{100}{\NC Eins \NC \NR \HL} \stoptabulate % \stoptext -\def\tabulateMLfive{\TABLEnoalign +\def\tabulateMLfive{\TABLEnoalign % this will be redone in the mkiv spacing way {\dotabulateruleseperator \dotabulaterule - \ifnum\noftabulatelines>\plusone - \ifnum\noftabulatelines<\minusnoftabulatelines - % *** somehow topskip messes up as it's intercepted - % \vskip \topskip\allowbreak\vskip- \topskip - % messy anyhow so this needs to be improved, so for - % the momenet we keep this bugged variant - \vskip1\topskip\allowbreak\vskip-1\topskip +% \ifnum\noftabulatelines>\plusone +% \ifnum\noftabulatelines<\minusnoftabulatelines +% % *** somehow topskip messes up as it's intercepted +% % \vskip \topskip\allowbreak\vskip- \topskip +% % messy anyhow so this needs to be improved, so for +% % the moment we keep this bugged variant +% \vskip1\topskip +% \allowbreak +% \vskip-1\topskip \vskip-\tabulateparameter\c!rulethickness \dotabulaterule - \fi - \fi +\nobreak +% \fi +% \fi \dotabulateruleseperator}} \def\tabulateLLfive{\TABLEnoalign @@ -1246,6 +1249,38 @@ \def\tabulateHLfive {\doHL\zerocount} +% \dorecurse{10}{ +% \starttabulate[|l|] +% \FL +% \NC first line, bound to next rule \NC \NR +% \TL +% \NC bound to previous rule \NC \NR +% \NC some line \NC \NR +% \NC some line \NC \NR +% \NC some line \NC \NR +% \NC bound to next rule \NC \NR +% \ML +% \NC bound to previous rule \NC \NR +% \NC bound to next rule \NC \NR +% \BL +% \NC last line, bound to previous rule \NC \NR +% \LL +% \stoptabulate +% } + +\def\tabulateTLfive{\TABLEnoalign + {\dotabulatenobreak + \dotabulateruleseperator + \dotabulatenobreak + \dotabulaterule + \dotabulatenobreak + \dotabulateruleseperator +% \prevdepth\strutdp % todo, might differ between TL and BL + \dotabulatenobreak}} + +\let\tabulateBLfive\tabulateTLfive + + \def\tabulaterule {\HR}% a rule with lineheight \def\tabulateline {\HL}% just a spaced rule \def\tabulateautorule{\doHR\plusone}% @@ -1299,6 +1334,8 @@ \let\FL\empty \let\FR\NR \let\ML\empty \let\MR\NR \let\LL\empty \let\LR\NR + \let\TL\empty + \let\BL\empty \let\doHR\gobbleoneargument \let\doHL\gobbleoneargument \glet\flushtabulated\empty @@ -1370,6 +1407,8 @@ \let\FL\tabulateFLfive \let\ML\tabulateMLfive \let\LL\tabulateLLfive + \let\TL\tabulateTLfive + \let\BL\tabulateBLfive \tabulatepass\plustwo % \ifcase\tabulaterepeathead diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 25c0f2d9d..307bb0c5e 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 09/09/10 23:45:11 +-- merge date : 09/13/10 11:06:52 do -- begin closure to overcome local limits and interference @@ -3417,6 +3417,10 @@ local lastfont = nil -- base mode) but it complicates vf building where the new characters -- demand this data .. solution: functions that access them +-- we don't need the glyph data as we can use the description .. but we will +-- have to wait till we can access the internal tfm table efficiently in which +-- case characters will become a metatable afterwards + function tfm.cleanuptable(tfmdata) -- we need a cleanup callback, now we miss the last one if tfm.autocleanup then -- ok, we can hook this into everyshipout or so ... todo if tfmdata.type == 'virtual' or tfmdata.virtualized then @@ -5462,13 +5466,13 @@ local ioflush = io.flush local allocate = utilities.storage.allocate -local trace_private = false trackers.register("otf.private", function(v) trace_private = v end) -local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end) -local trace_features = false trackers.register("otf.features", function(v) trace_features = v end) -local trace_dynamics = false trackers.register("otf.dynamics", function(v) trace_dynamics = v end) -local trace_sequences = false trackers.register("otf.sequences", function(v) trace_sequences = v end) -local trace_math = false trackers.register("otf.math", function(v) trace_math = v end) -local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) +local trace_private = false trackers.register("otf.private", function(v) trace_private = v end) +local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end) +local trace_features = false trackers.register("otf.features", function(v) trace_features = v end) +local trace_dynamics = false trackers.register("otf.dynamics", function(v) trace_dynamics = v end) +local trace_sequences = false trackers.register("otf.sequences", function(v) trace_sequences = v end) +local trace_math = false trackers.register("otf.math", function(v) trace_math = v end) +local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) local report_otf = logs.new("load otf") @@ -6018,6 +6022,9 @@ local function somecopy(old) -- fast one end end +-- not setting italic_correction and class (when nil) during +-- table cronstruction can save some mem + actions["prepare glyphs"] = function(data,filename,raw) -- we can also move the names to data.luatex.names which might -- save us some more memory (at the cost of harder tracing) |