diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-10-08 20:46:55 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-10-08 20:46:55 +0200 |
commit | 778f381ba6a448ab00d67994a412dd4226d43238 (patch) | |
tree | d9dade45016a572e6c22521bfb165f9829ac3192 /tex/context/base | |
parent | 2073fe5d88215dddd9a9e6421afaea7ab7db955a (diff) | |
download | context-778f381ba6a448ab00d67994a412dd4226d43238.tar.gz |
2021-10-08 20:07:00
Diffstat (limited to 'tex/context/base')
28 files changed, 312 insertions, 108 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 15f593712..d43e2ccf1 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2021.09.26 16:48} +\newcontextversion{2021.10.08 20:05} %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/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 4015da53a..3c7645d53 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2021.09.26 16:48} +\edef\contextversion{2021.10.08 20:05} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-cs.mkii b/tex/context/base/mkii/mult-cs.mkii index aa936d180..2c7f8e197 100644 --- a/tex/context/base/mkii/mult-cs.mkii +++ b/tex/context/base/mkii/mult-cs.mkii @@ -188,6 +188,7 @@ \setinterfacevariable{enumeration}{vycet} \setinterfacevariable{environment}{prostredi} \setinterfacevariable{even}{sude} +\setinterfacevariable{explicit}{explicit} \setinterfacevariable{export}{export} \setinterfacevariable{external}{externi} \setinterfacevariable{extremestretch}{extremestretch} diff --git a/tex/context/base/mkiv/char-def.lua b/tex/context/base/mkiv/char-def.lua index aabcb0615..c8dac09c5 100644 --- a/tex/context/base/mkiv/char-def.lua +++ b/tex/context/base/mkiv/char-def.lua @@ -271537,4 +271537,4 @@ characters.data={ synonyms={ "vs17" }, unicodeslot=0xE0100, }, -}
\ No newline at end of file +} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index d7c2469e8..c8893eb1e 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.09.26 16:48} +\newcontextversion{2021.10.08 20:05} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 1a32832af..89e04f878 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.09.26 16:48} +\edef\contextversion{2021.10.08 20:05} %D Kind of special: diff --git a/tex/context/base/mkiv/font-otr.lua b/tex/context/base/mkiv/font-otr.lua index 3b5edebc4..286367ed9 100644 --- a/tex/context/base/mkiv/font-otr.lua +++ b/tex/context/base/mkiv/font-otr.lua @@ -1962,9 +1962,10 @@ local function getinfo(maindata,sub,platformnames,rawfamilynames,metricstoo,inst weight = weight and lower(weight), width = width and lower(width), pfmweight = metrics.weightclass or 400, -- will become weightclass - pfmwidth = metrics.widthclass or 5, -- will become widthclass + pfmwidth = metrics.widthclass or 5, -- will become widthclass panosewidth = metrics.panosewidth, panoseweight = metrics.panoseweight, + fstype = metrics.fstype or 0, -- embedding, subsetting and editing italicangle = postscript.italicangle or 0, units = fontheader.units or 0, designsize = fontdata.designsize, diff --git a/tex/context/base/mkiv/math-fbk.lua b/tex/context/base/mkiv/math-fbk.lua index f1efadc45..aecffb466 100644 --- a/tex/context/base/mkiv/math-fbk.lua +++ b/tex/context/base/mkiv/math-fbk.lua @@ -32,6 +32,7 @@ local popcommand = helpers.commands.pop local pushcommand = helpers.commands.push local virtualcharacters = { } +local virtualforced = { } local hashes = fonts.hashes local identifiers = hashes.identifiers @@ -136,7 +137,7 @@ function fallbacks.apply(target,original) local fullname = trace_fallbacks and target.properties.fullname -- for k, v in sortedhash(virtualcharacters) do - if not characters[k] then + if not characters[k] or virtualforced[k] then local tv = type(v) local cd = nil if tv == "table" then @@ -698,3 +699,30 @@ virtualcharacters[0x305] = function(data) } end +local function threedots(data,shift) + local characters = data.target.characters + local parameters = data.target.parameters + local periodchar = characters[0x002E] + local pluschar = characters[0x002B] + local period = charcommand[0x002E] + local periodwd = periodchar.width or 0 + local periodht = periodchar.height or 0 + local perioddp = periodchar.depth or 0 + local offset = 0 + if shift then + local plusht = pluschar.height or 0 + local plusdp = pluschar.depth or 0 + local axis = (plusdp + plusht)//2 - plusdp + offset = axis - periodht//2 + periodht = axis + periodht//2 + end + return { + width = 3*periodwd, + height = periodht, + depth = 0, + commands = { upcommand[offset], period, period, period } + } +end + +virtualcharacters[0x2026] = function(data) return threedots(data,false) end virtualforced[0x2026] = true +virtualcharacters[0x22EF] = function(data) return threedots(data, true) end virtualforced[0x22EF] = true diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua index a06deffe5..bb3f458bf 100644 --- a/tex/context/base/mkiv/mult-def.lua +++ b/tex/context/base/mkiv/mult-def.lua @@ -17327,6 +17327,9 @@ return { ["pe"]="بدونآویزانکردن", ["ro"]="nothanging", }, + ["explicit"]={ + ["en"]="explicit", + }, ["notcollapsed"]={ ["en"]="notcollapsed", }, diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index 4842a3571..30e1eac10 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -175,7 +175,7 @@ return { "wildcardsymbol", -- "normalhyphenationcode", "automatichyphenationcode", "explicithyphenationcode", "syllablehyphenationcode", "uppercasehyphenationcode", - "collapsehyphenationmcode", "compoundhyphenationcode", "strictstarthyphenationcode", "strictendhyphenationcode", + "collapsehyphenationcode", "compoundhyphenationcode", "strictstarthyphenationcode", "strictendhyphenationcode", "automaticpenaltyhyphenationcode", "explicitpenaltyhyphenationcode", "permitgluehyphenationcode", "permitallhyphenationcode", "permitmathreplacehyphenationcode", "forcecheckhyphenationcode", "lazyligatureshyphenationcode", "forcehandlerhyphenationcode", "feedbackcompoundhyphenationcode", "ignoreboundshyphenationcode", "partialhyphenationcode", "completehyphenationcode", diff --git a/tex/context/base/mkiv/publ-aut.lua b/tex/context/base/mkiv/publ-aut.lua index 02f4798c5..64fecb3d5 100644 --- a/tex/context/base/mkiv/publ-aut.lua +++ b/tex/context/base/mkiv/publ-aut.lua @@ -998,6 +998,22 @@ publications.sortmethods.authoryear = { }, } +publications.sortmethods.authortitle = { + sequence = { + { field = "author", default = "", unknown = "" }, + { field = "title", default = "", unknown = "" }, + { field = "booktitle", default = "", unknown = "" }, -- if this is an untitled section (e.g., introduction, foreword, preface) of a book or a review of a book + { field = "maintitle", default = "", unknown = "" }, -- if this is an untitled section or volume in a multivolume collection + { field = "volume", default = "", unknown = "" }, + { field = "part", default = "", unknown = "" }, + { field = "date", default = "9998-13-32", unknown = "9999-14-33" }, -- some specifications allow date instead of year, month, day + { field = "year", default = "9998", unknown = "9999" }, + { field = "month", default = "13", unknown = "14" }, + { field = "day", default = "32", unknown = "33" }, + { field = "index", default = "", unknown = "" }, + }, +} + implement { name = "btxremapauthor", arguments = "2 strings", diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 0eca85be1..c251ad6c1 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 2fe879833..50cc0ad29 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/typo-drp.lua b/tex/context/base/mkiv/typo-drp.lua index d56ba3da7..79cda3ab9 100644 --- a/tex/context/base/mkiv/typo-drp.lua +++ b/tex/context/base/mkiv/typo-drp.lua @@ -73,6 +73,7 @@ local v_default = variables.default local v_margin = variables.margin local v_auto = variables.auto local v_first = variables.first +local v_keep = variables.keep local v_last = variables.last local texget = tex.get @@ -133,6 +134,7 @@ interfaces.implement { -- a page so this has a low priority actions[v_default] = function(head,setting) + local skip = false -- begin of par local first = getnext(head) local indent = false @@ -196,6 +198,9 @@ actions[v_default] = function(head,setting) else -- keep quote etc with initial local next = getnext(first) + if next and method[v_keep] then + skip = first + end if not next then -- don't start with a quote or so return head @@ -245,7 +250,7 @@ actions[v_default] = function(head,setting) local id = getid(current) if id == kern_code then setkern(current,0) - elseif id == glyph_code then + elseif id == glyph_code and skip ~= current then local next = getnext(current) if font then setfont(current,font) @@ -301,7 +306,11 @@ actions[v_default] = function(head,setting) -- local hoffset = width + hoffset + distance + (indent and parindent or 0) for current in nextglyph, first do - setoffsets(current,-hoffset,-voffset) -- no longer - height here + if skip == current then + setoffsets(current,-hoffset,0) + else + setoffsets(current,-hoffset,-voffset) -- no longer - height here + end if current == last then break end diff --git a/tex/context/base/mkiv/util-sci.lua b/tex/context/base/mkiv/util-sci.lua index 778991ea6..67528c74e 100644 --- a/tex/context/base/mkiv/util-sci.lua +++ b/tex/context/base/mkiv/util-sci.lua @@ -23,6 +23,7 @@ do lexerroot = file.dirname(resolvers.findfile("scite-context-lexer.lua")) -- end if lfs.isdir(lexerroot) then + -- pushluapath package.extraluapath(lexerroot) package.extraluapath(lexerroot.."/themes") package.extraluapath(lexerroot.."/data") @@ -58,14 +59,14 @@ local knownlexers = { -- todo: pat/hyp ori } -lexer = nil -- main lexer, global (for the moment needed for themes) +lexers = nil -- main lexer, global (for the moment needed for themes) local function loadscitelexer() - if not lexer then - lexer = require("scite-context-lexer") - require("scite-context-theme") -- uses lexer - if lexer then - lexer.context.disablewordcheck() + if not lexers then + lexers = require("scite-context-lexer") + lexers.styles = require("scite-context-theme") -- uses lexer + if lexers then + (lexers.disablewordcheck or lexers.context.disablewordcheck)() end end return lexer @@ -74,7 +75,7 @@ end local loadedlexers = setmetatableindex(function(t,k) local l = knownlexers[k] or k loadscitelexer() - local v = lexer.load(formatters["scite-context-lexer-%s"](l)) + local v = lexers.load(formatters["scite-context-lexer-%s"](l)) t[l] = v t[k] = v return v @@ -124,7 +125,7 @@ local function exportcsslexing() return (#f == 0 and f[1] == 0) or ((f[1] == f[2]) and (f[2] == f[3]) and (f[3] == 0)) end local result, r = { }, 0 - for k, v in table.sortedhash(lexer.context.styles) do + for k, v in table.sortedhash(lexers.context.styles) do local bold = v.bold local fore = v.fore r = r + 1 @@ -149,7 +150,7 @@ local function exportwhites() end local function exportstyled(lexer,text,numbered) - local result = lexer.lex(lexer,text,0) + local result = lexers.lex(lexer,text,0) local start = 1 local whites = exportwhites() local buffer = { } diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 5306b33b4..e81d6cc7b 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.09.26 16:48} +\newcontextversion{2021.10.08 20:05} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index c2b8528c1..a5b9cc7f1 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2021.09.26 16:48} +\immutable\edef\contextversion{2021.10.08 20:05} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/lang-ini.mkxl b/tex/context/base/mkxl/lang-ini.mkxl index 336dd5d69..2b7f34ef3 100644 --- a/tex/context/base/mkxl/lang-ini.mkxl +++ b/tex/context/base/mkxl/lang-ini.mkxl @@ -481,6 +481,9 @@ \permanent\protected\def\dohyphencollapsing{\hyphenationmode\bitwiseflip\hyphenationmode \collapsehyphenationcode} \permanent\protected\def\nohyphencollapsing{\hyphenationmode\bitwiseflip\hyphenationmode-\collapsehyphenationcode} +\permanent\protected\def\doexplicithyphens{\hyphenationmode\bitwiseflip\hyphenationmode \explicithyphenationcode} +\permanent\protected\def\noexplicithyphens{\hyphenationmode\bitwiseflip\hyphenationmode-\explicithyphenationcode} + \permanent\protected\def\usehyphensparameter#1% {\edef\p_hyphens{#1\c!hyphens}% \ifx\p_hyphens\v!no diff --git a/tex/context/base/mkxl/lpdf-ini.lmt b/tex/context/base/mkxl/lpdf-ini.lmt index ce679c08e..1ce7c5adc 100644 --- a/tex/context/base/mkxl/lpdf-ini.lmt +++ b/tex/context/base/mkxl/lpdf-ini.lmt @@ -69,7 +69,7 @@ local report_objects = logs.reporter("backend","objects") local report_finalizing = logs.reporter("backend","finalizing") local report_blocked = logs.reporter("backend","blocked") -local implement = interfaces.implement +local implement = interfaces and interfaces.implement local context = context @@ -83,7 +83,7 @@ local factor = number.dimenfactors.bp local codeinjections = { } local nodeinjections = { } -local backends = backends +local backends = backends or { } local pdfbackend = { comment = "backend for directly generating pdf output", @@ -241,8 +241,8 @@ do end end - local toregime = regimes.toregime - local fromregime = regimes.fromregime + local toregime = regimes and regimes.toregime + local fromregime = regimes and regimes.fromregime local escaped = Cs(Cc("(") * (S("\\()\n\r\t\b\f")/"\\%0" + P(1))^0 * Cc(")")) topdfdoc = function(str,default) @@ -746,6 +746,8 @@ lpdf.reference = pdfreference lpdf.verbose = pdfverbose lpdf.literal = pdfliteral +if not callbacks then return lpdf end + -- three priority levels, default=2 local pagefinalizers = { { }, { }, { } } diff --git a/tex/context/base/mkxl/lpdf-pde.lmt b/tex/context/base/mkxl/lpdf-pde.lmt index 58f5723a3..4483510d0 100644 --- a/tex/context/base/mkxl/lpdf-pde.lmt +++ b/tex/context/base/mkxl/lpdf-pde.lmt @@ -85,6 +85,7 @@ local arraytotable = pdfe.arraytotable local pagestotable = pdfe.pagestotable local readwholestream = pdfe.readwholestream local getfromreference = pdfe.getfromreference +local getfromobject = pdfe.getfromobject local report_epdf = logs.reporter("epdf") @@ -119,6 +120,8 @@ encryptioncodes = allocate(swapped(encryptioncodes,encryptioncodes) pdfe.objectcodes = objectcodes pdfe.encryptioncodes = encryptioncodes +-- lpdf_epdf.objectcodes = objectcodes + local null_object_code = objectcodes.null local reference_object_code = objectcodes.reference @@ -134,47 +137,6 @@ local dictionary_object_code = objectcodes.dictionary local stream_object_code = objectcodes.stream local reference_object_code = objectcodes.reference -local checked_access -local get_flagged -- from pdfe -> lpdf - -if lpdf.dictionary then - - -- we're in context - - local pdfdictionary = lpdf.dictionary - local pdfarray = lpdf.array - local pdfconstant = lpdf.constant - local pdfstring = lpdf.string - local pdfunicode = lpdf.unicode - - get_flagged = function(t,f,k) - local tk = t[k] -- triggers resolve - local fk = f[k] - if not fk then - return tk - elseif fk == "name" then - return pdfconstant(tk) - elseif fk == "array" then - return pdfarray(tk) - elseif fk == "dictionary" then - return pdfarray(tk) - elseif fk == "rawtext" then - return pdfstring(tk) - elseif fk == "unicode" then - return pdfunicode(tk) - else - return tk - end - end - -else - - get_flagged = function(t,f,k) - return t[k] - end - -end - -- We need to convert the string from utf16 although there is no way to -- check if we have a regular string starting with a bom. So, we have -- na dilemma here: a pdf doc encoded string can be invalid utf. @@ -196,6 +158,13 @@ local some_reference local some_string = lpdf.frombytes +function lpdf_epdf.objecttype(object) + if type(object) == "table" then + local kind = object.__type__ + return kind and objectcodes[kind] + end +end + local function get_value(document,t,key) if not key then return @@ -218,22 +187,131 @@ local function get_value(document,t,key) elseif kind == dictionary_object_code then return some_dictionary(value[2],document) elseif kind == stream_object_code then - return some_stream(value,document) + return some_stream(value,value[2],document) -- needs checking elseif kind == reference_object_code then return some_reference(value,document) end return value end +local checked_access +local get_flagged -- from pdfe -> lpdf + +if lpdf.dictionary then + + -- these are used in mtx-pdf.lua + + local pdfdictionary = lpdf.dictionary + local pdfarray = lpdf.array + local pdfconstant = lpdf.constant + local pdfreference = lpdf.reference + local pdfliteral = lpdf.literal + + local copy_array, copy_dictionary + + local function copyobject(object,key,value) + if not value then + value = object.__raw__[key] + end + local t = type(value) + if t == "string" then + return pdfconstant(value) + elseif t ~= "table" then + return value + end + local kind = value[1] + if kind == name_object_code then + return pdfconstant(value[2]) + elseif kind == string_object_code then + return pdfliteral(value[2],value[3]) + elseif kind == array_object_code then + return copyarray(object[key]) + elseif kind == dictionary_object_code then + return copydictionary(object[key]) + elseif kind == null_object_code then + return pdfnull() + elseif kind == reference_object_code then + return pdfreference(value[3]) + else + -- report("weird: %s", objecttypes[kind] or "?") + end + end + + copyarray = function(object) + local target = pdfarray() + local source = object.__raw__ + for i=1,#source do + target[i] = copyobject(object,i,source[i]) + end + return target + end + + copydictionary = function(object) + local target = pdfdictionary() + local source = object.__raw__ + for key, value in sortedhash(source) do + target[key] = copyobject(object,key,value) + end + return target + end + + get_flagged = function(t,f) + local kind = t.__type__ + if kind == name_object_code then + return pdfconstant(f) + elseif kind == array_object_code then + return copyarray(t) + elseif kind == dictionary_object_code then + return copydictionary(t) + elseif kind == stream_object_code then + return copydictionary(t) + elseif kind == string_object_code then + return pdfunicode(f) + elseif kind == null_object_code then + return pdfnull() + elseif kind == reference_object_code then + return pdfreference(t[3]) + else + return f + end + end + + function lpdf_epdf.verboseobject(document,n) + if document and n then + local object = document.objects[n] + if object then + local t = { n .. " 0 obj" } + if lpdf.epdf.objecttype(object) == "stream" then + t[#t+1] = object("dictionary")() + t[#t+1] = "stream" + t[#t+1] = tostring(object(true)) + t[#t+1] = "endstream" + else + t[#t+1] = tostring(object()) + end + t[#t+1] = "endobj" + return concat(t,"\n") + end + end + end + +else + + get_flagged = function(t,f) + return t[k] -- hm + end + +end + some_dictionary = function (d,document) local f = dictionarytotable(d,true) local t = setmetatable({ __raw__ = f, __type__ = dictionary_object_code }, { - __index = function(t,k) - return get_value(document,f,k) - end, - __call = function(t,k) - return get_flagged(t,f,k) - end, + __index = function(t,k) + return get_value(document,f,k) + end, + __call = function(t) + return get_flagged(t,f) + end, } ) return t, "dictionary" end @@ -245,8 +323,8 @@ some_array = function (a,document) __index = function(t,k) return get_value(document,f,k) end, - __call = function(t,k) - return get_flagged(t,f,k) + __call = function(t) + return get_flagged(t,f) end, __len = function(t,k) return n @@ -261,8 +339,10 @@ some_stream = function(s,d,document) __index = function(t,k) return get_value(document,f,k) end, - __call = function(t,raw) - if raw == false then + __call = function(t,how) + if how == "dictionary" then + return get_flagged(t,f) + elseif how == false then return readwholestream(s,false) -- original else return readwholestream(s,true) -- uncompressed @@ -293,6 +373,20 @@ some_reference = function(r,document) return cached end +local function some_object(document,n) + local kind, object, b, c = getfromobject(document.__data__,n) + if kind == dictionary_object_code then + return some_dictionary(object,document) + elseif kind == array_object_code then + return some_array(object,document) + elseif kind == stream_object_code then + return some_stream(object,b,document) + else + -- really cache this? + return { kind, object, b, c } + end +end + local resolvers = { } lpdf_epdf.resolvers = resolvers @@ -460,12 +554,14 @@ function lpdf_epdf.load(filename,userpassword,ownerpassword,fromstring) __data__ = false end if __data__ then + local __cache__ = { } + local __xrefs__ = { } document = { filename = filename, nofcopied = 0, copied = { }, - __cache__ = { }, - __xrefs__ = { }, + __cache__ = __cache__, + __xrefs__ = __xrefs__, __fonts__ = { }, __copied__ = { }, __data__ = __data__, @@ -479,6 +575,17 @@ function lpdf_epdf.load(filename,userpassword,ownerpassword,fromstring) document.majorversion, document.minorversion = getversion(__data__) -- document.nofpages = getnofpages(__data__) + -- we could also use cached but this proxy hides it + -- setmetatableindex(__cache__,function(t,objnum) + document.objects = setmetatableindex(function(t,objnum) + local cached = __cache__[objnum] + if not cached then + cached = some_object(document,objnum) + __cache__[objnum] = cached + __xrefs__[cached] = objnum + end + return cached + end) else document = false end @@ -1173,11 +1280,11 @@ if images then do end lpdf_epdf.image = { - open = openpdf, - close = closepdf, - new = newpdf, - query = querypdf, - copy = copypage, + open = openpdf, + close = closepdf, + new = newpdf, + query = querypdf, + copy = copypage, } -- lpdf.injectors.pdf = function(specification) diff --git a/tex/context/base/mkxl/mlib-lmp.lmt b/tex/context/base/mkxl/mlib-lmp.lmt index 5608488a3..01c72e4ba 100644 --- a/tex/context/base/mkxl/mlib-lmp.lmt +++ b/tex/context/base/mkxl/mlib-lmp.lmt @@ -403,6 +403,21 @@ do registerdirect("mode", function() injectboolean(modes [scanstring()] and true or false) end) registerdirect("systemmode", function() injectboolean(systemmodes[scanstring()] and true or false) end) + -- for compatibility reasons we keep this (metafun manual): + + local modes = tex.modes + local systemmodes = tex.systemmodes + + function mp.mode(s) + injectboolean(modes[s] and true or false) + end + + function mp.systemmode(s) + injectboolean(systemmodes[s] and true or false) + end + + mp.processingmode = mp.mode + end -- for alan's nodes: diff --git a/tex/context/base/mkxl/mlib-pdf.lmt b/tex/context/base/mkxl/mlib-pdf.lmt index ec13ef289..f537743aa 100644 --- a/tex/context/base/mkxl/mlib-pdf.lmt +++ b/tex/context/base/mkxl/mlib-pdf.lmt @@ -457,6 +457,7 @@ function metapost.flush(specification,result) local object = objects[o] if stack == object.stacking then local objecttype = object.type + -- print(i,o,stack,objecttype) if objecttype == "fill" or objecttype == "outline" then -- we use an indirect table as we want to overload -- entries but this is not possible in userdata diff --git a/tex/context/base/mkxl/page-mix.mkxl b/tex/context/base/mkxl/page-mix.mkxl index 446185e43..32af22114 100644 --- a/tex/context/base/mkxl/page-mix.mkxl +++ b/tex/context/base/mkxl/page-mix.mkxl @@ -580,6 +580,7 @@ \d_page_mix_max_width\dimexpr\d_page_mix_max_width-\leftskip-\rightskip\relax \d_page_mix_leftskip \leftskip \d_page_mix_rightskip\rightskip + % \frozen ? \leftskip \zeropoint \rightskip\zeropoint % diff --git a/tex/context/base/mkxl/spac-ali.mkxl b/tex/context/base/mkxl/spac-ali.mkxl index 3ad3dcb91..d6043b4da 100644 --- a/tex/context/base/mkxl/spac-ali.mkxl +++ b/tex/context/base/mkxl/spac-ali.mkxl @@ -718,6 +718,7 @@ \defcsname\??aligncommand\v!nothyphenated \endcsname{\toksapp\t_spac_align_collected{\nohyphens}} \defcsname\??aligncommand\v!collapsed \endcsname{\toksapp\t_spac_align_collected{\dohyphencollapsing}} \defcsname\??aligncommand\v!notcollapsed \endcsname{\toksapp\t_spac_align_collected{\nohyphencollapsing}} +\defcsname\??aligncommand\v!explicit \endcsname{\toksapp\t_spac_align_collected{\nohyphens\doexplicithyphens}} \defcsname\??aligncommand\v!tolerant \endcsname{\toksapp\t_spac_align_collected{\spac_align_set_tolerant}} \defcsname\??aligncommand\v!verytolerant \endcsname{\toksapp\t_spac_align_collected{\spac_align_set_very_tolerant}} @@ -872,7 +873,7 @@ \defcsname\??alignhorizontal\v!flushright\endcsname{\enforced\let\raggedbox\spac_align_horizontal_flushright} \defcsname\??alignhorizontal\v!center \endcsname{\enforced\let\raggedbox\spac_align_horizontal_center} -% The next one can be in use so we keep it around but oen should +% The next one can be in use so we keep it around but one should % be aware of possible interference. \permanent\protected\def\setraggedskips#1#2#3#4#5#6#7% never change this name (todo: inline this one .. less tracingall) diff --git a/tex/context/base/mkxl/strc-itm.mklx b/tex/context/base/mkxl/strc-itm.mklx index efead3d83..65df80f32 100644 --- a/tex/context/base/mkxl/strc-itm.mklx +++ b/tex/context/base/mkxl/strc-itm.mklx @@ -966,12 +966,12 @@ \let\startcollectitems\relax \let\stopcollectitems \relax -\letvalue{\??itemgroupalign\v!flushleft }\relax -\letvalue{\??itemgroupalign\v!right }\relax -\letvalue{\??itemgroupalign\v!flushright}\hfill -\letvalue{\??itemgroupalign\v!left }\hfill -\letvalue{\??itemgroupalign\v!middle }\hfil -\letvalue{\??itemgroupalign\v!center }\hfil +\letcsname\??itemgroupalign\v!flushleft \endcsname\relax +\letcsname\??itemgroupalign\v!right \endcsname\relax +\letcsname\??itemgroupalign\v!flushright\endcsname\hfill +\letcsname\??itemgroupalign\v!left \endcsname\hfill +\letcsname\??itemgroupalign\v!middle \endcsname\hfil +\letcsname\??itemgroupalign\v!center \endcsname\hfil \def\strc_itemgroups_left_sym_filler {\csname\??itemgroupalign\itemgroupparameter\c!symalign\endcsname} @@ -979,10 +979,10 @@ % symbols + states \def\strc_itemgroups_store_global_symbol#symbol% - {\letgvalue{\??itemgroupglobal\currentitemgroup:\currentitemlevel}#symbol} + {\gletcsname\??itemgroupglobal\currentitemgroup:\currentitemlevel\endcsname#symbol} \def\strc_itemgroups_store_local_symbol#symbol% - {\letgvalue{\??itemgrouplocal\currentitemgroup:\currentitemlevel}#symbol} + {\gletcsname\??itemgrouplocal\currentitemgroup:\currentitemlevel\endcsname#symbol} \def\strc_itemgroups_fetch_global_symbol {\csname\??itemgroupglobal\currentitemgroup:\currentitemlevel\endcsname} @@ -1336,13 +1336,13 @@ \protected\permanent\def\stopspecialitemgroupitem % todo: frozen {\stopitemgroupitem} -\letvalue{\??itemgroupstart\v!item}\strc_itemgroups_start_do_item -\letvalue{\??itemgroupstart\v!sub }\strc_itemgroups_start_subitem -\letvalue{\??itemgroupstart\v!sym }\strc_itemgroups_start_symbol -\letvalue{\??itemgroupstart\v!ran }\strc_itemgroups_start_edge -\letvalue{\??itemgroupstart\v!its }\strc_itemgroups_start_items -\letvalue{\??itemgroupstart\v!mar }\strc_itemgroups_start_margin -\letvalue{\??itemgroupstart\v!txt }\strc_itemgroups_start_text +\letcsname\??itemgroupstart\v!item\endcsname\strc_itemgroups_start_do_item +\letcsname\??itemgroupstart\v!sub \endcsname\strc_itemgroups_start_subitem +\letcsname\??itemgroupstart\v!sym \endcsname\strc_itemgroups_start_symbol +\letcsname\??itemgroupstart\v!ran \endcsname\strc_itemgroups_start_edge +\letcsname\??itemgroupstart\v!its \endcsname\strc_itemgroups_start_items +\letcsname\??itemgroupstart\v!mar \endcsname\strc_itemgroups_start_margin +\letcsname\??itemgroupstart\v!txt \endcsname\strc_itemgroups_start_text \def\strc_itemgroups_optimize_breaks {\ifcase\c_strc_itemgroups_column_depth diff --git a/tex/context/base/mkxl/strc-mar.mkxl b/tex/context/base/mkxl/strc-mar.mkxl index 9067b4924..fcce83173 100644 --- a/tex/context/base/mkxl/strc-mar.mkxl +++ b/tex/context/base/mkxl/strc-mar.mkxl @@ -93,14 +93,20 @@ {} \tolerant\def\strc_markings_get_yes[#1]#*[#2]#*[#3]% - {\ifcstok{\namedmarkingparameter{#1}\c!state}\v!start + {\ifarguments\orelse\ifcstok{\namedmarkingparameter{#1}\c!state}\v!start \begingroup \setsystemmode\v!marking \the\everymarking \ifparameter#3\or - \clf_getmarking{#1}{#2}{#3}% + \ifcstok{#2}\v!page + \markingcommand{#1}{\csname\??markingfilter#3\endcsname{#1}}% + \else + \markingcommand{#1}{\clf_getsynchronizedmarking\begincsname\??markingclass#1\endcsname{#2}{#3}}% + \fi + \orelse\ifparameter#2\or + \markingcommand{#1}{\csname\??markingfilter#2\endcsname{#1}}% \else - \clf_getmarking{#1}{\v!page}{#2}% + \markingcommand{#1}{\csname\??markingfilter\v!default\endcsname{#1}}% \fi \endgroup \fi} diff --git a/tex/context/base/mkxl/strc-not.lmt b/tex/context/base/mkxl/strc-not.lmt index df3b00d78..e05228b2b 100644 --- a/tex/context/base/mkxl/strc-not.lmt +++ b/tex/context/base/mkxl/strc-not.lmt @@ -509,9 +509,9 @@ local function check_spacing(index,slot) local pt = pn + pi local mt = mn + mi if trace_insert then - report_insert("%s %i: %p plus %p minus %p","always ",n,gn,pn,mn) - report_insert("%s %i: %p plus %p minus %p",i > 1 and "inbetween" or "before ",n,gi,pi,mi) - report_insert("%s %i: %p plus %p minus %p","effective",n,gt,pt,mt) + report_insert("%s %i: %p plus %p minus %p","always ",index,gn,pn,mn) + report_insert("%s %i: %p plus %p minus %p",slot > 1 and "inbetween" or "before ",index,gi,pi,mi) + report_insert("%s %i: %p plus %p minus %p","effective",index,gt,pt,mt) end return gt, pt, mt end diff --git a/tex/context/base/mkxl/typo-drp.lmt b/tex/context/base/mkxl/typo-drp.lmt index de65dd55d..c62b5e718 100644 --- a/tex/context/base/mkxl/typo-drp.lmt +++ b/tex/context/base/mkxl/typo-drp.lmt @@ -73,6 +73,7 @@ local v_default = variables.default local v_margin = variables.margin local v_auto = variables.auto local v_first = variables.first +local v_keep = variables.keep local v_last = variables.last local texget = tex.get @@ -130,6 +131,7 @@ interfaces.implement { -- a page so this has a low priority actions[v_default] = function(head,setting) + local skip = false -- begin of par local first = getnext(head) local indent = false @@ -193,6 +195,9 @@ actions[v_default] = function(head,setting) else -- keep quote etc with initial local next = getnext(first) + if next and method[v_keep] then + skip = first + end if not next then -- don't start with a quote or so return head @@ -242,7 +247,7 @@ actions[v_default] = function(head,setting) local id = getid(current) if id == kern_code then setkern(current,0) - elseif id == glyph_code then + elseif id == glyph_code and skip ~= current then local next = getnext(current) if font then setfont(current,font) @@ -289,7 +294,11 @@ actions[v_default] = function(head,setting) -- local hoffset = width + hoffset + distance + (indent and parindent or 0) for current in nextglyph, first do - setoffsets(current,-hoffset,-voffset) -- no longer - height here + if skip == current then + setoffsets(current,-hoffset,0) + else + setoffsets(current,-hoffset,-voffset) -- no longer - height here + end if current == last then break end |