From 4a7fb336e5a59645520c05690efe98c9c7270d37 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 18 Oct 2017 21:34:02 +0200 Subject: 2017-10-18 21:22:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkii/mult-fr.mkii | 3 + tex/context/base/mkii/mult-it.mkii | 1 + tex/context/base/mkiv/anch-bck.mkvi | 10 +- tex/context/base/mkiv/back-pdf.lua | 12 +-- tex/context/base/mkiv/back-pdf.mkiv | 7 +- tex/context/base/mkiv/back-swf.mkiv | 140 +++++++++++++++++++++++++++- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/core-sys.lua | 3 +- tex/context/base/mkiv/font-tfm.lua | 4 +- tex/context/base/mkiv/grph-inc.lua | 8 +- tex/context/base/mkiv/grph-inc.mkiv | 6 +- tex/context/base/mkiv/grph-swf.lua | 1 + tex/context/base/mkiv/lang-txt.lua | 81 +++++++--------- tex/context/base/mkiv/lpdf-epa.lua | 3 +- tex/context/base/mkiv/lpdf-fld.lua | 83 ++++++++--------- tex/context/base/mkiv/lpdf-fmt.lua | 28 +++--- tex/context/base/mkiv/lpdf-ini.lua | 78 ++++++++++++++-- tex/context/base/mkiv/lpdf-mis.lua | 3 +- tex/context/base/mkiv/lpdf-mov.lua | 2 +- tex/context/base/mkiv/lpdf-swf.lua | 45 +++++---- tex/context/base/mkiv/lpdf-tag.lua | 6 +- tex/context/base/mkiv/lpdf-wid.lua | 21 ++++- tex/context/base/mkiv/lpdf-xmp.lua | 8 +- tex/context/base/mkiv/luat-ini.lua | 6 +- tex/context/base/mkiv/math-def.mkiv | 3 + tex/context/base/mkiv/mult-prm.lua | 3 +- tex/context/base/mkiv/mult-prm.mkiv | 2 +- tex/context/base/mkiv/publ-ini.lua | 20 ++-- tex/context/base/mkiv/publ-ini.mkiv | 163 ++++++++++++++++++++++++++------- tex/context/base/mkiv/scrn-wid.lua | 19 +++- tex/context/base/mkiv/scrn-wid.mkvi | 3 +- tex/context/base/mkiv/status-files.pdf | Bin 25716 -> 25727 bytes tex/context/base/mkiv/status-lua.pdf | Bin 245458 -> 246064 bytes tex/context/base/mkiv/util-sto.lua | 74 ++++++++++++++- tex/context/base/mkiv/util-tab.lua | 10 +- 38 files changed, 638 insertions(+), 226 deletions(-) (limited to 'tex/context/base') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 49269493e..a9ec6541c 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{2017.10.15 12:29} +\newcontextversion{2017.10.18 21:16} %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 0375b1b7a..9322b41a4 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{2017.10.15 12:29} +\edef\contextversion{2017.10.18 21:16} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-fr.mkii b/tex/context/base/mkii/mult-fr.mkii index bae157e5a..63ddbeed7 100644 --- a/tex/context/base/mkii/mult-fr.mkii +++ b/tex/context/base/mkii/mult-fr.mkii @@ -753,6 +753,7 @@ \setinterfaceconstant{direction}{direction} \setinterfaceconstant{directory}{repertoire} \setinterfaceconstant{display}{affichage} +\setinterfaceconstant{displaythreshold}{displaythreshold} \setinterfaceconstant{distance}{distance} \setinterfaceconstant{domain}{domain} \setinterfaceconstant{dot}{point} @@ -862,6 +863,7 @@ \setinterfaceconstant{index}{index} \setinterfaceconstant{indicator}{indicateur} \setinterfaceconstant{initialsep}{initialsep} +\setinterfaceconstant{inlinethreshold}{inlinethreshold} \setinterfaceconstant{inner}{interieur} \setinterfaceconstant{innermargin}{margeinterieure} \setinterfaceconstant{inputfile}{fichierentree} @@ -1148,6 +1150,7 @@ \setinterfaceconstant{sidemethod}{sidemethod} \setinterfaceconstant{sidespaceafter}{espacelateralapres} \setinterfaceconstant{sidespacebefore}{espacelateralavant} +\setinterfaceconstant{sidethreshold}{sidethreshold} \setinterfaceconstant{sign}{signe} \setinterfaceconstant{size}{dimension} \setinterfaceconstant{slantedfeatures}{slantedfeatures} diff --git a/tex/context/base/mkii/mult-it.mkii b/tex/context/base/mkii/mult-it.mkii index c0eb9332b..422b2dac8 100644 --- a/tex/context/base/mkii/mult-it.mkii +++ b/tex/context/base/mkii/mult-it.mkii @@ -1150,6 +1150,7 @@ \setinterfaceconstant{sidemethod}{sidemethod} \setinterfaceconstant{sidespaceafter}{spaziolateraledopo} \setinterfaceconstant{sidespacebefore}{spaziolateraleprima} +\setinterfaceconstant{sidethreshold}{sidethreshold} \setinterfaceconstant{sign}{segno} \setinterfaceconstant{size}{dimensione} \setinterfaceconstant{slantedfeatures}{slantedfeatures} diff --git a/tex/context/base/mkiv/anch-bck.mkvi b/tex/context/base/mkiv/anch-bck.mkvi index 207f64537..348ea0ad1 100644 --- a/tex/context/base/mkiv/anch-bck.mkvi +++ b/tex/context/base/mkiv/anch-bck.mkvi @@ -159,6 +159,9 @@ % todo \backgroundvariable\c!variant +% criterium determines when we fall back on text +% always is always forcing paragraphs + \let\anch_backgrounds_text_start_indeed\relax \let\anch_backgrounds_text_stop_indeed \relax @@ -167,7 +170,7 @@ \let\anch_backgrounds_text_stop_indeed \anch_backgrounds_text_stop_txt} \setvalue{\??textbackgroundlevel\v!paragraph}% - {\ifnum\c_anch_backgrounds_text_level>\plusone + {\ifnum\c_anch_backgrounds_text_level>\textbackgroundparameter\c!criterium\relax \let\anch_backgrounds_text_start_indeed\anch_backgrounds_text_start_txt \let\anch_backgrounds_text_stop_indeed \anch_backgrounds_text_stop_txt \else @@ -175,6 +178,10 @@ \let\anch_backgrounds_text_stop_indeed \anch_backgrounds_text_stop_par \fi} +\setvalue{\??textbackgroundlevel\v!always}% + {\let\anch_backgrounds_text_start_indeed\anch_backgrounds_text_start_par + \let\anch_backgrounds_text_stop_indeed \anch_backgrounds_text_stop_par} + \setvalue{\??textbackgroundlevel\v!none}% {\anch_backgrounds_text_preset_nop} @@ -513,6 +520,7 @@ \c!rightoffset=\textbackgroundparameter\c!leftoffset, \c!topoffset=\!!zeropoint, % \v!medium, \c!bottomoffset=\textbackgroundparameter\c!topoffset, + \c!criterium=\plusone, \c!level=-1, \c!alternative=0, \c!align=, diff --git a/tex/context/base/mkiv/back-pdf.lua b/tex/context/base/mkiv/back-pdf.lua index 5d93d019e..587092d47 100644 --- a/tex/context/base/mkiv/back-pdf.lua +++ b/tex/context/base/mkiv/back-pdf.lua @@ -148,12 +148,7 @@ scanners.pdfstartmirroring = function() end if environment.arguments.nocompression then - pdf.setcompresslevel(0) - pdf.setobjcompresslevel(0) - function pdf.setcompresslevel() - -- blocked from now on - end - pdf.setobjcompresslevel = pdf.setcompresslevel + lpdf.setcompression(0,0,true) end scanners.pdfstopmirroring = scanners.pdfstartmirroring @@ -175,10 +170,7 @@ implement { implement { name = "setpdfcompression", arguments = { "integer", "integer" }, - actions = function(c,o) - pdf.setcompresslevel(c) - pdf.setobjcompresslevel(o) - end + actions = lpdf.setcompression, } local report = logs.reporter("backend","pdftex primitives") diff --git a/tex/context/base/mkiv/back-pdf.mkiv b/tex/context/base/mkiv/back-pdf.mkiv index 221d0d109..54b1a830f 100644 --- a/tex/context/base/mkiv/back-pdf.mkiv +++ b/tex/context/base/mkiv/back-pdf.mkiv @@ -28,8 +28,8 @@ \registerctxluafile{lpdf-wid}{1.001} \registerctxluafile{lpdf-fld}{1.001} \registerctxluafile{lpdf-mov}{1.001} -\registerctxluafile{lpdf-u3d}{1.001} -\registerctxluafile{lpdf-swf}{1.001} +\registerctxluafile{lpdf-u3d}{1.001} % this will become a module +\registerctxluafile{lpdf-swf}{1.001} % this will become a module \registerctxluafile{lpdf-tag}{1.001} \registerctxluafile{lpdf-fmt}{1.001} \registerctxluafile{lpdf-epd}{1.001} @@ -37,6 +37,9 @@ \registerctxluafile{back-pdf}{1.001} % some code will move to lpdf-* +\loadmarkfile{back-u3d} % this will become a module +\loadmarkfile{back-swf} % this will become a module + \unprotect %D We will minimize the number of calls to \PDF\ specific primitives and delegate diff --git a/tex/context/base/mkiv/back-swf.mkiv b/tex/context/base/mkiv/back-swf.mkiv index 09745e0f9..0a53a8fd2 100644 --- a/tex/context/base/mkiv/back-swf.mkiv +++ b/tex/context/base/mkiv/back-swf.mkiv @@ -41,7 +41,145 @@ %D \stopTEXpage %D \stoptyping -\endinput +%D Embedding (and using) movies used to be a breeze in acrobat but depended +%D on a plugin. Then we got renditions that depended on the built-in flash +%D player. And now we have rich media, depending on whatever and being able +%D to use the flash player as well ... but it's an erratic and soon obsolete +%D adventure. So \unknown\ we do provide the user the means but stay away +%D from it ourselves: it's a dead end. The following tricks use the already +%D present shockwave (flash) trickery. +%D +%D At some point we will no longer provide this in the core but load it at +%D runtime. +%D +%D \starttyping +%D \externalfigure +%D [shockwave] +%D [file=test.mp4, +%D label=foo] +%D +%D \goto{START} [JS(StartShockwave{foo})] +%D \goto{REWIND}[JS(RewindShockwave{foo})] +%D \goto{PAUSE} [JS(PauseShockwave{foo})] +%D \goto{STOP} [JS(StopShockwave{foo})] +%D +%D \useexternalrendering[foo][application/x-shockwave-flash][test.swf][embed=yes,width=100pt,height=100pt] +%D \definerenderingwindow[foo][width=100pt,height=100pt] +%D +%D \placerenderingwindow[foo][foo] +%D +%D \goto{START}[StartRendering{foo}] +%D \goto{STOP} [StopRendering{foo}] +%D \goto{PAUSE}[PauseRendering{foo}] +%D +%D % \useexternalrendering[foo][audio/mpeg][t:/sources/akkerman.mp3][embed=yes] +%D % \definerenderingwindow[foo][width=0pt,height=0pt] +%D % % \placerenderingwindow[foo][foo] +%D % \setupbackgrounds[page][background=resources] +%D % \setlayer[resources]{\placerenderingwindow[foo][foo]} +%D % \goto{START}[StartRendering{foo}] +%D % \goto{STOP} [StopRendering{foo}] +%D % \goto{PAUSE}[PauseRendering{foo}] +%D \stoptyping + +\unprotect + +\startluaparameterset[shockwave:display] + toolbar = true, + -- preview = "somefile", + open = "click", + close = "focus", +\stopluaparameterset + +% using vplayer9.swf from ctan: + +\useexternalfigure + [shockwave] + [vplayer9.swf] +% [arguments=\luaparameterset{shockwave:arguments}{src="\externalfigureparameter\v!file",source="\externalfigureparameter\v!file"}, + [\c!arguments=\luaparameterset{shockwave:arguments}{source="\externalfigureparameter\v!file",autoPlay=true}, + \c!resources=\luaparameterset{shockwave:resources}{files={"\externalfigureparameter\v!file"}}, + \c!display=shockwave:display] + +\startJSpreamble shockwave used now + function StartShockwave(label) { + var rm = this.getAnnotsRichMedia(this.pageNum,label)[0] ; + if (rm.activated) { + // ok + } else { + rm.activated = true ; + } + rm.callAS("rewind") ; + rm.callAS("playPause") ; + } + function StopShockwave(label) { + var rm = this.getAnnotsRichMedia(this.pageNum,label)[0] ; + if (rm.activated) { + rm.callAS("pause") ; + rm.callAS("rewind") ; + } + } + function RewindShockwave(label) { + var rm = this.getAnnotsRichMedia(this.pageNum,label)[0] ; + if (rm.activated) { + rm.callAS("rewind") ; + } + } + function PauseShockwave(label) { + var rm = this.getAnnotsRichMedia(this.pageNum,label)[0] ; + if (rm.activated) { + rm.callAS("playPause") ; + } + } +\stopJSpreamble + +% using videoplayer.swf from adobe or strobemediaplayback.swf from sourceforge: + +%\useexternalfigure +% [shockwave] +% [videoplayer.swf] +% [\c!arguments=\luaparameterset{shockwave:arguments}{source="\externalfigureparameter\v!file"}, +% \c!resources=\luaparameterset{shockwave:resources}{files={"\externalfigureparameter\v!file"}}, +% \c!display=shockwave:display] + +\startJSpreamble shockwave used now + function StartShockwave(label) { + var rm = this.getAnnotsRichMedia(this.pageNum,label)[0] ; + if (rm.activated) { + rm.callAS("multimedia_play") ; + } else { + rm.activated = true ; + } + } + function StopShockwave(label) { + var rm = this.getAnnotsRichMedia(this.pageNum,label)[0] ; + if (rm.activated) { + rm.callAS("multimedia_pause") ; + rm.callAS("multimedia_rewind") ; + } + } + function RewindShockwave(label) { + var rm = this.getAnnotsRichMedia(this.pageNum,label)[0] ; + if (rm.activated) { + rm.callAS("multimedia_rewind") ; + } + } + function PauseShockwave(label) { + var rm = this.getAnnotsRichMedia(this.pageNum,label)[0] ; + if (rm.activated) { + rm.callAS("multimedia_pause") ; + } + } +\stopJSpreamble + +% \useexternalfigure +% [shockwave] +% [strobemediaplayback.swf] +% [arguments=\luaparameterset{shockwave:arguments}{src="\externalfigureparameter\v!file"}, +% resources=\luaparameterset{shockwave:resources}{files={"\externalfigureparameter\v!file"}}, +% display=shockwave:display] + +\protect \endinput \starttext diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 07bfb94c5..be616e21d 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.10.15 12:29} +\newcontextversion{2017.10.18 21:16} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index cd0da3d95..3c0ff4c51 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -41,7 +41,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.10.15 12:29} +\edef\contextversion{2017.10.18 21:16} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/core-sys.lua b/tex/context/base/mkiv/core-sys.lua index 0dbe76685..523b47298 100644 --- a/tex/context/base/mkiv/core-sys.lua +++ b/tex/context/base/mkiv/core-sys.lua @@ -75,8 +75,7 @@ statistics.register("result saved in file", function() local outputfilename = environment.outputfilename or environment.jobname or tex.jobname or "" if (tex.pdfoutput or tex.outputmode) > 0 then return format("%s.%s, compresslevel %s, objectcompresslevel %s",outputfilename,"pdf", - pdf.getcompresslevel(), - pdf.getobjcompresslevel() + lpdf.getcompression() ) else return format("%s.%s",outputfilename,"dvi") -- hard to imagine diff --git a/tex/context/base/mkiv/font-tfm.lua b/tex/context/base/mkiv/font-tfm.lua index 109efefa6..0059e6296 100644 --- a/tex/context/base/mkiv/font-tfm.lua +++ b/tex/context/base/mkiv/font-tfm.lua @@ -551,7 +551,9 @@ end local flushstreamobject = lpdf and lpdf.flushstreamobject local setfontattributes = pdf.setfontattributes - if not flushstreamobject then + if flushstreamobject then + -- we're in context + else flushstreamobject = function(data) return pdf.obj { immediate = true, diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua index e08994373..70f5e528f 100644 --- a/tex/context/base/mkiv/grph-inc.lua +++ b/tex/context/base/mkiv/grph-inc.lua @@ -1892,7 +1892,6 @@ function figures.getinfo(name,page) local data = figures.push(name) figures.identify() figures.check() - inspect(data) figures.pop() return data end @@ -1909,6 +1908,7 @@ implement { { "name" }, { "label" }, { "page" }, + { "file" }, { "size" }, { "object" }, { "prefix" }, @@ -1977,7 +1977,7 @@ local registered = { } local ctx_doexternalfigurerepeat = context.doexternalfigurerepeat -interfaces.implement { +implement { name = "figure_register_page", arguments = { "string", "string", "string" }, actions = function(a,b,c) @@ -1986,14 +1986,14 @@ interfaces.implement { end } -interfaces.implement { +implement { name = "figure_nof_registered_pages", actions = function() context(#registered) end } -interfaces.implement { +implement { name = "figure_flush_registered_pages", arguments = "string", actions = function(n) diff --git a/tex/context/base/mkiv/grph-inc.mkiv b/tex/context/base/mkiv/grph-inc.mkiv index fb57d4634..eb8d8c104 100644 --- a/tex/context/base/mkiv/grph-inc.mkiv +++ b/tex/context/base/mkiv/grph-inc.mkiv @@ -24,8 +24,8 @@ \registerctxluafile{grph-con}{1.001} \registerctxluafile{grph-fil}{1.001} \registerctxluafile{grph-mem}{1.001} -\registerctxluafile{grph-u3d}{1.001} % this will change -\registerctxluafile{grph-swf}{1.001} % this will change +\registerctxluafile{grph-u3d}{1.001} % this will become a module +\registerctxluafile{grph-swf}{1.001} % this will become a module \unprotect @@ -56,6 +56,7 @@ \c!prefix =, \c!cache =, \c!page =\zerocount, + \c!file =, \c!display =, \c!mask =, \c!preset =\v!yes, @@ -319,6 +320,7 @@ name {\p_grph_include_name}% label {\ifx\p_label\empty\p_grph_include_label\else\p_label\fi}% page {\externalfigureparameter\c!page}% + file {\externalfigureparameter\c!file}% size {\externalfigureparameter\c!size}% object {\externalfigureparameter\c!object}% prefix {\externalfigureparameter\c!prefix}% diff --git a/tex/context/base/mkiv/grph-swf.lua b/tex/context/base/mkiv/grph-swf.lua index 8c28b76af..30089cdc4 100644 --- a/tex/context/base/mkiv/grph-swf.lua +++ b/tex/context/base/mkiv/grph-swf.lua @@ -84,6 +84,7 @@ function figures.checkers.swf(data) controls = dr.controls, -- label = dr.label, resources = dr.resources, + arguments = dr.arguments, } context.stopfoundexternalfigure() return data diff --git a/tex/context/base/mkiv/lang-txt.lua b/tex/context/base/mkiv/lang-txt.lua index 443a261df..b1f50bc80 100644 --- a/tex/context/base/mkiv/lang-txt.lua +++ b/tex/context/base/mkiv/lang-txt.lua @@ -252,7 +252,7 @@ data.labels={ ["sk"]="P", }, }, - ["acos"]={ + ["arccos"]={ ["labels"]={ ["cz"]="arccos", ["en"]="arccos", @@ -262,14 +262,14 @@ data.labels={ ["sk"]="arccos", }, }, - ["arccos"]={ + ["arccosh"]={ ["labels"]={ - ["cz"]="arccos", - ["en"]="arccos", - ["es"]="arc\\sixperemspace cos", - ["hr"]="arc\\sixperemspace cos", - ["pl"]="arc\\sixperemspace cos", - ["sk"]="arccos", + ["cz"]="arccosh", + ["en"]="arccosh", + ["es"]="arc\\sixperemspace cosh", + ["hr"]="arc\\sixperemspace cosh", + ["pl"]="arc\\sixperemspace cosh", + ["sk"]="arccosh", }, }, ["arcctg"]={ @@ -292,6 +292,16 @@ data.labels={ ["sk"]="arcsin", }, }, + ["arcsinh"]={ + ["labels"]={ + ["cz"]="arcsinh", + ["en"]="arcsinh", + ["es"]="arc\\sixperemspace senh", + ["hr"]="arc\\sixperemspace sinh", + ["pl"]="arc\\sixperemspace sinh", + ["sk"]="arcsinh", + }, + }, ["arctan"]={ ["labels"]={ ["cz"]="arctg", @@ -302,13 +312,13 @@ data.labels={ ["sk"]="arctg", }, }, - ["arctg"]={ + ["arctanh"]={ ["labels"]={ - ["cz"]="arctg", - ["en"]="arctan", - ["es"]="arc\\sixperemspace tan", - ["hr"]="arc\\sixperemspace tg", - ["pl"]="arc\\sixperemspace tg", + ["cz"]="arctgh", + ["en"]="arctanh", + ["es"]="arc\\sixperemspace tanh", + ["hr"]="arc\\sixperemspace tgh", + ["pl"]="arc\\sixperemspace tgh", ["sk"]="arctg", }, }, @@ -320,26 +330,6 @@ data.labels={ ["sk"]="arg", }, }, - ["asin"]={ - ["labels"]={ - ["cz"]="arcsin", - ["en"]="arcsin", - ["es"]="arc\\sixperemspace sen", - ["hr"]="arc\\sixperemspace sin", - ["pl"]="arc\\sixperemspace sin", - ["sk"]="arcsin", - }, - }, - ["atan"]={ - ["labels"]={ - ["cz"]="arctg", - ["en"]="arctan", - ["es"]="arc\\sixperemspace tan", - ["hr"]="arc\\sixperemspace tg", - ["pl"]="arc\\sixperemspace tg", - ["sk"]="arctg", - }, - }, ["cos"]={ ["labels"]={ ["cz"]="cos", @@ -619,16 +609,6 @@ data.labels={ ["sk"]="tgh", }, }, - ["tg"]={ - ["labels"]={ - ["cz"]="tg", - ["en"]="tan", - ["es"]="tan", - ["hr"]="tg", - ["pl"]="tg", - ["sk"]="tg", - }, - }, }, ["texts"]={ ["and"]={ @@ -3009,6 +2989,13 @@ data.labels={ local functions = data.labels.functions -functions.asin = functions.arcsin -functions.acos = functions.arccos -functions.atan = functions.arctan +functions.asin = functions.arcsin +functions.acos = functions.arccos +functions.atan = functions.arctan +functions.asinh = functions.arcsinh +functions.acosh = functions.arccosh +functions.atanh = functions.arctanh + +functions.tg = functions.tan +functions.arctg = functions.arctan +functions.arctgh = functions.arctanh diff --git a/tex/context/base/mkiv/lpdf-epa.lua b/tex/context/base/mkiv/lpdf-epa.lua index 1912a7ff3..d615f2bef 100644 --- a/tex/context/base/mkiv/lpdf-epa.lua +++ b/tex/context/base/mkiv/lpdf-epa.lua @@ -6,8 +6,7 @@ if not modules then modules = { } end modules ['lpdf-epa'] = { license = "see context related readme files" } --- This is a rather experimental feature and the code will probably --- change. +-- This is a rather experimental feature and the code will probably change. local type, tonumber = type, tonumber local format, gsub, lower = string.format, string.gsub, string.lower diff --git a/tex/context/base/mkiv/lpdf-fld.lua b/tex/context/base/mkiv/lpdf-fld.lua index 9456e2f08..e8a968713 100644 --- a/tex/context/base/mkiv/lpdf-fld.lua +++ b/tex/context/base/mkiv/lpdf-fld.lua @@ -6,54 +6,50 @@ if not modules then modules = { } end modules ['lpdf-fld'] = { license = "see context related readme files" } --- The problem with widgets is that so far each version of acrobat --- has some rendering problem. I tried to keep up with this but --- it makes no sense to do so as one cannot rely on the viewer --- not changing. Especially Btn fields are tricky as their appearences --- need to be synchronized in the case of children but e.g. acrobat --- 10 does not retain the state and forces a check symbol. If you --- make a file in acrobat then it has MK entries that seem to overload --- the already present appearance streams (they're probably only meant for --- printing) as it looks like the viewer has some fallback on (auto --- generated) MK behaviour built in. So ... hard to test. Unfortunately --- not even the default appearance is generated. This will probably be --- solved at some point. +-- The problem with widgets is that so far each version of acrobat has some +-- rendering problem. I tried to keep up with this but it makes no sense to do so as +-- one cannot rely on the viewer not changing. Especially Btn fields are tricky as +-- their appearences need to be synchronized in the case of children but e.g. +-- acrobat 10 does not retain the state and forces a check symbol. If you make a +-- file in acrobat then it has MK entries that seem to overload the already present +-- appearance streams (they're probably only meant for printing) as it looks like +-- the viewer has some fallback on (auto generated) MK behaviour built in. So ... +-- hard to test. Unfortunately not even the default appearance is generated. This +-- will probably be solved at some point. -- --- Also, for some reason the viewer does not always show custom appearances --- when fields are being rolled over or clicked upon, and circles or checks --- pop up when you don't expect them. I fear that this kind of instability --- eventually will kill pdf forms. After all, the manual says: "individual --- annotation handlers may ignore this entry and provide their own appearances" --- and one might wonder what 'individual' means here, but effectively this --- renders the whole concept of appearances useless. +-- Also, for some reason the viewer does not always show custom appearances when +-- fields are being rolled over or clicked upon, and circles or checks pop up when +-- you don't expect them. I fear that this kind of instability eventually will kill +-- pdf forms. After all, the manual says: "individual annotation handlers may ignore +-- this entry and provide their own appearances" and one might wonder what +-- 'individual' means here, but effectively this renders the whole concept of +-- appearances useless. -- --- Okay, here is one observation. A pdf file contains objects and one might --- consider each one to be a static entity when read in. However, acrobat --- starts rendering and seems to manipulate (appearance streams) of objects --- in place (this is visible when the file is saved again). And, combined --- with some other caching and hashing, this might give side effects for --- shared objects. So, it seems that for some cases one can best be not too --- clever and not share but duplicate information. Of course this defeats the --- whole purpose of these objects. Of course I can be wrong. +-- Okay, here is one observation. A pdf file contains objects and one might consider +-- each one to be a static entity when read in. However, acrobat starts rendering +-- and seems to manipulate (appearance streams) of objects in place (this is visible +-- when the file is saved again). And, combined with some other caching and hashing, +-- this might give side effects for shared objects. So, it seems that for some cases +-- one can best be not too clever and not share but duplicate information. Of course +-- this defeats the whole purpose of these objects. Of course I can be wrong. -- -- A rarther weird side effect of the viewer is that the highlighting of fields --- obscures values, unless you uses one of the BS variants, and this makes --- custum appearances rather useless as there is no way to control this apart --- from changing the viewer preferences. It could of course be a bug but it would --- be nice if the highlighting was at least transparent. I have no clue why the --- built in shapes work ok (some xform based appearances are generated) while --- equally valid other xforms fail. It looks like acrobat appearances come on --- top (being refered to in the MK) while custom ones are behind the highlight --- rectangle. One can disable the "Show border hover color for fields" option --- in the preferences. If you load java-imp-rhh this side effect gets disabled --- and you get what you expect (it took me a while to figure out this hack). +-- obscures values, unless you uses one of the BS variants, and this makes custum +-- appearances rather useless as there is no way to control this apart from changing +-- the viewer preferences. It could of course be a bug but it would be nice if the +-- highlighting was at least transparent. I have no clue why the built in shapes +-- work ok (some xform based appearances are generated) while equally valid other +-- xforms fail. It looks like acrobat appearances come on top (being refered to in +-- the MK) while custom ones are behind the highlight rectangle. One can disable the +-- "Show border hover color for fields" option in the preferences. If you load +-- java-imp-rhh this side effect gets disabled and you get what you expect (it took +-- me a while to figure out this hack). -- --- When highlighting is enabled, those default symbols flash up, so it looks --- like we have some inteference between this setting and custom appearances. +-- When highlighting is enabled, those default symbols flash up, so it looks like we +-- have some inteference between this setting and custom appearances. -- --- Anyhow, the NeedAppearances is really needed in order to get a rendering --- for printing especially when highlighting (those colorfull foregrounds) is --- on. +-- Anyhow, the NeedAppearances is really needed in order to get a rendering for +-- printing especially when highlighting (those colorfull foregrounds) is on. local tostring, tonumber, next = tostring, tonumber, next local gmatch, lower, format, formatters = string.gmatch, string.lower, string.format, string.formatters @@ -92,6 +88,7 @@ local pdfshareobjectreference = lpdf.shareobjectreference local pdfshareobject = lpdf.shareobject local pdfreserveobject = lpdf.reserveobject local pdfaction = lpdf.action +local pdfmajorversion = lpdf.majorversion local pdfcolor = lpdf.color local pdfcolorvalues = lpdf.colorvalues @@ -905,7 +902,7 @@ local function finishfields() end if #collected > 0 then local acroform = pdfdictionary { - NeedAppearances = true, + NeedAppearances = pdfmajorversion() == 1 or nil, Fields = pdfreference(pdfflushobject(collected)), CO = fieldsetlist(calculationset), } diff --git a/tex/context/base/mkiv/lpdf-fmt.lua b/tex/context/base/mkiv/lpdf-fmt.lua index 15cff9e4b..241bca182 100644 --- a/tex/context/base/mkiv/lpdf-fmt.lua +++ b/tex/context/base/mkiv/lpdf-fmt.lua @@ -733,17 +733,15 @@ function codeinjections.setformat(s) if not level then level = 3 -- good compromise, default anyway end - local pdf_version = spec.pdf_version * 10 - local inject_metadata = spec.inject_metadata - local majorversion = math.div(pdf_version,10) - local minorversion = math.mod(pdf_version,10) - local objectcompression = spec.object_compression and pdf_version >= 15 - local compresslevel = level or pdf.getcompresslevel() -- keep default - local objectcompresslevel = (objectcompression and (level or pdf.getobjcompresslevel())) or 0 - pdf.setcompresslevel (compresslevel) - pdf.setobjcompresslevel(objectcompresslevel) - pdf.setmajorversion (majorversion) - pdf.setminorversion (minorversion) + local pdf_version = spec.pdf_version * 10 + local inject_metadata = spec.inject_metadata + local majorversion = math.div(pdf_version,10) + local minorversion = math.mod(pdf_version,10) + local objectcompression = spec.object_compression and pdf_version >= 15 + local compresslevel = level or lpdf.compresslevel() -- keep default + local objectcompresslevel = (objectcompression and (level or lpdf.objectcompresslevel())) or 0 + lpdf.setcompression(compresslevel,objectcompresslevel) + lpdf.setversion(majorversion,minorversion) if objectcompression then report_backend("forcing pdf version %s.%s, compression level %s, object compression level %s", majorversion,minorversion,compresslevel,objectcompresslevel) @@ -754,9 +752,8 @@ function codeinjections.setformat(s) report_backend("forcing pdf version %s.%s, compression disabled", majorversion,minorversion) end - if pdf.setomitcidset then - pdf.setomitcidset(formatspecification.include_cidsets == false and 1 or 0) - end + -- + pdf.setomitcidset(formatspecification.include_cidsets == false and 1 or 0) -- -- context.setupcolors { -- not this way -- cmyk = spec.cmyk_colors and variables.yes or variables.no, @@ -806,8 +803,7 @@ function codeinjections.setformat(s) report_backend("error, format %a is not supported",format) end elseif level then - pdf.setcompresslevel(level) - pdf.setobjcompresslevel(level) + lpdf.setcompression(level,level) else -- we ignore this as we hook it in \everysetupbackend end diff --git a/tex/context/base/mkiv/lpdf-ini.lua b/tex/context/base/mkiv/lpdf-ini.lua index 520eb7783..1d59175ca 100644 --- a/tex/context/base/mkiv/lpdf-ini.lua +++ b/tex/context/base/mkiv/lpdf-ini.lua @@ -68,15 +68,9 @@ local context = context local pdf = pdf local factor = number.dimenfactors.bp -if not pdf.setmajorversion then do - - function pdf.setmajorversion () end - function pdf.getmajorversion () end - -end end - local pdfsetinfo = pdf.setinfo local pdfsetcatalog = pdf.setcatalog +----- pdfsettrailerid = pdf.settrailerid ----- pdfsetnames = pdf.setnames ----- pdfsettrailer = pdf.settrailer @@ -108,6 +102,8 @@ pdfdisablecommand("setpageattributes") pdfdisablecommand("setpagesattributes") pdfdisablecommand("registerannot") +pdf.disablecommand = pdfdisablecommand + 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) local trace_objects = false trackers.register("backend.objects", function(v) trace_objects = v end) @@ -125,6 +121,63 @@ backends.pdf = pdfbackend lpdf = lpdf or { } local lpdf = lpdf +do + + local setmajorversion = pdf.setmajorversion + local setminorversion = pdf.setminorversion + local getmajorversion = pdf.getmajorversion + local getminorversion = pdf.getminorversion + + if not setmajorversion then + + setmajorversion = function() end + getmajorversion = function() return 1 end + + pdf.setmajorversion = setmajorversion + pdf.getmajorversion = getmajorversion + + end + + function lpdf.setversion(major,minor) + setmajorversion(major or 1) + setminorversion(minor or 7) + end + + function lpdf.getversion(major,minor) + return getmajorversion(), getminorversion() + end + + lpdf.majorversion = getmajorversion + lpdf.minorversion = getminorversion + +end + +do + + local setcompresslevel = pdf.setcompresslevel + local setobjectcompresslevel = pdf.setobjcompresslevel + local getcompresslevel = pdf.getcompresslevel + local getobjectcompresslevel = pdf.getobjcompresslevel + + local frozen = false + + function lpdf.setcompression(level,objectlevel,freeze) + if not frozen then + setcompresslevel(level or 3) + setobjectcompresslevel(objectlevel or level or 3) + frozen = freeze + end + end + + function lpdf.getcompression() + return getcompresslevel(), getobjectcompresslevel() + end + + lpdf.compresslevel = getcompresslevel + lpdf.objectcompresslevel = getobjectcompresslevel + +end + local codeinjections = pdfbackend.codeinjections local nodeinjections = pdfbackend.nodeinjections @@ -619,9 +672,9 @@ function lpdf.reserveobject(name) return r end +-- lpdf.reserveobject = pdfreserveobject -- lpdf.immediateobject = pdfimmediateobject -- lpdf.deferredobject = pdfdeferredobject --- lpdf.object = pdfdeferredobject -- lpdf.referenceobject = pdfreferenceobject local pagereference = pdf.pageref -- tex.pdfpageref is obsolete @@ -892,6 +945,15 @@ do if not environment.initex then trace_flush("info") info.Type = nil + if lpdf.majorversion() > 1 then + for k, v in next, info do + if k == "CreationDate" or k == "ModDate" then + -- mandate >= 2.0 + else + info[k] = nil + end + end + end pdfsetinfo(info()) end end diff --git a/tex/context/base/mkiv/lpdf-mis.lua b/tex/context/base/mkiv/lpdf-mis.lua index 7eb4829f8..2b2fd81e3 100644 --- a/tex/context/base/mkiv/lpdf-mis.lua +++ b/tex/context/base/mkiv/lpdf-mis.lua @@ -42,6 +42,7 @@ local pdfstring = lpdf.string local pdfflushobject = lpdf.flushobject local pdfflushstreamobject = lpdf.flushstreamobject local pdfaction = lpdf.action +local pdfminorversion = lpdf.minorversion local formattedtimestamp = lpdf.pdftimestamp local adddocumentextgstate = lpdf.adddocumentextgstate @@ -448,7 +449,7 @@ local function documentspecification() }) end addtoinfo ("Trapped", pdfconstant("False")) -- '/Trapped' in /Info, 'Trapped' in XMP - addtocatalog("Version", pdfconstant(format("1.%s",pdf.getminorversion()))) + addtocatalog("Version", pdfconstant(format("1.%s",pdfminorversion()))) end -- temp hack: the mediabox is not under our control and has a precision of 5 digits diff --git a/tex/context/base/mkiv/lpdf-mov.lua b/tex/context/base/mkiv/lpdf-mov.lua index f28a47511..42ba6fb00 100644 --- a/tex/context/base/mkiv/lpdf-mov.lua +++ b/tex/context/base/mkiv/lpdf-mov.lua @@ -45,7 +45,7 @@ function nodeinjections.insertmovie(specification) end function nodeinjections.insertsound(specification) - -- rmanaged in interaction: repeat, label, foundname + -- managed in interaction: repeat, label, foundname local soundclip = interactions.soundclips.soundclip(specification.label) if soundclip then local controldict = pdfdictionary { diff --git a/tex/context/base/mkiv/lpdf-swf.lua b/tex/context/base/mkiv/lpdf-swf.lua index 751f9eab5..0ac107f8b 100644 --- a/tex/context/base/mkiv/lpdf-swf.lua +++ b/tex/context/base/mkiv/lpdf-swf.lua @@ -10,19 +10,21 @@ if not modules then modules = { } end modules ['lpdf-swf'] = { -- was using tex code. This is the official implementation. local format, gsub = string.format, string.gsub +local concat = table.concat -local backends = backends -local lpdf = lpdf -local context = context +local backends = backends +local lpdf = lpdf +local context = context -local pdfconstant = lpdf.constant -local pdfstring = lpdf.string -local pdfdictionary = lpdf.dictionary -local pdfarray = lpdf.array -local pdfreference = lpdf.reference -local pdfflushobject = lpdf.flushobject +local pdfconstant = lpdf.constant +local pdfstring = lpdf.string +local pdfdictionary = lpdf.dictionary +local pdfarray = lpdf.array +local pdfreference = lpdf.reference +local pdfflushobject = lpdf.flushobject +local pdfsharedobject = lpdf.shareobjectreference -local checkedkey = lpdf.checkedkey +local checkedkey = lpdf.checkedkey local codeinjections = backends.pdf.codeinjections local nodeinjections = backends.pdf.nodeinjections @@ -47,17 +49,18 @@ table.setmetatableindex(activations, function() return activations .click end) table.setmetatableindex(deactivations,function() return deactivations.focus end) local function insertswf(spec) - local width = spec.width local height = spec.height local filename = spec.foundname local resources = spec.resources local display = spec.display local controls = spec.controls + local arguments = spec.arguments local resources = resources and parametersets[resources] local display = display and parametersets[display] - local controls = controls and parametersets[controls] -- not yet used + local controls = controls and parametersets[controls] -- not yet used + local arguments = arguments and parametersets[arguments] -- not yet used local preview = checkedkey(display,"preview","string") local toolbar = checkedkey(display,"toolbar","boolean") @@ -65,13 +68,16 @@ local function insertswf(spec) local embeddedreference = codeinjections.embedfile { file = filename } local flash = pdfdictionary { - Subtype = pdfconstant("Flash"), + Subtype = pdfconstant("RichMediaConfiguration"), Instances = pdfarray { pdfdictionary { - Asset = embeddedreference, - Params = pdfdictionary { - Binding = pdfconstant("Background") -- Foreground makes swf behave erratic - } + Type = pdfconstant("RichMediaInstance"), + Asset = embeddedreference, + Subtype = pdfconstant("Flash"), -- 3D Sound Video ... somehow still Flash too + Params = pdfsharedobject(pdfdictionary { + Binding = pdfconstant("Background"), -- Foreground makes swf behave erratic + FlashVars = arguments and pdfstring(table.sequenced(arguments,"&")) or nil, + }), }, }, } @@ -100,7 +106,6 @@ local function insertswf(spec) local root = file.dirname(filename) local relativepaths = nil local paths = nil - if resources then local names = configuration.Assets.Names local prefix = false @@ -192,7 +197,8 @@ local function insertswf(spec) Playcount = 1, }, Presentation = pdfdictionary { - PassContextClick = false, + -- PassContextClick = false, + PassContextClick = true, Style = pdfconstant("Embedded"), Toolbar = toolbar, NavigationPane = false, @@ -296,6 +302,7 @@ function backends.pdf.nodeinjections.insertswf(spec) display = spec.display, controls = spec.controls, resources = spec.resources, + arguments = spec.arguments, -- factor = spec.factor, -- label = spec.label, } diff --git a/tex/context/base/mkiv/lpdf-tag.lua b/tex/context/base/mkiv/lpdf-tag.lua index 163e50b48..b9d3e3e64 100644 --- a/tex/context/base/mkiv/lpdf-tag.lua +++ b/tex/context/base/mkiv/lpdf-tag.lua @@ -150,9 +150,9 @@ local function finishstructure() addtocatalog("StructTreeRoot",pdfreference(structure_ref)) -- local markinfo = pdfdictionary { - Marked = pdfboolean(true), - -- UserProperties = pdfboolean(true), - -- Suspects = pdfboolean(true), + Marked = lpdf.majorversion == 1 and pdfboolean(true) or nil, + -- UserProperties = pdfboolean(true), -- maybe some day + -- Suspects = lpdf.majorversion == 1 and pdfboolean(true) or nil, -- AF = #embeddedfilelist > 0 and pdfreference(pdfflushobject(embeddedfilelist)) or nil, } addtocatalog("MarkInfo",pdfreference(pdfflushobject(markinfo))) diff --git a/tex/context/base/mkiv/lpdf-wid.lua b/tex/context/base/mkiv/lpdf-wid.lua index 64cf1c3dc..c2cd3bae1 100644 --- a/tex/context/base/mkiv/lpdf-wid.lua +++ b/tex/context/base/mkiv/lpdf-wid.lua @@ -6,6 +6,24 @@ if not modules then modules = { } end modules ['lpdf-wid'] = { license = "see context related readme files" } +-- It's about time to give up on media in pdf and admit that pdf lost it to html. +-- First we had movies and sound, quite easy to deal with, but obsolete now. Then we +-- had renditions but they turned out to be unreliable from the start and look +-- obsolete too or at least they are bound to the (obsolete) flash technology for +-- rendering. They were already complex constructs. Now we have rich media which +-- instead of providing a robust future proof framework fo rgeneral media types +-- again seems to depend on viewers built in (yes, also kind of obsolete) flash +-- technology, and we cannot expect this non-open technology to show up in open +-- browsers. So, in the end we can best just use links to external resources to be +-- future proof. Just look at the viewer prferences pane to see how fragile support +-- is. Interestingly u3d support is kind of built in, while e.g. mp4 support relies +-- on wrapping in swf. We used to stay ahead of the pack with support of the fancy +-- pdf features but it backfires and is not worth the trouble. And yes, for control +-- (even simple like starting and stopping videos) one has to revert to JavaScript, +-- the other fragile bit. And, now that adobe quits flash in 2020 we're without any +-- video anyway. Also, it won't play on all platforms and devices so let's wait for +-- html5 media in pdf then. + local tonumber = tonumber local gmatch, gsub, find, lower, format = string.gmatch, string.gsub, string.find, string.lower, string.format local stripstring = string.strip @@ -290,7 +308,8 @@ function codeinjections.embedfile(specification) local d = pdfdictionary { Type = pdfconstant("Filespec"), F = pdfstring(savename), - UF = pdfstring(savename), + -- UF = pdfstring(savename), + UF = pdfunicode(savename), EF = pdfdictionary { F = pdfreference(f) }, Desc = title ~= "" and pdfunicode(title) or nil, -- AFRelationship = pdfconstant("Source"), -- some day maybe, not mandate diff --git a/tex/context/base/mkiv/lpdf-xmp.lua b/tex/context/base/mkiv/lpdf-xmp.lua index a0005eb8a..2eb573acb 100644 --- a/tex/context/base/mkiv/lpdf-xmp.lua +++ b/tex/context/base/mkiv/lpdf-xmp.lua @@ -98,6 +98,10 @@ pdf.setsuppressoptionalinfo( local included = backends.included +local pdfsettrailerid = pdf.settrailerid + +pdf.disablecommand("settrailerid") + function lpdf.settrailerid(v) if v then local b = toboolean(v) or v == "" @@ -112,7 +116,7 @@ function lpdf.settrailerid(v) else report_info("using hashed trailer id %a (%a)",v,h) end - pdf.settrailerid(format("[<%s> <%s>]",h,h)) + pdfsettrailerid(format("[<%s> <%s>]",h,h)) end end @@ -296,7 +300,7 @@ local function flushxmpinfo() logs.poptarget() end blob = format(xpacket,blob) - if not verbose and pdf.getcompresslevel() > 0 then + if not verbose and lpdf.compresslevel() > 0 then blob = gsub(blob,">%s+<","><") end local r = pdfflushstreamobject(blob,md,false) -- uncompressed diff --git a/tex/context/base/mkiv/luat-ini.lua b/tex/context/base/mkiv/luat-ini.lua index 44d9e7fd5..83b7717a4 100644 --- a/tex/context/base/mkiv/luat-ini.lua +++ b/tex/context/base/mkiv/luat-ini.lua @@ -16,10 +16,10 @@ userdata = userdata or { } -- for users (e.g. functions etc) thirddata = thirddata or { } -- only for third party modules moduledata = moduledata or { } -- only for development team documentdata = documentdata or { } -- for users (e.g. raw data) -parametersets = parametersets or { } -- experimental for team +parametersets = parametersets or { } -- for special purposes -table.setmetatableindex(moduledata,table.autokey) -table.setmetatableindex(thirddata, table.autokey) +table.setmetatableindex(moduledata,"table") +table.setmetatableindex(thirddata, "table") if not global then global = _G diff --git a/tex/context/base/mkiv/math-def.mkiv b/tex/context/base/mkiv/math-def.mkiv index 097d70e1e..641f7411e 100644 --- a/tex/context/base/mkiv/math-def.mkiv +++ b/tex/context/base/mkiv/math-def.mkiv @@ -30,6 +30,9 @@ \definemathcommand [arccos] [nolop] {\mfunctionlabeltext{arccos}} \definemathcommand [arcsin] [nolop] {\mfunctionlabeltext{arcsin}} \definemathcommand [arctan] [nolop] {\mfunctionlabeltext{arctan}} +\definemathcommand [arccosh] [nolop] {\mfunctionlabeltext{arccosh}} +\definemathcommand [arcsinh] [nolop] {\mfunctionlabeltext{arcsinh}} +\definemathcommand [arctanh] [nolop] {\mfunctionlabeltext{arctanh}} \definemathcommand [acos] [nolop] {\mfunctionlabeltext{acos}} \definemathcommand [asin] [nolop] {\mfunctionlabeltext{asin}} \definemathcommand [atan] [nolop] {\mfunctionlabeltext{atan}} diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index 7482d08ec..b0826425f 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -413,6 +413,7 @@ return { "pdfliteral", "pdfmapfile", "pdfmapline", + "pdfmajorversion", "pdfminorversion", "pdfnames", "pdfnoligatures", @@ -811,4 +812,4 @@ return { ["xetex"]={ "XeTeXversion", }, -} \ No newline at end of file +} diff --git a/tex/context/base/mkiv/mult-prm.mkiv b/tex/context/base/mkiv/mult-prm.mkiv index fb71878d8..1b9195f41 100644 --- a/tex/context/base/mkiv/mult-prm.mkiv +++ b/tex/context/base/mkiv/mult-prm.mkiv @@ -54,7 +54,7 @@ "pdfinsertht", "pdflastannot", "pdflastlinedepth", "pdflastlink", "pdflastobj", "pdflastxform", "pdflastximage", "pdflastximagepages", "pdflastxpos", "pdflastypos", "pdflinkmargin", "pdfliteral", - "pdfmapfile", "pdfmapline", "pdfminorversion", "pdfnames", + "pdfmapfile", "pdfmapline", "pdfmajorversion", "pdfminorversion", "pdfnames", "pdfnoligatures", "pdfnormaldeviate", "pdfobj", "pdfobjcompresslevel", "pdfoutline", "pdfoutput", "pdfpageattr", "pdfpagebox", "pdfpageheight", "pdfpageref", "pdfpageresources", diff --git a/tex/context/base/mkiv/publ-ini.lua b/tex/context/base/mkiv/publ-ini.lua index e623a8d61..5ff701c37 100644 --- a/tex/context/base/mkiv/publ-ini.lua +++ b/tex/context/base/mkiv/publ-ini.lua @@ -107,7 +107,6 @@ local ctx_doifnot = commands.doifnot local ctx_gobbletwoarguments = context.gobbletwoarguments local ctx_btxhandlelistentry = context.btxhandlelistentry -local ctx_btxhandlelisttextentry = context.btxhandlelisttextentry local ctx_btxhandlecombientry = context.btxhandlecombientry local ctx_btxchecklistentry = context.btxchecklistentry @@ -2134,7 +2133,12 @@ do end end - function lists.flushentry(dataset,i,textmode) + function lists.flushtag(dataset,i) + local li = renderings[dataset].list[i] + ctx_btxsettag(li and li[1] or "") + end + + function lists.flushentry(dataset,i) local rendering = renderings[dataset] local list = rendering.list local li = list[i] @@ -2194,11 +2198,7 @@ do ctx_btxsetsuffix(authorsuffix) end rendering.userdata = userdata - if textmode then - ctx_btxhandlelisttextentry() - else - ctx_btxhandlelistentry() - end + ctx_btxhandlelistentry() ctx_btxstoplistentry() -- -- context(function() @@ -2287,6 +2287,12 @@ do arguments = { "string", "integer" } } + implement { + name = "btxflushlisttag", + actions = lists.flushtag, + arguments = { "string", "integer" } + } + implement { name = "btxflushlistcombi", actions = lists.flushcombi, diff --git a/tex/context/base/mkiv/publ-ini.mkiv b/tex/context/base/mkiv/publ-ini.mkiv index b3ddf722a..e029f0564 100644 --- a/tex/context/base/mkiv/publ-ini.mkiv +++ b/tex/context/base/mkiv/publ-ini.mkiv @@ -713,11 +713,12 @@ % \removeunwantedspaces % \endgroup} -\unexpanded\def\completebtxrendering{\dodoubleempty\publ_place_list_complete} \unexpanded\def\placebtxrendering {\dodoubleempty\publ_place_list_standard} +\unexpanded\def\completebtxrendering{\dodoubleempty\publ_place_list_complete} +\unexpanded\def\flushbtxrendering {\dodoubleempty\publ_place_list_special } -\let\completelistofpublications\completebtxrendering -\let\placelistofpublications \placebtxrendering +\let\completelistofpublications\completebtxrendering % for old times sake +\let\placelistofpublications \placebtxrendering % for old times sake \newtoks\everybtxlistrendering @@ -766,27 +767,27 @@ \let\btxdoifsameaspreviouselse \btxdoifelsesameasprevious \let\btxdoifcombiinlistelse \btxdoifelsecombiinlist -\def\publ_place_list_indeed#1[#2][#3]% +\def\publ_place_list_indeed#1#2[#3][#4]% {\begingroup \ifsecondargument % [rendering] [settings] - \edef\currentbtxrendering{#2}% - \setupcurrentbtxrendering[#3]% + \edef\currentbtxrendering{#3}% + \setupcurrentbtxrendering[#4]% \edef\p_specification{\btxrenderingparameter\c!specification}% \ifx\p_specification\empty\else \let\currentbtxspecification\p_specification \fi \else\iffirstargument - \doifelseassignment{#2} + \doifelseassignment{#3} {% [settings] \let\currentbtxrendering\currentbtxspecification - \setupcurrentbtxrendering[#2]% + \setupcurrentbtxrendering[#3]% \edef\p_specification{\btxrenderingparameter\c!specification}% \ifx\p_specification\empty\else \let\currentbtxspecification\p_specification \let\currentbtxrendering\currentbtxspecification % tricky \fi} - {\edef\currentbtxrendering{#2}% + {\edef\currentbtxrendering{#3}% \edef\p_specification{\btxrenderingparameter\c!specification}% \ifx\p_specification\empty\else \let\currentbtxspecification\p_specification @@ -807,13 +808,11 @@ \ifx\currentbtxrendering\empty \setbtxrendering % hm \fi - \btxrenderingparameter\c!before \edef\currentbtxdataset{\btxrenderingparameter\c!dataset}% \uselanguageparameter\btxdatasetparameter % new \setbtxlist \the\everystructurelist \the\everysetupbtxlistplacement - \forgetall % why not pass this with collect .. todo % here we just collect items \clf_btxcollectlistentries @@ -829,38 +828,132 @@ group {\btxrenderingparameter\c!group}% \relax \ifnum\nofbtxlistentries>\zerocount - \startpacked[\v!blank]% - % sorting and so - \clf_btxpreparelistentries{\currentbtxdataset}% could be put in collect - % next we analyze the width - \ifx\currentbtxnumbering\empty \else - \edef\p_width{\listparameter\c!width}% - \ifx\p_width\v!auto - \setbox\scratchbox\vbox \bgroup - \settrialtypesetting - \clf_btxfetchlistentries{\currentbtxdataset}% - \egroup - \d_publ_number_width\wd\scratchbox - \letlistparameter\c!width\d_publ_number_width + \forgetall + \btxrenderingparameter\c!before + \ifconditional#2\relax + \edef\p_command{\btxrenderingparameter\c!command}% + \ifx\p_command\empty + \edef\p_setups{\btxrenderingparameter\c!setups}% + \ifx\p_setups\empty + \else + \directsetup{\p_setups}% + \fi + \else + \expandafter\p_command\expandafter{\number\nofbtxlistentries}\relax + \fi + \else + \startpacked[\v!blank]% + % sorting and so + \clf_btxpreparelistentries{\currentbtxdataset}% could be put in collect + % next we analyze the width + \ifx\currentbtxnumbering\empty \else + \edef\p_width{\listparameter\c!width}% + \ifx\p_width\v!auto + \setbox\scratchbox\vbox \bgroup + \settrialtypesetting + \clf_btxfetchlistentries{\currentbtxdataset}% + \egroup + \d_publ_number_width\wd\scratchbox + \letlistparameter\c!width\d_publ_number_width + \fi \fi + \doifelse{\listparameter\c!prefix}\v!yes\settrue\setfalse\c_publ_prefixed + % this actually typesets them, we loop here as otherwise the whole + % bunch gets flushed at once + \dorecurse\nofbtxlistentries + {\let\currentbtxlistentry\recurselevel + \clf_btxflushlistentry{\currentbtxdataset}\currentbtxlistentry\relax}% + \stoppacked \fi - \doifelse{\listparameter\c!prefix}\v!yes\settrue\setfalse\c_publ_prefixed - % this actually typesets them, we loop here as otherwise the whole - % bunch gets flushed at once - \dorecurse\nofbtxlistentries - {\let\currentbtxlistentry\recurselevel - \clf_btxflushlistentry{\currentbtxdataset}\currentbtxlistentry\relax}% - \stoppacked + \btxrenderingparameter\c!after \fi - \btxrenderingparameter\c!after - \global\advance\btxblock\plusone \ifconditional#1\relax \stopnamedsection \fi + \global\advance\btxblock\plusone \endgroup} -\def\publ_place_list_complete{\publ_place_list_indeed\conditionaltrue} -\def\publ_place_list_standard{\publ_place_list_indeed\conditionalfalse} +\def\publ_place_list_standard{\publ_place_list_indeed\conditionalfalse\conditionalfalse} +\def\publ_place_list_complete{\publ_place_list_indeed\conditionaltrue \conditionalfalse} +\def\publ_place_list_special {\publ_place_list_indeed\conditionalfalse\conditionaltrue} + +%D This is somewhat special (for Alan of course): +%D +%D \starttyping +%D % #1 is number of entries +%D +%D \starttexdefinition unexpanded btx:for:alan:wrapper #1 +%D \bTABLE +%D % we can have a command or setups +%D \flushbtxentries[command=\texdefinition{btx:for:alan:content}] +%D \eTABLE +%D \stoptexdefinition +%D +%D % #1 is tag +%D +%D \starttexdefinition unexpanded btx:for:alan:content #1 +%D \bTR +%D \bTD +%D \btxsettag{#1} +%D \btxfield{name} +%D \eTD +%D \eTR +%D \stoptexdefinition +%D +%D % we can have a command or setups +%D +%D \flushbtxrendering [method=dataset,command=\texdefinition{btx:for:alan:wrapper}] +%D \stoptyping +%D +%D Because we want to be ungrouped we use a special loop construct. + +\unexpanded\def\btxsetlisttag#1% + {\clf_btxflushlisttag{\currentbtxdataset}#1\relax} + +\newcount\c_btx_list_index +\let\m_btx_list_action\empty + +\def\publ_flush_list_step_command + {\btxsetlisttag{\c_btx_list_index} + \expandafter\m_btx_list_action\expandafter{\currentbtxtag}% + \ifnum\c_btx_list_index<\nofbtxlistentries + \advance\c_btx_list_index\plusone + \expandafter\publ_flush_list_step_command + \else + \glet\m_btx_list_action\relax + \fi} + +\def\publ_flush_list_step_setup + {\btxsetlisttag{\c_btx_list_index} + \directsetup{\m_btx_list_action}% + \ifnum\c_btx_list_index<\nofbtxlistentries + \advance\c_btx_list_index\plusone + \expandafter\publ_flush_list_step_setup + \else + \glet\m_btx_list_action\relax + \fi} + +\unexpanded\def\flushbtxentries[#1]% + {\begingroup + \getdummyparameters[\c!command=,\c!setups=,#1]% + \xdef\m_btx_list_action{\dummyparameter\c!command}% + \ifx\m_btx_list_action\empty + \xdef\m_btx_list_action{\dummyparameter\c!setups}% + \ifx\m_btx_list_action\empty + \endgroup + \c_btx_list_index\zerocount + \else + \endgroup + \c_btx_list_index\plusone + \doubleexpandafter\publ_flush_list_step_command + \fi + \else + \endgroup + \c_btx_list_index\plusone + \expandafter\publ_flush_list_step_command + \fi} + +%D So far. \def\currentbtxblock{\number\btxblock} diff --git a/tex/context/base/mkiv/scrn-wid.lua b/tex/context/base/mkiv/scrn-wid.lua index 3ce904349..2ed5b52eb 100644 --- a/tex/context/base/mkiv/scrn-wid.lua +++ b/tex/context/base/mkiv/scrn-wid.lua @@ -6,6 +6,21 @@ if not modules then modules = { } end modules ['scrn-wid'] = { license = "see context related readme files" } +-- Support for interactive features is handled elsewhere. Now that is some mess! In +-- the early days one had media features like sound and movies that were easy to set +-- up. Then at some point renditions came around which were more work and somewhat +-- unreliable. Now, both mechanism are obsolete and replaced by rich media which is +-- a huge mess and has no real concept of what media are supported. There's flash +-- cq. shockwave (basically obsolete too), and for instance mp4 needs to be handled +-- by a swf player, and there's u3d which somehow has its own specification. One +-- would expect native support for video and audio to be en-par with browsers but +-- alas ... pdf has lost the battle with html here due to a few decades of +-- unstability and changing support. So far we could catch on and even were ahead +-- but I wonder if we should keep doing that. As we can't trust support for media we +-- can better not embed anything and just use a hyperlink to an external resource. No +-- sane person will create media rich pdf's as long as it's that unpredictable. Just +-- look at the specification and viewer preferences and decide. + interactions = interactions or { } local interactions = interactions @@ -223,7 +238,7 @@ function soundclips.insert(tag) end implement { - name = registersoundclip, + name = "registersoundclip", actions = soundclips.register, arguments = { { @@ -234,7 +249,7 @@ implement { } implement { - name = insertsoundclip, + name = "insertsoundclip", actions = soundclips.insert, arguments = { { diff --git a/tex/context/base/mkiv/scrn-wid.mkvi b/tex/context/base/mkiv/scrn-wid.mkvi index 5b575edfb..78c389a86 100644 --- a/tex/context/base/mkiv/scrn-wid.mkvi +++ b/tex/context/base/mkiv/scrn-wid.mkvi @@ -655,7 +655,8 @@ % \handlereferenceactions{\renderingwindowparameter\c!closepageaction}\dosetuprenderingclosepageaction \letrenderingwindowparameter\c!offset\v!overlay \inheritedrenderingwindowframed - {\vfill + {\vfilll + \dontleavehmode \clf_insertrenderingwindow label {\currentrendering}% width \d_scrn_rendering_width diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 1c2878919..a402e1936 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index 016e39a04..849fb1351 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkiv/util-sto.lua b/tex/context/base/mkiv/util-sto.lua index d21267d7a..bcd8c85a3 100644 --- a/tex/context/base/mkiv/util-sto.lua +++ b/tex/context/base/mkiv/util-sto.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['util-sto'] = { license = "see context related readme files" } -local setmetatable, getmetatable, type = setmetatable, getmetatable, type +local setmetatable, getmetatable, rawset, type = setmetatable, getmetatable, rawset, type utilities = utilities or { } utilities.storage = utilities.storage or { } @@ -172,3 +172,75 @@ function table.getmetatablekey(t,key,value) local m = getmetatable(t) return m and m[key] end + +-- Problem: we have no __next (which is ok as it would probably slow down lua) so +-- we cannot loop over the keys. + +-- local parametersets = table.autokeys() +-- +-- parametersets.foo.bar = function(t,k) return "OEPS" end +-- parametersets.foo.foo = "SPEO" +-- parametersets.crap = { a = "a", b = table.autokey { function() return "b" end } } +-- +-- print(parametersets.foo.bar) +-- print(parametersets.foo.foo) +-- print(parametersets.crap.b) +-- print(parametersets.crap.b[1]) + +-- function table.autotables(t) +-- local t = t or { } +-- local m = getmetatable(t) +-- if not m then +-- m = { } +-- setmetatable(t,m) +-- end +-- m.__newindex = function(t,k,p) +-- local v = { } +-- local m = { +-- __index = function(t,k) +-- local v = p[k] +-- if type(v) == "function" then +-- return v(t,k) -- so we can have multiple arguments +-- else +-- return v +-- end +-- end, +-- __newindex = function(t,k,v) +-- p[k] = v +-- end, +-- __len = function(t) +-- return #p +-- end, +-- } +-- setmetatable(v,m) +-- rawset(t,k,v) +-- return v +-- end +-- m.__index = function(t,k) +-- local v = { } +-- t[k] = v -- calls newindex +-- return v +-- end +-- return t +-- end +-- +-- function table.autokeys(p) +-- local t = { } +-- setmetatable(t, { +-- __newindex = function(t,k,v) +-- p[k] = v +-- end, +-- __index = function(t,k) +-- local v = p[k] +-- if type(v) == "function" then +-- return v(t,k) -- so we can have multiple arguments +-- else +-- return v +-- end +-- end, +-- __len = function(t) +-- return #p +-- end, +-- }) +-- return t +-- end diff --git a/tex/context/base/mkiv/util-tab.lua b/tex/context/base/mkiv/util-tab.lua index 05038f2fb..ebe51eb1a 100644 --- a/tex/context/base/mkiv/util-tab.lua +++ b/tex/context/base/mkiv/util-tab.lua @@ -478,11 +478,11 @@ end -- inspect(table.drop({ { a=2 }, {a=3} })) -- inspect(table.drop({ { a=2 }, {a=3} },true)) -function table.autokey(t,k) - local v = { } - t[k] = v - return v -end +-- function table.autokey(t,k) -- replaced +-- local v = { } +-- t[k] = v +-- return v +-- end local selfmapper = { __index = function(t,k) t[k] = k return k end } -- cgit v1.2.3