diff options
Diffstat (limited to 'tex')
23 files changed, 748 insertions, 179 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 876eacdfc..801541637 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.12.03 15:17} +\newcontextversion{2021.12.10 11:29} %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 48af7f8e3..2aa9cee0d 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.12.03 15:17} +\edef\contextversion{2021.12.10 11:29} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-de.mkii b/tex/context/base/mkii/mult-de.mkii index 60671069c..43a265056 100644 --- a/tex/context/base/mkii/mult-de.mkii +++ b/tex/context/base/mkii/mult-de.mkii @@ -79,6 +79,7 @@ \setinterfacevariable{anchor}{anchor} \setinterfacevariable{and}{und} \setinterfacevariable{answerarea}{answerarea} +\setinterfacevariable{append}{append} \setinterfacevariable{appendices}{anhaenge} \setinterfacevariable{appendix}{anhang} \setinterfacevariable{april}{april} @@ -150,6 +151,7 @@ \setinterfacevariable{commands}{befehle} \setinterfacevariable{comment}{kommentar} \setinterfacevariable{component}{komponente} +\setinterfacevariable{compress}{compress} \setinterfacevariable{compressseparator}{compressseparator} \setinterfacevariable{compressstopper}{compressstopper} \setinterfacevariable{concept}{konzept} @@ -186,6 +188,7 @@ \setinterfacevariable{enumeration}{nummerierung} \setinterfacevariable{environment}{umgebung} \setinterfacevariable{even}{gerade} +\setinterfacevariable{explicit}{explicit} \setinterfacevariable{export}{export} \setinterfacevariable{external}{extern} \setinterfacevariable{extremestretch}{extremestretch} @@ -207,6 +210,8 @@ \setinterfacevariable{fixed}{fest} \setinterfacevariable{flexible}{flexibel} \setinterfacevariable{float}{gleitobjekt} +\setinterfacevariable{flushbackward}{flushbackward} +\setinterfacevariable{flushforward}{flushforward} \setinterfacevariable{flushinner}{flushinner} \setinterfacevariable{flushleft}{flushleft} \setinterfacevariable{flushouter}{flushouter} @@ -310,6 +315,7 @@ \setinterfacevariable{lefthanging}{lefthanging} \setinterfacevariable{leftmargin}{linkerrand} \setinterfacevariable{leftpage}{linkerseite} +\setinterfacevariable{lefttext}{linkertext} \setinterfacevariable{lefttoright}{lefttoright} \setinterfacevariable{legend}{legende} \setinterfacevariable{less}{less} @@ -434,6 +440,7 @@ \setinterfacevariable{postscript}{postscript} \setinterfacevariable{precedingpage}{precedingpage} \setinterfacevariable{preference}{einstellung} +\setinterfacevariable{prepend}{prepend} \setinterfacevariable{preview}{vorschau} \setinterfacevariable{previous}{vorig} \setinterfacevariable{previousevenpage}{vorigegeradeseite} @@ -470,6 +477,7 @@ \setinterfacevariable{righthanging}{righthanging} \setinterfacevariable{rightmargin}{rechterrand} \setinterfacevariable{rightpage}{rechterseite} +\setinterfacevariable{righttext}{rechtertext} \setinterfacevariable{righttoleft}{righttoleft} \setinterfacevariable{roman}{antiqua} \setinterfacevariable{romannumerals}{roemischezahlen} @@ -1236,6 +1244,7 @@ \setinterfaceconstant{splitoffset}{splitoffset} \setinterfaceconstant{spot}{spot} \setinterfaceconstant{stack}{stack} +\setinterfaceconstant{stacking}{stacking} \setinterfaceconstant{stackname}{stackname} \setinterfaceconstant{start}{start} \setinterfaceconstant{starter}{starter} @@ -1273,6 +1282,7 @@ \setinterfaceconstant{tab}{tab} \setinterfaceconstant{text}{text} \setinterfaceconstant{textalign}{textalign} +\setinterfaceconstant{textalternative}{textalternative} \setinterfaceconstant{textcolor}{textfarbe} \setinterfaceconstant{textcommand}{textbefehl} \setinterfaceconstant{textdistance}{textdistance} @@ -1364,6 +1374,8 @@ \setinterfaceelement{load}{laden} \setinterfaceelement{local}{lokal} \setinterfaceelement{makeup}{umbruch} +\setinterfaceelement{namednotation}{namednotation} +\setinterfaceelement{namedtyping}{namedtyping} \setinterfaceelement{next}{folgende} \setinterfaceelement{place}{platziere} \setinterfaceelement{previous}{vorige} @@ -1532,6 +1544,7 @@ \setinterfacecommand{definereferencelist}{definierereferenzliste} \setinterfacecommand{defineregister}{definiereregister} \setinterfacecommand{definerule}{definerule} +\setinterfacecommand{definesavebuffer}{startsavebuffer} \setinterfacecommand{definesection}{definiereabschnitt} \setinterfacecommand{definesectionblock}{definiereabschnittsblock} \setinterfacecommand{definesorting}{definieresortieren} @@ -1708,6 +1721,9 @@ \setinterfacecommand{moveformula}{moveformula} \setinterfacecommand{moveongrid}{amgitterneuausrichten} \setinterfacecommand{movesidefloat}{movesidefloat} +\setinterfacecommand{namedconstruction}{namedconstruction} +\setinterfacecommand{nameddescription}{nameddescription} +\setinterfacecommand{namedenumeration}{namedenumeration} \setinterfacecommand{navigating}{navigating} \setinterfacecommand{nodimension}{keindimension} \setinterfacecommand{noheaderandfooterlines}{keinekopfundfusszeilen} @@ -2079,6 +2095,13 @@ \setinterfacecommand{startmakeup}{startumbruch} \setinterfacecommand{startmarginblock}{startmarginalblock} \setinterfacecommand{startmarginrule}{startmarginallinie} +\setinterfacecommand{startnamedconstruction}{startnamedconstruction} +\setinterfacecommand{startnameddescription}{startnameddescription} +\setinterfacecommand{startnamedenumeration}{startnamedenumeration} +\setinterfacecommand{startnamedmatrix}{startnamedmatrix} +\setinterfacecommand{startnamedsection}{startnamedsection} +\setinterfacecommand{startnamedsubformulas}{startnamedsubformulas} +\setinterfacecommand{startnamedtyping}{startnamedtyping} \setinterfacecommand{startnarrower}{startenger} \setinterfacecommand{startopposite}{startgegenueber} \setinterfacecommand{startoverlay}{startoverlay} @@ -2122,6 +2145,13 @@ \setinterfacecommand{stopmakeup}{stopumbruch} \setinterfacecommand{stopmarginblock}{stopmarginalblock} \setinterfacecommand{stopmarginrule}{stopmarginallinie} +\setinterfacecommand{stopnamedconstruction}{stopnamedconstruction} +\setinterfacecommand{stopnameddescription}{stopnameddescription} +\setinterfacecommand{stopnamedenumeration}{stopnamedenumeration} +\setinterfacecommand{stopnamedmatrix}{stopnamedmatrix} +\setinterfacecommand{stopnamedsection}{stopnamedsection} +\setinterfacecommand{stopnamedsubformulas}{stopnamedsubformulas} +\setinterfacecommand{stopnamedtyping}{stopnamedtyping} \setinterfacecommand{stopnarrower}{stopenger} \setinterfacecommand{stopopposite}{stopgegenueber} \setinterfacecommand{stopoverlay}{stopoverlay} diff --git a/tex/context/base/mkiv/char-def.lua b/tex/context/base/mkiv/char-def.lua index c8dac09c5..5ed2f0198 100644 --- a/tex/context/base/mkiv/char-def.lua +++ b/tex/context/base/mkiv/char-def.lua @@ -2449,7 +2449,7 @@ characters.data={ linebreak="al", shcode={ 0x73, 0x73 }, synonyms={ "eszett" }, - uccode={ 0x73, 0x73 }, + uccode={ 0x53, 0x53 }, unicodeslot=0xDF, }, { diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 92172d354..1b143ffb7 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.12.03 15:17} +\newcontextversion{2021.12.10 11:29} %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 fa300cafd..7c32ed6d8 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -49,7 +49,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.12.03 15:17} +\edef\contextversion{2021.12.10 11:29} %D Kind of special: diff --git a/tex/context/base/mkiv/libs-ini.lua b/tex/context/base/mkiv/libs-ini.lua index d3cfe634f..cf696f4e9 100644 --- a/tex/context/base/mkiv/libs-ini.lua +++ b/tex/context/base/mkiv/libs-ini.lua @@ -17,7 +17,6 @@ local find = string.find -- here we implement the resolver - local nameonly = file.nameonly local joinfile = file.join local addsuffix = file.addsuffix diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 41707d50a..a7f20d3e8 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 40471b66f..43b1fbf13 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkxl/back-imp-pdf.mkxl b/tex/context/base/mkxl/back-imp-pdf.mkxl index a9cffc6cb..f2afe61da 100644 --- a/tex/context/base/mkxl/back-imp-pdf.mkxl +++ b/tex/context/base/mkxl/back-imp-pdf.mkxl @@ -91,7 +91,7 @@ %D as one can best stick to the defaults that also adapt to specific standards. \untraced\permanent\protected\def\nopdfcompression {\clf_setpdfcompression\zerocount\zerocount} -\untraced\permanent\protected\def\onlypdfobjectcompression{\clf_setpdfcompression\zerocount\plusthree} +\untraced\permanent\protected\def\onlypdfobjectcompression{\clf_setpdfcompression\plusthree\zerocount} \untraced\permanent\protected\def\maximumpdfcompression {\clf_setpdfcompression\plusnine \plusnine } \untraced\permanent\protected\def\normalpdfcompression {\clf_setpdfcompression\plusthree\plusthree} diff --git a/tex/context/base/mkxl/back-imp-pdp.lmt b/tex/context/base/mkxl/back-imp-pdp.lmt index c7acc82a8..4c5d61b22 100644 --- a/tex/context/base/mkxl/back-imp-pdp.lmt +++ b/tex/context/base/mkxl/back-imp-pdp.lmt @@ -33,7 +33,7 @@ local cardinal_value = values.cardinal local immediate_code = tex.flagcodes.immediate -local trace = false trackers.register("backend", function(v) trace = v end) +local trace = false trackers.register("backend.primitives", function(v) trace = v end) local report = logs.reporter("backend") local nodepool = nodes.pool @@ -213,7 +213,7 @@ local extensions = { } local function pdf_extension() - local w = scanword() + local w = scanword(false) if w then local e = extensions[w] if e then @@ -234,11 +234,11 @@ local feedbacks = { } local function pdf_feedback() - local w = scanword() + local w = scanword(false) if w then local f = feedbacks[w] if f then - f() + return f() else report("\\pdffeedback: unsupported %a",w) end @@ -259,7 +259,7 @@ local variables = { } local function pdf_variable() - local w = scanword() + local w = scanword(false) if w then local f = variables[w] if f then @@ -274,8 +274,8 @@ end -- kept (also because tikz needs including the pdftex primitives): -implement { name = "pdfextension", actions = pdf_extension, public = true, untraced = true, protected = true } -implement { name = "pdffeedback", actions = pdf_feedback, public = true, untraced = true } -- expandable / todo : value +implement { name = "pdfextension", actions = pdf_extension, public = true, untraced = true } -- , protected = true } +implement { name = "pdffeedback", actions = pdf_feedback, public = true, usage = "value", untraced = true } -- expandable / todo : value implement { name = "pdfvariable", actions = pdf_variable, public = true, untraced = true } -- expandable / todo : value implement { name = "pdfliteral", actions = pdf_literal, public = true, untraced = true, protected = true } implement { name = "pdfobj", actions = pdf_obj, public = true, usage = "value", protected = true } diff --git a/tex/context/base/mkxl/back-ini.lmt b/tex/context/base/mkxl/back-ini.lmt index fc91fb31c..110a1b3dc 100644 --- a/tex/context/base/mkxl/back-ini.lmt +++ b/tex/context/base/mkxl/back-ini.lmt @@ -139,3 +139,9 @@ backends.included = included function backends.getcallbackstate() return { count = status.late_callbacks or 0 } end + +-- + +function backends.setencryption(specification) + codeinjections.setencryption(specification) +end diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 95430abf6..bd8833c4e 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.12.03 15:17} +\newcontextversion{2021.12.10 11:29} %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 914f4bfd9..81310b47a 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.12.03 15:17} +\immutable\edef\contextversion{2021.12.10 11:29} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error @@ -398,7 +398,7 @@ \loadmkxlfile{tabl-tab} % thrd-tab stripped and merged \loadmkxlfile{tabl-tbl} -\loadmkxlfile{tabl-ntb} +\doiffileelse{tabl-ntb-new.mkxl}{\loadmkxlfile{tabl-ntb-new}}{\loadmkxlfile{tabl-ntb}} \loadmkxlfile{tabl-nte} \loadmkxlfile{tabl-ltb} \loadmkxlfile{tabl-frm} diff --git a/tex/context/base/mkxl/lpdf-ini.lmt b/tex/context/base/mkxl/lpdf-ini.lmt index 6bee9e17b..9357ebe75 100644 --- a/tex/context/base/mkxl/lpdf-ini.lmt +++ b/tex/context/base/mkxl/lpdf-ini.lmt @@ -57,7 +57,7 @@ if not modules then modules = { } end modules ['lpdf-ini'] = { local setmetatable, getmetatable, type, next, tostring, tonumber, rawset = setmetatable, getmetatable, type, next, tostring, tonumber, rawset local concat = table.concat -local char, byte, format, sub = string.char, string.byte, string.format, string.sub +local char, byte, format, sub, tohex = string.char, string.byte, string.format, string.sub, string.tohex local utfchar, utfbyte, utfvalues = utf.char, utf.byte, utf.values local sind, cosd, max, min = math.sind, math.cosd, math.max, math.min local sort, sortedhash = table.sort, table.sortedhash @@ -71,7 +71,6 @@ local report_finalizing = logs.reporter("backend","finalizing") local report_blocked = logs.reporter("backend","blocked") local implement = interfaces and interfaces.implement - local context = context -- In ConTeXt MkIV we use utf8 exclusively so all strings get mapped onto a hex @@ -81,7 +80,7 @@ local context = context pdf = type(pdf) == "table" and pdf or { } local factor = number.dimenfactors.bp -local pdfbackend = backends.registered.pdf +local pdfbackend = backends and backends.registered.pdf or { } local codeinjections = pdfbackend.codeinjections local nodeinjections = pdfbackend.nodeinjections @@ -224,6 +223,8 @@ do end end + -- we could make a helper for this + local more = 0 local pattern = C(4) / function(s) -- needs checking ! @@ -1167,7 +1168,7 @@ end -- return formatters["BT /Span << /ActualText (CONTEXT) >> BDC [<feff>] TJ % t EMC ET"](code) -do +if implement then local f_actual_text_p = formatters["BT /Span << /ActualText <feff%s> >> BDC %s EMC ET"] local f_actual_text_b = formatters["BT /Span << /ActualText <feff%s> >> BDC"] @@ -1232,17 +1233,21 @@ end -- Bah, tikz uses \immediate for some reason which is probably a bug, so the usage -- will deal with that. However, we will not provide the serialization. -implement { name = "pdfbackendcurrentresources", public = true, untraced = true, actions = { lpdf.collectedresources, context } } -implement { name = "pdfbackendsetcatalog", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = lpdf.addtocatalog } -implement { name = "pdfbackendsetinfo", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = function(a,b,c) lpdf.addtoinfo(a,b,c) end } -- gets adapted -implement { name = "pdfbackendsetname", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = lpdf.addtonames } -implement { name = "pdfbackendsetpageattribute", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = lpdf.addtopageattributes } -implement { name = "pdfbackendsetpagesattribute", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = lpdf.addtopagesattributes } -implement { name = "pdfbackendsetpageresource", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = lpdf.addtopageresources } -implement { name = "pdfbackendsetextgstate", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = function(a,b) lpdf.adddocumentextgstate (a,pdfverbose(b)) end } -implement { name = "pdfbackendsetcolorspace", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = function(a,b) lpdf.adddocumentcolorspace(a,pdfverbose(b)) end } -implement { name = "pdfbackendsetpattern", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = function(a,b) lpdf.adddocumentpattern (a,pdfverbose(b)) end } -implement { name = "pdfbackendsetshade", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = function(a,b) lpdf.adddocumentshade (a,pdfverbose(b)) end } +if implement then + + implement { name = "pdfbackendcurrentresources", public = true, untraced = true, actions = { lpdf.collectedresources, context } } + implement { name = "pdfbackendsetcatalog", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = lpdf.addtocatalog } + implement { name = "pdfbackendsetinfo", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = function(a,b,c) lpdf.addtoinfo(a,b,c) end } -- gets adapted + implement { name = "pdfbackendsetname", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = lpdf.addtonames } + implement { name = "pdfbackendsetpageattribute", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = lpdf.addtopageattributes } + implement { name = "pdfbackendsetpagesattribute", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = lpdf.addtopagesattributes } + implement { name = "pdfbackendsetpageresource", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = lpdf.addtopageresources } + implement { name = "pdfbackendsetextgstate", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = function(a,b) lpdf.adddocumentextgstate (a,pdfverbose(b)) end } + implement { name = "pdfbackendsetcolorspace", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = function(a,b) lpdf.adddocumentcolorspace(a,pdfverbose(b)) end } + implement { name = "pdfbackendsetpattern", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = function(a,b) lpdf.adddocumentpattern (a,pdfverbose(b)) end } + implement { name = "pdfbackendsetshade", usage = "value", public = true, protected = true, arguments = "2 arguments", actions = function(a,b) lpdf.adddocumentshade (a,pdfverbose(b)) end } + +end -- more helpers: copy from lepd to lpdf diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt index 61eac9517..321dea935 100644 --- a/tex/context/base/mkxl/lpdf-lmt.lmt +++ b/tex/context/base/mkxl/lpdf-lmt.lmt @@ -65,33 +65,34 @@ local pdfimmediateobject -- forward reference local pdfincludeimage -- forward reference -local pdf_pages = pdfconstant("Pages") -local pdf_page = pdfconstant("Page") -local pdf_xobject = pdfconstant("XObject") -local pdf_form = pdfconstant("Form") -local pdf_pattern = pdfconstant("Pattern") - -local fonthashes = fonts.hashes -local characters = fonthashes.characters -local descriptions = fonthashes.descriptions -local parameters = fonthashes.parameters -local properties = fonthashes.properties - -local report = logs.reporter("backend") -local report_objects = logs.reporter("backend","objects") -local report_fonts = logs.reporter("backend","fonts") - -local trace_objects = false trackers.register("backend.objects", function(v) trace_objects = v end) -local trace_details = false trackers.register("backend.details", function(v) trace_details = v end) -local trace_indices = false trackers.register("backend.fonts.details", function(v) trace_indices = v end) +local pdf_pages = pdfconstant("Pages") +local pdf_page = pdfconstant("Page") +local pdf_xobject = pdfconstant("XObject") +local pdf_form = pdfconstant("Form") +local pdf_pattern = pdfconstant("Pattern") + +local fonthashes = fonts.hashes +local characters = fonthashes.characters +local descriptions = fonthashes.descriptions +local parameters = fonthashes.parameters +local properties = fonthashes.properties + +local report = logs.reporter("backend") +local report_objects = logs.reporter("backend","objects") +local report_fonts = logs.reporter("backend","fonts") +local report_encryption = logs.reporter("backend","encryption") + +local trace_objects = false trackers.register("backend.objects", function(v) trace_objects = v end) +local trace_details = false trackers.register("backend.details", function(v) trace_details = v end) +local trace_indices = false trackers.register("backend.fonts.details", function(v) trace_indices = v end) -- These two tables used a font id as index and will be metatabled in lpdf-emb.lmt: -local usedfontnames = { } -local usedfontobjects = { } +local usedfontnames = { } +local usedfontobjects = { } -lpdf.usedfontnames = usedfontnames -lpdf.usedfontobjects = usedfontobjects +lpdf.usedfontnames = usedfontnames +lpdf.usedfontobjects = usedfontobjects -- experiment: @@ -116,7 +117,9 @@ local flushers = { } -- used variables -local pdf_h, pdf_v +local pdf_h = 0 +local pdf_v = 0 + local need_tm, need_tf, need_font, cur_tmrx, cur_factor local need_width, need_mode, done_width, done_mode local mode @@ -502,38 +505,6 @@ do return v end) - -- we need to use descriptions ... otherwise we get wrong dimensions when we use - -- characters[n].xoffset or virtual stuff - - -- local descriptionwidths = setmetatableindex(function(t,font) - -- local d = descriptions[font] - -- local c = characters[font] - -- local f = parameters[font].hfactor or parameters[font].factor - -- local v = setmetatableindex(function(t,char) - -- local w - -- local e = d and d[char] - -- if e then - -- w = e.width - -- if w then - -- w = w * f - -- end - -- end - -- if not w then - -- e = c and c[char] - -- if e then - -- w = e.width or 0 - -- end - -- end - -- if not w then - -- w = 0 - -- end - -- t[char] = w - -- return w - -- end) - -- t[font] = v - -- return v - -- end) - -- it's about time to get rid of the pdftex based model but i'll wait with that till after -- the first release so that we have some test period ... when we go compact even less @@ -1718,13 +1689,10 @@ local wrapupdocument, registerpage do pdfflushobject(page.objnum,object) end lpdf.addtocatalog("Pages",pdfreference(parent)) - end end -pdf_h, pdf_v = 0, 0 - local function initialize(driver,details) reset_variables(details) reset_buffer() @@ -1735,7 +1703,309 @@ end -- todo: more clever resource management: a bit tricky as we can inject -- stuff in the page stream -local compact = false +local compact = false +local encryptstream = false +local encryptobject = false +local encdict = nil +local majorversion = 1 +local minorversion = 7 + +-- Encryption + +-- This stuff is poorly documented so it took a while to figure out a way that made +-- loading in a few programe working. Of course one you see the solution one can +-- claim that it's easy and trivial. In the end we could even make acrobat accepting +-- the file: it doesn't like the catalog to be in an object stream which to me +-- smells like a bug. + +do + + -- move up (some already) or better: lpdf-aes.lmt or so + + local byte, sub, bytes, tohex, tobytes = string.byte, string.sub, string.bytes, string.tohex, string.tobytes + local P, S, V, Cs, lpegmatch, patterns = lpeg.P, lpeg.S, lpeg.V, lpeg.Cs, lpeg.match, lpeg.patterns + + local digest256 = sha2.digest256 + local digest384 = sha2.digest384 + local digest512 = sha2.digest512 + + local aesencode = aes.encode + local aesdecode = aes.decode + local aesrandom = aes.random + + -- random and padding functions are gone here + + local function validpassword(str) + return #str > 127 and sub(str,1,127) or str + end + + local encryptionkey = false + local objectparser = false + + do + + local function ps_encrypt(str) + -- string is already unescaped + str = aesencode(str,encryptionkey,true,true,true) + return "<" .. tohex(str) .. ">" + end + + local function hex_encrypt(str) + -- string needs to be decoded + str = tobytes(str) + str = aesencode(str,encryptionkey,true,true,true) + return "<" .. tohex(str) .. ">" + end + + local whitespace = S("\000\009\010\012\013\032")^1 + local anything = patterns.anything + local space = patterns.space + local spacing = whitespace^0 + local newline = patterns.eol + local cardinal = patterns.cardinal + + local p_psstring = ( + P("(") + * Cs(P { ( P("\\")/"" * anything + P("(") * V(1) * P(")") + (1 - P(")")) )^0 }) + * P(")") + ) / ps_encrypt + + local p_hexstring = ( + P("<") + * Cs((1-P(">"))^1) + * P(">") + ) / hex_encrypt + + local p_comment = P("%") * (1-newline)^1 * newline^1 + local p_name = P("/") * (1 - whitespace - S("<>/[]()"))^1 + local p_number = patterns.number + local p_boolean = P("true") + P("false") + local p_null = P("null") + local p_reference = cardinal * spacing * cardinal * spacing * P("R") + + local p_other = p_name + p_reference + p_psstring + p_hexstring + p_number + + p_boolean + p_null + p_comment + + local p_dictionary = { "dictionary", + dictionary = ( + P("<<") + * (spacing * p_name * spacing * V("whatever"))^0 + * spacing + * P(">>") + ), + array = ( + P("[") + * (spacing * V("whatever"))^0 + * spacing + * P("]") + ), + whatever = ( + V("dictionary") + + V("array") + + p_other + ), + } + + local p_object = P { "object", + dictionary = p_dictionary.dictionary, + array = p_dictionary.array, + whatever = p_dictionary.whatever, + object = spacing * (V("dictionary") + V("array") + p_other) + } + + -- local p_object = cardinal + -- * spacing + -- * cardinal + -- * spacing + -- * P("obj") + -- * p_object + -- * P(1)^0 + -- + -- objectparser = Cs(p_object^1) + + objectparser = Cs(p_object^1) + + end + + local function makehash(password,salt,userkey) + local k = digest256(password .. salt .. (userkey or "")) + local n = 0 + while true do + local k1 = rep(password .. k .. (userkey or ""),64) + local k2 = sub(k,1,16) + local iv = sub(k,17,32) + local e = aesencode(k1,k2,iv) + local m = 0 + local i = 1 + for b in bytes(e) do + m = m + b + if i == 16 then + break + else + i = i + 1 + end + end + m = m % 3 + if m == 0 then + k = digest256(e) + elseif m == 1 then + k = digest384(e) + else + k = digest512(e) + end + n = n + 1 + if n >= 64 and byte(sub(e,-1)) <= (n - 32) then + break + end + end + return sub(k,1,32) + end + + local options = { + -- unknown = 0x0001, -- bit 1 + -- unknown = 0x0002, -- bit 2 + print = 0x0004, -- bit 3 + modify = 0x0008, -- bit 4 + extract = 0x0010, -- bit 5 + add = 0x0020, -- bit 6 + -- unknown = 0x0040, -- bit 7 + -- unknown = 0x0080, -- bit 8 + fillin = 0x0100, -- bit 9 + access = 0x0200, -- bit 10 + assemble = 0x0400, -- bit 11 + quality = 0x0800, -- bit 12 + -- unknown = 0x1000, -- bit 13 + -- unknown = 0x2000, -- bit 14 + -- unknown = 0x4000, -- bit 15 + -- unknown = 0x8000, -- bit 16 + } + + -- 1111 0000 1100 0011 + + local mandate = 0x0200 + local defaults = options.print | options.extract | options.quality + + -- majorversion = 2 + -- minorversion = 0 + + function lpdf.setencryption(specification) + if not encryptstream then + local ownerpassword = specification.ownerpassword + local userpassword = specification.userpassword + local optionlist = specification.permissions + if type(ownerpassword) == "string" and ownerpassword ~= "" then + -- + if type(userpassword) ~= "string" then + userpassword = "" + end + userpassword = validpassword(userpassword) + ownerpassword = validpassword(ownerpassword) + -- + encryptionkey = aesrandom(32) -- used earlier on + -- + local permissions = mandate + if optionlist then + optionlist = utilities.parsers.settings_to_array(optionlist) + for i=1,#optionlist do + local p = options[optionlist[i]] + if p then + permissions = permissions | p + end + end + else + permissions = permissions | defaults + end + -- + permissions = permissions | 0xF0C3 -- needs work + -- + optionlist = { } + for k, v in table.sortedhash(options) do + if permissions & v == v then + optionlist[#optionlist+1] = k + end + end + -- + local uservalidationsalt = aesrandom(8) + local userkeysalt = aesrandom(8) + local userhash = makehash(userpassword,uservalidationsalt) + local userkey = userhash .. uservalidationsalt .. userkeysalt -- U + local userintermediate = makehash(userpassword,userkeysalt) + local useraes = aesencode(encryptionkey,userintermediate) -- UE + -- + local ownervalidationsalt = aesrandom(8) + local ownerkeysalt = aesrandom(8) + local ownerhash = makehash(ownerpassword,ownervalidationsalt,userkey) + local ownerkey = ownerhash .. ownervalidationsalt .. ownerkeysalt -- O + local ownerintermediate = makehash(ownerpassword,ownerkeysalt,userkey) + local owneraes = aesencode(encryptionkey,ownerintermediate) -- OE + -- + -- still not ok test in qpdf + -- + local permissionsstring = sio.tocardinal4(0xFFFFFFFF) + .. sio.tocardinal4(permissions) + .. "T" -- EncryptMetadata + .. "adb" + .. aesrandom(4) + local permissionsaes = aesencode(permissionsstring,encryptionkey) + -- + permissionsaes = tohex(permissionsaes) + userkey = tohex(userkey) + ownerkey = tohex(ownerkey) + useraes = tohex(useraes) + owneraes = tohex(owneraes) + -- + encdict = pdfdictionary { + Filter = pdfconstant("Standard"), + V = 5, -- variant + R = 6, -- revision + Length = 256, -- not needed + StmF = pdfconstant("StdCF"), + StrF = pdfconstant("StdCF"), + P = permissions, + Perms = pdfliteral(permissionsaes,true), -- #16 + U = pdfliteral(userkey, true), -- #48 + O = pdfliteral(ownerkey, true), -- #48 + UE = pdfliteral(useraes, true), -- #32 + OE = pdfliteral(owneraes, true), -- #32 + CF = { + StdCF = { + AuthEvent = pdfconstant("DocOpen"), + CFM = pdfconstant("AESV3"), + Length = 32, -- #encryptionkey + } + }, + -- bonus + EncryptMetadata = true, + } + -- + encryptstream = function(str) + return aesencode(str,encryptionkey,true,true,true) -- random-iv add-iv add-padding + end + encryptobject = function(obj) + if obj then + if type(obj) == "table" then + obj = obj() + end + return lpegmatch(objectparser,obj) or obj + end + end + -- + report_encryption("stream objects get encrypted") + if not objectstream then + report_encryption("strings are not encrypted, enable object streams") + end + report_encryption("permissions: % t",optionlist) + if userpassword == "" then + report_encryption("no user password") + end + -- + end + end + end + + backends.registered.pdf.codeinjections.setencryption = lpdf.setencryption + +end do @@ -1791,7 +2061,6 @@ do end end) - end local flushdeferred -- defined later @@ -2003,8 +2272,6 @@ local cache = false local info = "" local catalog = "" local lastdeferred = false -local majorversion = 1 -local minorversion = 7 directives.register("backend.pdf.threshold",function(v) if v then @@ -2142,13 +2409,17 @@ local addtocache, flushcache, cache do else fb = f_stream_b_d_u end - local s = #data - local b = fb(cache,strobj(),s) + local size = #data + if encryptstream then + data = encryptstream(data) + size = #data + end + local b = fb(cache,strobj(),size) local e = s_stream_e flush(f,b) flush(f,data) flush(f,e) - offset = offset + #b + s + #e + offset = offset + #b + size + #e data, d = { }, 0 list, l = { }, 0 coffset = 0 @@ -2257,6 +2528,7 @@ do nolength = true -- data = string.formatters["<< %s >>stream\n%s\nendstream"](attr,data) end + return pdfdeferredobject { objnum = objnum, immediate = true, @@ -2342,6 +2614,9 @@ local function flushnormalobj(data,n) nofobjects = nofobjects + 1 n = nofobjects end + if encryptobject then + data = encryptobject(data) + end data = f_object(n,data) if level == 0 then objects[n] = offset @@ -2371,12 +2646,21 @@ local function flushstreamobj(data,n,dict,comp,nolength) if comp ~= false then comp = compress and size > threshold end + if encryptobject then + dict = encryptobject(dict) + end if level == 0 then local b = nil local e = s_stream_e if nolength then + -- probleem: we need to adapt length! b = f_stream_b_d_r(n,dict) -- raw object, already treated - else + if encryptstream then +print("check length") + data = encryptstream(data) + size = #data + end + else if comp then local compdata = compressdata(data,size) if compdata then @@ -2391,6 +2675,10 @@ local function flushstreamobj(data,n,dict,comp,nolength) comp = false end end + if encryptstream then + data = encryptstream(data) + size = #data + end if comp then b = dict and f_stream_b_d_c(n,dict,size) or f_stream_b_n_c(n,size) else @@ -2404,6 +2692,10 @@ local function flushstreamobj(data,n,dict,comp,nolength) offset = offset + #b + size + #e else if nolength then + if encryptstream then +print("check length") + data = encryptstream(data) + end data = f_stream_d_r(n,dict,data) -- raw object, already treated else if comp then @@ -2420,6 +2712,10 @@ local function flushstreamobj(data,n,dict,comp,nolength) comp = false end end + if encryptstream then + data = encryptstream(data) + size = #data + end if comp then data = dict and f_stream_d_c(n,dict,size,data) or f_stream_n_c(n,size,data) else @@ -2555,10 +2851,17 @@ local openfile, closefile do -- local banner <const> = "%\xCC\xD5\xC1\xD4\xC5\xD8\xD0\xC4\xC6\010" -- LUATEXPDF (+128) local banner <const> = "%\xC3\xCF\xCE\xD4\xC5\xD8\xD4\xD0\xC4\xC6\010" -- CONTEXTPDF (+128) - - -- local removefile = os.remove - openfile = function(filename) + -- + local arguments = environment.arguments + if arguments.ownerpassword then + lpdf.setencryption { + ownerpassword = arguments.ownerpassword, + userpassword = arguments.userpassword, + permissions = arguments.permissions, + } + end + -- if inmemory then local n = 0 f = { } @@ -2631,9 +2934,17 @@ local openfile, closefile do local xrefoffset = offset local lastfree = 0 local noffree = 0 + -- + local os = objectstream + if encryptstream then + objectstream = false + end local catalog = lpdf.getcatalog() + objectstream = os + -- local info = lpdf.getinfo() local trailerid = lpdf.gettrailerid() + if objectstream then flushdeferred() flushcache() @@ -2752,38 +3063,70 @@ local openfile, closefile do local data = concat(objects,"",0,nofobjects) local size = #data local xref = pdfdictionary { - Type = pdfconstant("XRef"), - Size = nofobjects + 1, - W = pdfarray { 1, nofbytes, 1 }, - Root = catalog, - Info = info, - ID = trailerid and pdfarray { pdfliteral(trailerid,true), pdfliteral(trailerid,true) } or nil, + Type = pdfconstant("XRef"), + Size = nofobjects + 1, + W = pdfarray { 1, nofbytes, 1 }, + Root = catalog, + Info = info, + ID = trailerid and pdfarray { pdfliteral(trailerid,true), pdfliteral(trailerid,true) } or nil, + Encrypt = encdict or nil, } local fb - if compress then - local comp = compressdata(data,size) - if comp then - data = comp - size = #data - fb = f_stream_b_d_c + -- if encryptstream then + -- if compress then + -- local comp = compressdata(data,size) + -- if comp then + -- data = comp + -- size = #data + -- fb = f_stream_b_d_c + -- xref.Filter = pdfarray { + -- pdfconstant("Crypt"), -- identity + -- pdfconstant("FlateDecode") + -- } + -- else + -- xref.Filter = pdfconstant("Crypt") -- identity + -- end + -- else + -- xref.Filter = pdfconstant("Crypt") -- identity + -- end + -- fb = f_stream_b_d_u + -- else + if compress then + local comp = compressdata(data,size) + if comp then + data = comp + size = #data + fb = f_stream_b_d_c + else + fb = f_stream_b_d_u + end else fb = f_stream_b_d_u end - else - fb = f_stream_b_d_u - end + -- end + -- no encryption of data here flush(f,fb(nofobjects,xref(),size)) flush(f,data) flush(f,s_stream_e) flush(f,f_startxref(xrefoffset)) else flushdeferred() + -- + -- if encryptstream then + -- -- unencrypted ! + -- local eo = encryptobject + -- encryptobject = false + -- encdict = pdfreference(pdfimmediateobject(tostring(encdict))) + -- encryptobject = eo + -- end + -- xrefoffset = offset flush(f,f_xref(nofobjects+1)) local trailer = pdfdictionary { - Size = nofobjects+1, - Root = catalog, - Info = info, + Size = nofobjects + 1, + Root = catalog, + Info = info, + Encrypt = encdict or nil, } for i=1,nofobjects do local o = objects[i] @@ -2994,7 +3337,6 @@ do -- end -- todo: prevent twice - local function prepare(driver) if not environment.initex then -- diff --git a/tex/context/base/mkxl/lpdf-mis.lmt b/tex/context/base/mkxl/lpdf-mis.lmt index 6d99b215d..a3a78c49f 100644 --- a/tex/context/base/mkxl/lpdf-mis.lmt +++ b/tex/context/base/mkxl/lpdf-mis.lmt @@ -20,7 +20,7 @@ local format, gsub, formatters = string.format, string.gsub, string.formatters local concat, flattened = table.concat, table.flattened local settings_to_array = utilities.parsers.settings_to_array -local pdfbackend = backends.registered.pdf +local pdfbackend = backends and backends.registered.pdf or { } local nodeinjections = pdfbackend.nodeinjections local codeinjections = pdfbackend.codeinjections local registrations = pdfbackend.registrations diff --git a/tex/context/base/mkxl/node-rul.mkxl b/tex/context/base/mkxl/node-rul.mkxl index 208ea430e..5f9eef7cb 100644 --- a/tex/context/base/mkxl/node-rul.mkxl +++ b/tex/context/base/mkxl/node-rul.mkxl @@ -171,6 +171,8 @@ % +\csname\??barattribute#1\ifcsname\??bar#1:\number\c_node_rules_index\s!parent\endcsname:\number\c_node_rules_index\fi\endcsname % \relax} +%D \overbar{Über} \underbar{Unterstrich \underbar{steigt \overbar{auf} den \underbar{Unterberg}}}. +%D %D \underbar {\underbar {\samplefile{tufte}}}\par %D \underbar {\underdot {\samplefile{tufte}}}\par %D \underbar {\underdot {\samplefile{tufte}}}\par @@ -179,10 +181,12 @@ %D \underbar {\underdots{\samplefile{tufte}}}\par %D \underdots{\underdots{\samplefile{tufte}}}\par -\newcount\c_node_rules_index % can barindex go? +\newcount \c_node_rules_index +\integerdef \c_node_rules_used \zerocount +\mutable\let\m_node_rules_previous_bar\empty \permanent\protected\def\node_rules_set#1% maybe reverse the 1000 (also maybe use more attributes instead of settings) - {\let\previousbar\currentbar + {\let\m_node_rules_previous_bar\currentbar \edef\currentbar{#1}% \usebarstyleandcolor\c!foregroundstyle\c!foregroundcolor % maybe: \usebarstyleandcolor\c!textgroundstyle\c!textcolor @@ -190,19 +194,32 @@ % \expandafter\let\expandafter\c_node_rules_index\csname\??barindex#1\endcsname \advance\c_node_rules_index\plusone \clf_enablerules % will be relaxed - \ifempty\previousbar + \edef\p_level{\barparameter\c!level}% + \ifx\p_level\v!yes + \integerdef\c_node_rules_used\c_node_rules_index \c_attr_ruled - \orelse\ifx\previousbar\currentbar + \orelse\ifx\p_level\v!auto + \integerdef\c_node_rules_used\c_node_rules_index + \ifempty\m_node_rules_previous_bar + \c_attr_ruled + \orelse\ifx\m_node_rules_previous_bar\currentbar + \c_attr_ruled + \else + \clf_enableextrarules % will be relaxed + \c_attr_ruledextra + \fi + \orelse\ifchknum\p_level\or + \integerdef\c_node_rules_used\p_level \c_attr_ruled \else - \clf_enableextrarules % will be relaxed - \c_attr_ruledextra + \integerdef\c_node_rules_used\c_node_rules_index + \c_attr_ruled \fi - \numexpr - \plusthousand*\c_node_rules_index - % optimizing this one needs testing - +\csname\??barattribute#1\ifcsname\??bar#1:\number\c_node_rules_index\s!parent\endcsname:\number\c_node_rules_index\fi\endcsname - \relax} + \numexpr + \plusthousand*\c_node_rules_used + % optimizing this one needs testing + +\csname\??barattribute#1\ifcsname\??bar#1:\number\c_node_rules_index\s!parent\endcsname:\number\c_node_rules_used\fi\endcsname + \relax} \permanent\protected\def\resetbar {\c_attr_ruled \attributeunsetvalue @@ -247,6 +264,7 @@ \setupbars [\c!method=0, % new: 0=center nested, 1=stack nested \c!continue=\v!no, + \c!level=\v!yes, \c!empty=, % new: yes = hide text \c!offset=0, % upwards, replaces: topoffset bottomoffset \c!dy=0, @@ -379,6 +397,7 @@ \definebar [undergraphic] [\c!mp=rules:under:dash, + \c!level=\v!auto, \c!offset=-.2, \c!dy=.4, \c!continue=\v!yes, diff --git a/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv b/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv index 0ee8a3a65..1c9788a98 100644 --- a/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv +++ b/tex/context/fonts/mkiv/type-imp-newcomputermodern.mkiv @@ -49,8 +49,8 @@ \starttypescript [\s!math][newcomputermodern] [\s!name] % \loadfontgoodies[newcomputermodern-math] ,\s!goodies=newcomputermodern-math - \definefontsynonym[\s!MathRoman] [\s!file:newcmmath-regular][\s!features={\s!math\mathsizesuffix,mathextra}] - \definefontsynonym[\s!MathRomanBold][\s!file:newcmmath-regular][\s!features={\s!math\mathsizesuffix,newcomputermodern-math-bold,mathextra}] + \definefontsynonym[\s!MathRoman] [\s!file:newcmmath-regular][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=lm] + \definefontsynonym[\s!MathRomanBold][\s!file:newcmmath-regular][\s!features={\s!math\mathsizesuffix,newcomputermodern-math-bold,mathextra}\s!goodies=lm] \stoptypescript \starttypescript [\s!serif] [newcomputermodern-book] [\s!name] diff --git a/tex/context/interface/mkii/keys-de.xml b/tex/context/interface/mkii/keys-de.xml index ab68cfb9b..579cc352d 100644 --- a/tex/context/interface/mkii/keys-de.xml +++ b/tex/context/interface/mkii/keys-de.xml @@ -82,6 +82,7 @@ <cd:variable name='anchor' value='anchor'/> <cd:variable name='and' value='und'/> <cd:variable name='answerarea' value='answerarea'/> + <cd:variable name='append' value='append'/> <cd:variable name='appendices' value='anhaenge'/> <cd:variable name='appendix' value='anhang'/> <cd:variable name='april' value='april'/> @@ -153,6 +154,7 @@ <cd:variable name='commands' value='befehle'/> <cd:variable name='comment' value='kommentar'/> <cd:variable name='component' value='komponente'/> + <cd:variable name='compress' value='compress'/> <cd:variable name='compressseparator' value='compressseparator'/> <cd:variable name='compressstopper' value='compressstopper'/> <cd:variable name='concept' value='konzept'/> @@ -189,6 +191,7 @@ <cd:variable name='enumeration' value='nummerierung'/> <cd:variable name='environment' value='umgebung'/> <cd:variable name='even' value='gerade'/> + <cd:variable name='explicit' value='explicit'/> <cd:variable name='export' value='export'/> <cd:variable name='external' value='extern'/> <cd:variable name='extremestretch' value='extremestretch'/> @@ -210,6 +213,8 @@ <cd:variable name='fixed' value='fest'/> <cd:variable name='flexible' value='flexibel'/> <cd:variable name='float' value='gleitobjekt'/> + <cd:variable name='flushbackward' value='flushbackward'/> + <cd:variable name='flushforward' value='flushforward'/> <cd:variable name='flushinner' value='flushinner'/> <cd:variable name='flushleft' value='flushleft'/> <cd:variable name='flushouter' value='flushouter'/> @@ -313,6 +318,7 @@ <cd:variable name='lefthanging' value='lefthanging'/> <cd:variable name='leftmargin' value='linkerrand'/> <cd:variable name='leftpage' value='linkerseite'/> + <cd:variable name='lefttext' value='linkertext'/> <cd:variable name='lefttoright' value='lefttoright'/> <cd:variable name='legend' value='legende'/> <cd:variable name='less' value='less'/> @@ -437,6 +443,7 @@ <cd:variable name='postscript' value='postscript'/> <cd:variable name='precedingpage' value='precedingpage'/> <cd:variable name='preference' value='einstellung'/> + <cd:variable name='prepend' value='prepend'/> <cd:variable name='preview' value='vorschau'/> <cd:variable name='previous' value='vorig'/> <cd:variable name='previousevenpage' value='vorigegeradeseite'/> @@ -473,6 +480,7 @@ <cd:variable name='righthanging' value='righthanging'/> <cd:variable name='rightmargin' value='rechterrand'/> <cd:variable name='rightpage' value='rechterseite'/> + <cd:variable name='righttext' value='rechtertext'/> <cd:variable name='righttoleft' value='righttoleft'/> <cd:variable name='roman' value='antiqua'/> <cd:variable name='romannumerals' value='roemischezahlen'/> @@ -1242,6 +1250,7 @@ <cd:constant name='splitoffset' value='splitoffset'/> <cd:constant name='spot' value='spot'/> <cd:constant name='stack' value='stack'/> + <cd:constant name='stacking' value='stacking'/> <cd:constant name='stackname' value='stackname'/> <cd:constant name='start' value='start'/> <cd:constant name='starter' value='starter'/> @@ -1279,6 +1288,7 @@ <cd:constant name='tab' value='tab'/> <cd:constant name='text' value='text'/> <cd:constant name='textalign' value='textalign'/> + <cd:constant name='textalternative' value='textalternative'/> <cd:constant name='textcolor' value='textfarbe'/> <cd:constant name='textcommand' value='textbefehl'/> <cd:constant name='textdistance' value='textdistance'/> @@ -1373,6 +1383,8 @@ <cd:element name='load' value='laden'/> <cd:element name='local' value='lokal'/> <cd:element name='makeup' value='umbruch'/> + <cd:element name='namednotation' value='namednotation'/> + <cd:element name='namedtyping' value='namedtyping'/> <cd:element name='next' value='folgende'/> <cd:element name='place' value='platziere'/> <cd:element name='previous' value='vorige'/> @@ -1544,6 +1556,7 @@ <cd:command name='definereferencelist' value='definierereferenzliste'/> <cd:command name='defineregister' value='definiereregister'/> <cd:command name='definerule' value='definerule'/> + <cd:command name='definesavebuffer' value='startsavebuffer'/> <cd:command name='definesection' value='definiereabschnitt'/> <cd:command name='definesectionblock' value='definiereabschnittsblock'/> <cd:command name='definesorting' value='definieresortieren'/> @@ -1720,6 +1733,9 @@ <cd:command name='moveformula' value='moveformula'/> <cd:command name='moveongrid' value='amgitterneuausrichten'/> <cd:command name='movesidefloat' value='movesidefloat'/> + <cd:command name='namedconstruction' value='namedconstruction'/> + <cd:command name='nameddescription' value='nameddescription'/> + <cd:command name='namedenumeration' value='namedenumeration'/> <cd:command name='navigating' value='navigating'/> <cd:command name='nodimension' value='keindimension'/> <cd:command name='noheaderandfooterlines' value='keinekopfundfusszeilen'/> @@ -2091,6 +2107,13 @@ <cd:command name='startmakeup' value='startumbruch'/> <cd:command name='startmarginblock' value='startmarginalblock'/> <cd:command name='startmarginrule' value='startmarginallinie'/> + <cd:command name='startnamedconstruction' value='startnamedconstruction'/> + <cd:command name='startnameddescription' value='startnameddescription'/> + <cd:command name='startnamedenumeration' value='startnamedenumeration'/> + <cd:command name='startnamedmatrix' value='startnamedmatrix'/> + <cd:command name='startnamedsection' value='startnamedsection'/> + <cd:command name='startnamedsubformulas' value='startnamedsubformulas'/> + <cd:command name='startnamedtyping' value='startnamedtyping'/> <cd:command name='startnarrower' value='startenger'/> <cd:command name='startopposite' value='startgegenueber'/> <cd:command name='startoverlay' value='startoverlay'/> @@ -2134,6 +2157,13 @@ <cd:command name='stopmakeup' value='stopumbruch'/> <cd:command name='stopmarginblock' value='stopmarginalblock'/> <cd:command name='stopmarginrule' value='stopmarginallinie'/> + <cd:command name='stopnamedconstruction' value='stopnamedconstruction'/> + <cd:command name='stopnameddescription' value='stopnameddescription'/> + <cd:command name='stopnamedenumeration' value='stopnamedenumeration'/> + <cd:command name='stopnamedmatrix' value='stopnamedmatrix'/> + <cd:command name='stopnamedsection' value='stopnamedsection'/> + <cd:command name='stopnamedsubformulas' value='stopnamedsubformulas'/> + <cd:command name='stopnamedtyping' value='stopnamedtyping'/> <cd:command name='stopnarrower' value='stopenger'/> <cd:command name='stopopposite' value='stopgegenueber'/> <cd:command name='stopoverlay' value='stopoverlay'/> diff --git a/tex/context/modules/mkxl/m-circuitikz.mkxl b/tex/context/modules/mkxl/m-circuitikz.mkxl new file mode 100644 index 000000000..9a105ff09 --- /dev/null +++ b/tex/context/modules/mkxl/m-circuitikz.mkxl @@ -0,0 +1,137 @@ +%D \module +%D [ file=m-circuitikz, +%D version=2021.12.03, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=CURCUITIKZ support, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D A fixed variant of the t-curcuitikz module distributed with tikz. This one +%D is for \LMTX. + +\usemodule[m][tikz] + +\startmodule[circuitikz] + +\def\pgfcircversion {1.4.4} +\def\pgfcircversiondate {2021/10/31} + +\usetikzlibrary[calc] +\usetikzlibrary[arrows.meta, bending] +\usetikzlibrary[fpu] % may be needed for use fpu reciprocal (v1.0.1) + +\tikzinputfile{pgfcirc.defines.tex} +\tikzinputfile{pgfcircutils.tex} +\tikzinputfile{pgfcircpath.tex} + +\tikzinputfile{pgfcircshapes.tex} +\tikzinputfile{pgfcircmonopoles.tex} +\tikzinputfile{pgfcircbipoles.tex} +\tikzinputfile{pgfcirctripoles.tex} +\tikzinputfile{pgfcircquadpoles.tex} +\tikzinputfile{pgfcircmultipoles.tex} + +\tikzinputfile{pgfcirclabel.tex} +\tikzinputfile{pgfcircvoltage.tex} +\tikzinputfile{pgfcirccurrent.tex} +\tikzinputfile{pgfcircflow.tex} + +% defaults + +\setupmodule + [current=european, + voltage=european, + resistor=american, + inductor=cute, + logic=american, + siunitx=true, + arrowmos=false] + +% can be done nicer ... todo + +\processaction + [\currentmoduleparameter{voltage}] + [european=>\ctikzset{voltage=european}, + american=>\ctikzset{voltage=american}] + +\processaction + [\currentmoduleparameter{current}] + [european=>\ctikzset{ current=european}, + american=>\ctikzset{ current=american}] + +\processaction + [\currentmoduleparameter{label}] + [straight=>\ctikzset{label/align = straight}, + align=>\ctikzset{label/align = rotate}, + smart=>\ctikzset{label/align = smart}] + +\processaction + [\currentmoduleparameter{resistor}] + [european=>\ctikzset{ resistor=european}, + american=>\ctikzset{ resistor=american}] + +\processaction + [\currentmoduleparameter{inductor}] + [european=>\ctikzset{ inductor=european}, + american=>\ctikzset{ inductor=american}, + cute=>\ctikzset{ inductor=cute}] + +\processaction + [\currentmoduleparameter{diode}] + [full=>\ctikzset{ diode=full}, + empty=>\ctikzset{ diode=empty}] + +\processaction + [\currentmoduleparameter{logic}] + [european=>\ctikzset{ logic ports=european}, + american=>\ctikzset{ logic ports=american}] + +% hm, we have units built in and in mkii one can load the units module +% ... always been so ... + +\processaction + [\currentmoduleparameter{siunitx}] + [true=>\def\SI #1#2{#1\,#2} + \def\ampere {\rm{A}} + \def\volt {\rm{V}} + \def\ohm {\Omega} + \def\siemens {\rm{S}} + \def\farad {\rm{F}} + \def\henry {\rm{H}} + \def\second {\rm{s}} + \def\coulomb {\rm{C}} + \def\siemens {\rm{S}} + \def\radians {\rm{rad}} + \def\milli {\rm{m}} + \def\micro {\mu} + \def\nano {\rm{n}} + \def\pico {\rm{p}} + \def\kilo {\rm{k}} + \def\mega {\rm{M}} + \def\giga {\rm{G}} + \def\tera {\rm{T}}] + +\unprotect + +\processaction + [\currentmoduleparameter{arrowmos}] + [true=>\pgf@circuit@mos@arrowstrue, + false=>\pgf@circuit@mos@arrowsfalse] + +\protect + +\ctikzset{tripoles/op amp/font/.initial=\switchtobodyfont[small]} + +\aliased\let\stopcircuitikz\relax + +\permanent\protected\def\startcircuitikz#1\stopcircuitikz + {\starttikzpicture#1\stoptikzpicture} + +\stopmodule + +\endinput diff --git a/tex/context/modules/mkxl/m-tikz.mkxl b/tex/context/modules/mkxl/m-tikz.mkxl index 5b1f6e76c..df8d44f49 100644 --- a/tex/context/modules/mkxl/m-tikz.mkxl +++ b/tex/context/modules/mkxl/m-tikz.mkxl @@ -22,43 +22,52 @@ \protect \fi - -\pushoverloadmode - - \pushcatcodetable - - \setcatcodetable\texcatcodes - - \catcode`\@=11 - \catcode`\|=12 - \catcode`\!=12 - - \input t-pgf.tex - \input t-pgffor.tex - \input tikz.code.tex - - \popcatcodetable - -\popoverloadmode +\permanent\protected\def\starttikzinput + {\pushoverloadmode + \pushcatcodetable + \setcatcodetable\texcatcodes + \unprotect + \catcode`\@=11 + \catcode`\|=12 + \catcode`\!=12 + \autoparagraphmode\zerocount} + +\permanent\protected\def\stoptikzinput + {\autoparagraphmode\plusone + \protect + \popcatcodetable + \popoverloadmode} + +\permanent\protected\def\tikzinputfile#1% + {\starttikzinput + \input{#1}\relax + \stoptikzinput} + +\tikzinputfile{t-pgf.tex} +\tikzinputfile{t-pgffor.tex} +\tikzinputfile{tikz.code.tex} \permanent\protected\def\tikzerrormessage#1#2#3% {\writestatus{#1}{#2}} -% For now we need this but we need to educate the user to wrap settings -% in the wrappers. So some day the next line will go. I need to check what -% commands are possible outside a picture. +% For now we need this but we need to educate the user to wrap settings in the +% wrappers. So some day the next line will go. I need to check what commands are +% possible outside a picture. \overloadmode\zerocount \permanent\protected\def\starttikzsettings - {\pushoverloadmode} + {\pushoverloadmode + \autoparagraphmode\zerocount} \permanent\protected\def\stoptikzsettings - {\popoverloadmode} + {\autoparagraphmode\plusone + \popoverloadmode} \permanent\protected\def\starttikzpicture {\dontleavehmode \hcontainer\bgroup + \autoparagraphmode\zerocount % \pushoverloadmode \ifdefined\PackageError\else \let\PackageError\tikzerrormessage \fi \tikzpicture} @@ -68,33 +77,18 @@ % \popoverloadmode \egroup} -% \input t-pgf.tex - \ifx\pgfdefined\undefined \let\pgfdefined\relax - % \input t-pgfcor.tex - \ifx\pgfcoredefined\undefined - \let\pgfcoredefined=\relax - - \input t-pgfsys.tex - - \edef\pgfcoreatcode {\the\catcode`\@} - \edef\pgfcorebarcode {\the\catcode`\|} - \edef\pgfcoreexclaimcode{\the\catcode`\!} - - \catcode`\@=11 - \catcode`\|=12 - \catcode`\!=12 + \let\pgfcoredefined\relax - \input pgfcore.code.tex - - \catcode`\@=\pgfcoreatcode - \catcode`\|=\pgfcorebarcode - \catcode`\!=\pgfcoreexclaimcode + \tikzinputfile{pgfsys.code.tex} + \tikzinputfile{pgfsyssoftpath.code.tex} + \tikzinputfile{pgfsysprotocol.code.tex} + \tikzinputfile{pgfcore.code.tex} \let\startpgfpicture \pgfpicture \let\stoppgfpicture \endpgfpicture \let\startpgfscope \pgfscope \let\stoppgfscope \endpgfscope @@ -105,6 +99,13 @@ \fi + \let\normalusepgfmodule\usepgfmodule + + \protected\def\usepgfmodule[#1]% + {\starttikzinput + \normalusepgfmodule[#1]% + \stoptikzinput} + \usepgfmodule[shapes,plot] \fi diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index e50c388b9..2427e3389 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2021-12-03 15:17 +-- merge date : 2021-12-10 11:29 do -- begin closure to overcome local limits and interference |