diff options
Diffstat (limited to 'tex')
29 files changed, 217 insertions, 81 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 5cab6d540..c0f77fb71 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.04.21 11:36} +\newcontextversion{2021.04.26 00:51} %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 e35c6a5ae..693531af4 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.04.21 11:36} +\edef\contextversion{2021.04.26 00:51} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-ro.mkii b/tex/context/base/mkii/mult-ro.mkii index e497b8d6b..742934cea 100644 --- a/tex/context/base/mkii/mult-ro.mkii +++ b/tex/context/base/mkii/mult-ro.mkii @@ -761,6 +761,7 @@ \setinterfaceconstant{coupling}{cuplare} \setinterfaceconstant{couplingway}{modcuplare} \setinterfaceconstant{criterium}{criteriu} +\setinterfaceconstant{crop}{crop} \setinterfaceconstant{cropoffset}{cropoffset} \setinterfaceconstant{crossreference}{crossreference} \setinterfaceconstant{cssfile}{cssfile} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 2b07e8d4b..223405dc1 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.04.21 11:36} +\newcontextversion{2021.04.26 00:51} %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 91d7c5640..c44775e59 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.04.21 11:36} +\edef\contextversion{2021.04.26 00:51} %D Kind of special: diff --git a/tex/context/base/mkiv/font-ini.mkvi b/tex/context/base/mkiv/font-ini.mkvi index 271a81c2a..ccd034106 100644 --- a/tex/context/base/mkiv/font-ini.mkvi +++ b/tex/context/base/mkiv/font-ini.mkvi @@ -2852,4 +2852,10 @@ \unexpanded\def\usefontpath[#1]% {\clf_addfontpath{#1}} +%D NO select discs: + +\ifdefined\discretionaryligaturemode + \discretionaryligaturemode\plusone +\fi + \protect \endinput diff --git a/tex/context/base/mkiv/grph-con.lua b/tex/context/base/mkiv/grph-con.lua index b3d39f0bd..fdae2223b 100644 --- a/tex/context/base/mkiv/grph-con.lua +++ b/tex/context/base/mkiv/grph-con.lua @@ -29,6 +29,7 @@ local variables = interfaces.variables local v_high = variables.high local v_low = variables.low local v_medium = variables.medium +local v_yes = variables.yes local figures = figures @@ -48,6 +49,10 @@ do -- eps | ps local epsconverter = converters.eps converters.ps = epsconverter + local function gscrop(specification) + return (specification and specification.crop == v_yes) and "-dEPSCrop" or "" + end + local resolutions = { [v_low] = "screen", [v_medium] = "ebook", @@ -68,7 +73,7 @@ do -- eps | ps -dBATCH -dAutoRotatePages=/None -dPDFSETTINGS=/%presets% - -dEPSCrop + %crop% -dCompatibilityLevel=%level% -sOutputFile=%newname% %colorspace% @@ -81,6 +86,7 @@ do -- eps | ps presets = "string", level = "string", colorspace = "string", + -- crop = "string", }, } @@ -119,7 +125,7 @@ do -- eps | ps return tmpname end - function epsconverter.pdf(oldname,newname,resolution,colorspace) -- the resolution interface might change + function epsconverter.pdf(oldname,newname,resolution,colorspace,specification) -- the resolution interface might change local presets = resolutions[resolution or "high"] or resolutions.high local level = codeinjections.getformatoption("pdf_level") or "1.3" local tmpname = oldname @@ -141,13 +147,14 @@ do -- eps | ps presets = presets, level = tostring(level), colorspace = colorspace, + crop = gscrop(specification), } if tmpname ~= oldname then os.remove(tmpname) end end - epsconverter["gray.pdf"] = function(oldname,newname,resolution) -- the resolution interface might change + epsconverter["gray.pdf"] = function(oldname,newname,resolution,_,specification) -- the resolution interface might change epsconverter.pdf(oldname,newname,resolution,"gray") end @@ -211,11 +218,16 @@ do -- svg return new and "filename" or suffix end + local function inkscapecrop(specification) + return (specification and specification.crop == v_yes) and "--export-area-drawing" or "" + end + local runner = sandbox.registerrunner { name = "svg to something", program = "inkscape", template = longtostring [[ %oldname% + %crop% --export-dpi=%resolution% --export-%format%=%newname% ]], @@ -226,7 +238,7 @@ do -- svg resolution = "string", }, defaults = { - format = format, + format = "pdf", resolution = "600", } } @@ -235,10 +247,11 @@ do -- svg runner = runner, } - function svgconverter.pdf(oldname,newname) + function svgconverter.pdf(oldname,newname,resolution,arguments,specification) runner { format = inkscapeformat("pdf"), resolution = "600", + crop = inkscapecrop(specification), newname = expandfilename(newname), oldname = expandfilename(oldname), } @@ -248,6 +261,7 @@ do -- svg runner { format = inkscapeformat("png"), resolution = "600", + crop = inkscapecrop(specification), newname = expandfilename(newname), oldname = expandfilename(oldname), } diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua index 6fdf74c08..d4e382a21 100644 --- a/tex/context/base/mkiv/grph-inc.lua +++ b/tex/context/base/mkiv/grph-inc.lua @@ -587,6 +587,7 @@ local function new() -- we could use metatables status -> used -> request but it controls = false, display = false, mask = false, + crop = false, conversion = false, resolution = false, color = false, @@ -766,18 +767,20 @@ local function register(askedname,specification) local conversion = wipe(specification.conversion) local resolution = wipe(specification.resolution) local arguments = wipe(specification.arguments) + local crop = wipe(specification.crop) local newformat = conversion if not newformat or newformat == "" then newformat = defaultformat end if trace_conversion then - report_inclusion("checking conversion of %a, fullname %a, old format %a, new format %a, conversion %a, resolution %a, arguments %a", + report_inclusion("checking conversion of %a, fullname %a, old format %a, new format %a, conversion %a, resolution %a, crop %a, arguments %a", askedname, specification.fullname, format, newformat, conversion or "default", resolution or "default", + crop or "default", arguments or "" ) end @@ -793,7 +796,7 @@ local function register(askedname,specification) end end -- end of quick hack - local converter = (not remapper) and (newformat ~= format or resolution or arguments) and converters[format] + local converter = (not remapper) and (newformat ~= format or resolution or arguments) and converters[format] -- no crop here if converter then local okay = converter[newformat] if okay then @@ -853,6 +856,10 @@ local function register(askedname,specification) if arguments then hash = hash .. "[a:" .. arguments .. "]" end + if crop then + hash = hash .. "[c:" .. crop .. "]" + end + newbase = gsub(newbase,"%.","_") -- nicer to have no suffix in the name if hash ~= "" then newbase = newbase .. "_" .. md5.hex(hash) end @@ -877,7 +884,7 @@ local function register(askedname,specification) if trace_conversion then report_inclusion("converting %a (%a) from %a to %a",askedname,oldname,format,newformat) end - converter(oldname,newname,resolution or "", arguments or "") + converter(oldname,newname,resolution or "", arguments or "",specification) -- in retrospect a table else if trace_conversion then report_inclusion("no need to convert %a (%a) from %a to %a",askedname,oldname,format,newformat) @@ -971,10 +978,12 @@ local function locate(request) -- name, format, cache local askedconversion = request.conversion local askedresolution = request.resolution local askedarguments = request.arguments + local askedcrop = request.crop local askedhash = f_hash_part( askedname, askedconversion or "default", askedresolution or "default", + askedcrop or "default", askedarguments or "" ) local foundname = figures_found[askedhash] @@ -1029,6 +1038,7 @@ local function locate(request) -- name, format, cache cache = askedcache, conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments, }) end @@ -1066,6 +1076,7 @@ local function locate(request) -- name, format, cache conversion = askedconversion, resolution = askedresolution, arguments = askedarguments, + crop = askedcrop, internal = internal, }) elseif quitscanning then @@ -1086,6 +1097,7 @@ local function locate(request) -- name, format, cache cache = askedcache, conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments, }) end @@ -1105,6 +1117,7 @@ local function locate(request) -- name, format, cache cache = askedcache, conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments, }) end @@ -1119,6 +1132,7 @@ local function locate(request) -- name, format, cache cache = askedcache, conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments, }) end @@ -1143,6 +1157,7 @@ local function locate(request) -- name, format, cache cache = askedcache, conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments, }) end @@ -1178,6 +1193,7 @@ local function locate(request) -- name, format, cache cache = askedcache, conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments }) end @@ -1206,6 +1222,7 @@ local function locate(request) -- name, format, cache cache = askedcache, conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments, }) end @@ -1231,6 +1248,7 @@ local function locate(request) -- name, format, cache cache = askedcache, conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments, }) end @@ -1241,6 +1259,7 @@ local function locate(request) -- name, format, cache return register(askedname, { -- these two are needed for hashing 'found' conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments, }) end @@ -1455,6 +1474,7 @@ function checkers.generic(data) local size = dr.size or "crop" local color = dr.color or "natural" local mask = dr.mask or "none" + local crop = dr.crop or "none" local conversion = dr.conversion local resolution = dr.resolution local arguments = dr.arguments @@ -1476,6 +1496,7 @@ function checkers.generic(data) size, color, mask, + crop, conversion, resolution, arguments @@ -2071,6 +2092,7 @@ implement { { "preview" }, { "display" }, { "mask" }, + { "crop" }, { "conversion" }, { "resolution" }, { "color" }, diff --git a/tex/context/base/mkiv/grph-inc.mkiv b/tex/context/base/mkiv/grph-inc.mkiv index 0b8065989..05d4c3a57 100644 --- a/tex/context/base/mkiv/grph-inc.mkiv +++ b/tex/context/base/mkiv/grph-inc.mkiv @@ -111,6 +111,7 @@ \c!ownerpassword =, \c!compact =, \c!cmyk =, + \c!crop =\v!yes, ] %D Defining figures. @@ -370,6 +371,7 @@ compact {\externalfigureparameter\c!compact}% experiment, share fonts userpassword {\externalfigureparameter\c!userpassword}% ownerpassword{\externalfigureparameter\c!ownerpassword}% + crop {\externalfigureparameter\c!crop}% \ifx\p_width\empty \else width \dimexpr\p_width\relax \fi diff --git a/tex/context/base/mkiv/luat-lib.mkiv b/tex/context/base/mkiv/luat-lib.mkiv index 6dbcdaf54..f6bab870b 100644 --- a/tex/context/base/mkiv/luat-lib.mkiv +++ b/tex/context/base/mkiv/luat-lib.mkiv @@ -85,6 +85,8 @@ \registerctxluafile{luat-mac}{} %registerctxluafile{luat-prp}{} % for the moment of not much use +\registerctxluafile{util-lib}{} + \registerctxluafile{lxml-tab}{} \registerctxluafile{lxml-lpt}{} \registerctxluafile{lxml-xml}{} diff --git a/tex/context/base/mkiv/m-fonts-plugins.mkiv b/tex/context/base/mkiv/m-fonts-plugins.mkiv index ec1c05e7a..a2b06fb8c 100644 --- a/tex/context/base/mkiv/m-fonts-plugins.mkiv +++ b/tex/context/base/mkiv/m-fonts-plugins.mkiv @@ -15,10 +15,13 @@ %D Eigner at an NTG meeting, then left it for a while, and sort of finalized it the %D last quarter of 2016. As I don't use this module, apart from maybe testing %D something, it is not guaranteed to work (but fixing should be a no real problem -%D as I expect apis to be stable). Plugins liek this can interfere with other +%D as I expect apis to be stable). Plugins like this can interfere with other %D functionality in \CONTEXT\ so don't expect too much support. The two modules %D mentioned below should work in the generic loader too. It's anyhow an %D illustration of how \type {ffi} be used in a practical application. +%D +%D I'm not sure if Idris will ever need this but the code has been used for some +%D articles so that's why it's eventually shipped. % \enabletrackers[resolvers.ffilib] diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua index 0f2ef419c..6168da413 100644 --- a/tex/context/base/mkiv/mult-def.lua +++ b/tex/context/base/mkiv/mult-def.lua @@ -8264,6 +8264,10 @@ return { ["pe"]="criterium", ["ro"]="criteriu", }, + ["crop"]={ + ["en"]="crop", + ["fr"]="recadre", + }, ["cropoffset"]={ ["en"]="cropoffset", ["fr"]="decalagerecadre", diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index 855b4bc1f..710934ae6 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -84,6 +84,7 @@ return { "Uleft", "Umathaccent", "Umathaccentbaseheight", + "Umathaccentvariant", "Umathaxis", "Umathbinbinspacing", "Umathbinclosespacing", @@ -93,6 +94,7 @@ return { "Umathbinordspacing", "Umathbinpunctspacing", "Umathbinrelspacing", + "Umathbotaccentvariant", "Umathchar", "Umathcharclass", "Umathchardef", @@ -112,12 +114,18 @@ return { "Umathcode", "Umathcodenum", "Umathconnectoroverlapmin", + "Umathdegreevariant", + "Umathdelimiterovervariant", + "Umathdelimiterundervariant", + "Umathdenominatorvariant", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", + "Umathfractionvariant", + "Umathhextensiblevariant", "Umathinnerbinspacing", "Umathinnerclosespacing", "Umathinnerinnerspacing", @@ -134,6 +142,7 @@ return { "Umathlimitbelowvgap", "Umathnolimitsubfactor", "Umathnolimitsupfactor", + "Umathnumeratorvariant", "Umathopbinspacing", "Umathopclosespacing", "Umathopenbinspacing", @@ -163,7 +172,10 @@ return { "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", + "Umathoverdelimitervariant", "Umathoverdelimitervgap", + "Umathoverlayaccentvariant", + "Umathoverlinevariant", "Umathpunctbinspacing", "Umathpunctclosespacing", "Umathpunctinnerspacing", @@ -178,6 +190,7 @@ return { "Umathradicaldegreeraise", "Umathradicalkern", "Umathradicalrule", + "Umathradicalvariant", "Umathradicalvgap", "Umathrelbinspacing", "Umathrelclosespacing", @@ -194,21 +207,27 @@ return { "Umathspacingmode", "Umathstackdenomdown", "Umathstacknumup", + "Umathstackvariant", "Umathstackvgap", + "Umathsubscriptvariant", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", + "Umathsuperscriptvariant", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", + "Umathtopaccentvariant", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", + "Umathunderdelimitervariant", "Umathunderdelimitervgap", + "Umathunderlinevariant", "Umiddle", "Unosubprescript", "Unosubscript", diff --git a/tex/context/base/mkiv/spac-chr.lua b/tex/context/base/mkiv/spac-chr.lua index fa6eb18a5..7ec3e3cc4 100644 --- a/tex/context/base/mkiv/spac-chr.lua +++ b/tex/context/base/mkiv/spac-chr.lua @@ -130,7 +130,7 @@ end local function nbsp(head,current) local para = fontparameters[getfont(current)] local attr = getattr(current,a_alignstate) or 0 - if attr >= 1 or attr <= 3 then -- flushright + if attr >= 1 and attr <= 3 then -- flushright head, current = inject_nobreak_space(0x00A0,head,current,para.space,0,0) else head, current = inject_nobreak_space(0x00A0,head,current,para.space,para.spacestretch,para.spaceshrink) diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex af4f3802f..18d4edc32 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 1ddade41c..c7c27b61c 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/tabl-xtb.mkvi b/tex/context/base/mkiv/tabl-xtb.mkvi index c5042a405..3f3ef4be3 100644 --- a/tex/context/base/mkiv/tabl-xtb.mkvi +++ b/tex/context/base/mkiv/tabl-xtb.mkvi @@ -392,11 +392,24 @@ % in text flow: headers and footers get repeated -\setvalue{\??xtableflushsplit\v!repeat}% +% \setvalue{\??xtableflushsplit\v!repeat}% +% {\doloop +% {\clf_x_table_flush +% method {\v!split}% +% height \ifdim\pagegoal=\maxdimen\textheight\else\pagegoal\fi +% \relax +% \ifcase\c_tabl_x_state +% \exitloop +% \else +% \page +% \fi}} + +\defcsname\??xtableflushsplit\v!repeat\endcsname {\doloop - {\clf_x_table_flush + {\testpage[5]% for now hard coded, just as the \lineheight below, see mail end of april 2021 + \clf_x_table_flush method {\v!split}% - height \ifdim\pagegoal=\maxdimen\textheight\else\pagegoal\fi + height \ifdim\pagegoal=\maxdimen\textheight\else\dimexpr\pagegoal-\pagetotal-\lineheight\relax\fi \relax \ifcase\c_tabl_x_state \exitloop diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index b48a3b801..9fb153df4 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.04.21 11:36} +\newcontextversion{2021.04.26 00:51} %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 d8475d81f..210b1b25c 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.04.21 11:36} +\immutable\edef\contextversion{2021.04.26 00:51} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt index 6188f8a24..cd117f326 100644 --- a/tex/context/base/mkxl/driv-shp.lmt +++ b/tex/context/base/mkxl/driv-shp.lmt @@ -676,20 +676,20 @@ local hlist_out, vlist_out do if subtype == gleaders_code then local save_h = cur_h if pos_r == righttoleft_code then - cur_h = ref_h - shipbox_h - cur_h - cur_h = width * (cur_h / width) + cur_h = ref_h - shipbox_h + cur_h + cur_h = width * (cur_h // width) cur_h = ref_h - shipbox_h - cur_h else - cur_h = cur_h + ref_h - shipbox_h - cur_h = width * (cur_h / width) - cur_h = cur_h - ref_h - shipbox_h + cur_h = ref_h - shipbox_h - cur_h + cur_h = width * (cur_h // width) + cur_h = ref_h - shipbox_h - cur_h end if cur_h < save_h then cur_h = cur_h + width end elseif subtype == leaders_code then local save_h = cur_h - cur_h = width * (cur_h / width) + cur_h = width * (cur_h // width) if cur_h < save_h then cur_h = cur_h + width end @@ -697,10 +697,10 @@ local hlist_out, vlist_out do lq = gluewidth / width lr = gluewidth % width if subtype == cleaders_code then - cur_h = cur_h + lr / 2 + cur_h = cur_h + lr // 2 else - lx = lr / (lq + 1) - cur_h = cur_h + (lr - (lq - 1) * lx) / 2 + lx = lr // (lq + 1) + cur_h = cur_h + (lr - (lq - 1) * lx) // 2 end end local shift = getshift(leader) @@ -1000,14 +1000,14 @@ local hlist_out, vlist_out do if subtype == gleaders_code then save_v = cur_v cur_v = ref_v - shipbox_v - cur_v - cur_v = total * (cur_v / total) + cur_v = total * (cur_v // total) cur_v = ref_v - shipbox_v - cur_v if cur_v < save_v then cur_v = cur_v + total end elseif subtype == leaders_code then -- aleader save_v = cur_v - cur_v = top_edge + total * ((cur_v - top_edge) / total) + cur_v = top_edge + total * ((cur_v - top_edge) // total) if cur_v < save_v then cur_v = cur_v + total end @@ -1015,10 +1015,10 @@ local hlist_out, vlist_out do lq = glueheight / total lr = glueheight % total if subtype == cleaders_code then - cur_v = cur_v + lr / 2 + cur_v = cur_v + lr // 2 else - ly = lr / (lq + 1) - cur_v = cur_v + (lr - (lq - 1) * ly) / 2 + ly = lr // (lq + 1) + cur_v = cur_v + (lr - (lq - 1) * ly) // 2 end end local shift = getshift(leader) diff --git a/tex/context/base/mkxl/grph-inc.lmt b/tex/context/base/mkxl/grph-inc.lmt index 2066b31b0..f644e9b5b 100644 --- a/tex/context/base/mkxl/grph-inc.lmt +++ b/tex/context/base/mkxl/grph-inc.lmt @@ -587,6 +587,7 @@ local function new() -- we could use metatables status -> used -> request but it controls = false, display = false, mask = false, + crop = false, conversion = false, resolution = false, color = false, @@ -766,18 +767,20 @@ local function register(askedname,specification) local conversion = wipe(specification.conversion) local resolution = wipe(specification.resolution) local arguments = wipe(specification.arguments) + local crop = wipe(specification.crop) local newformat = conversion if not newformat or newformat == "" then newformat = defaultformat end if trace_conversion then - report_inclusion("checking conversion of %a, fullname %a, old format %a, new format %a, conversion %a, resolution %a, arguments %a", + report_inclusion("checking conversion of %a, fullname %a, old format %a, new format %a, conversion %a, resolution %a, crop %a, arguments %a", askedname, specification.fullname, format, newformat, conversion or "default", resolution or "default", + crop or "default", arguments or "" ) end @@ -793,7 +796,7 @@ local function register(askedname,specification) end end -- end of quick hack - local converter = (not remapper) and (newformat ~= format or resolution or arguments) and converters[format] + local converter = (not remapper) and (newformat ~= format or resolution or arguments) and converters[format] -- no crop here if converter then local okay = converter[newformat] if okay then @@ -853,6 +856,10 @@ local function register(askedname,specification) if arguments then hash = hash .. "[a:" .. arguments .. "]" end + if crop then + hash = hash .. "[c:" .. crop .. "]" + end + newbase = gsub(newbase,"%.","_") -- nicer to have no suffix in the name if hash ~= "" then newbase = newbase .. "_" .. md5.hex(hash) end @@ -877,7 +884,7 @@ local function register(askedname,specification) if trace_conversion then report_inclusion("converting %a (%a) from %a to %a",askedname,oldname,format,newformat) end - converter(oldname,newname,resolution or "", arguments or "") + converter(oldname,newname,resolution or "", arguments or "",specification) -- in retrospect a table else if trace_conversion then report_inclusion("no need to convert %a (%a) from %a to %a",askedname,oldname,format,newformat) @@ -971,13 +978,15 @@ local function locate(request) -- name, format, cache local askedconversion = request.conversion local askedresolution = request.resolution local askedarguments = request.arguments + local askedcrop = request.crop local askedhash = f_hash_part( askedname, askedconversion or "default", askedresolution or "default", + askedcrop or "default", askedarguments or "" ) - local foundname = figures_found[askedhash] + local foundname = figures_found[askedhash] if foundname then return foundname end @@ -1029,6 +1038,7 @@ local function locate(request) -- name, format, cache cache = askedcache, conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments, }) end @@ -1066,6 +1076,7 @@ local function locate(request) -- name, format, cache conversion = askedconversion, resolution = askedresolution, arguments = askedarguments, + crop = askedcrop, internal = internal, }) elseif quitscanning then @@ -1086,6 +1097,7 @@ local function locate(request) -- name, format, cache cache = askedcache, conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments, }) end @@ -1105,6 +1117,7 @@ local function locate(request) -- name, format, cache cache = askedcache, conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments, }) end @@ -1119,6 +1132,7 @@ local function locate(request) -- name, format, cache cache = askedcache, conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments, }) end @@ -1143,6 +1157,7 @@ local function locate(request) -- name, format, cache cache = askedcache, conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments, }) end @@ -1178,6 +1193,7 @@ local function locate(request) -- name, format, cache cache = askedcache, conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments }) end @@ -1206,6 +1222,7 @@ local function locate(request) -- name, format, cache cache = askedcache, conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments, }) end @@ -1231,6 +1248,7 @@ local function locate(request) -- name, format, cache cache = askedcache, conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments, }) end @@ -1241,6 +1259,7 @@ local function locate(request) -- name, format, cache return register(askedname, { -- these two are needed for hashing 'found' conversion = askedconversion, resolution = askedresolution, + crop = askedcrop, arguments = askedarguments, }) end @@ -1448,13 +1467,14 @@ end local pagecount = { } -function checkers.generic(data) +function checkers.generic(data) -- called by checkers.pdf/png/jpg local dr, du, ds = data.request, data.used, data.status local name = du.fullname or "unknown generic" local page = du.page or dr.page local size = dr.size or "crop" local color = dr.color or "natural" local mask = dr.mask or "none" + local crop = dr.crop or "none" local conversion = dr.conversion local resolution = dr.resolution local arguments = dr.arguments @@ -1476,6 +1496,7 @@ function checkers.generic(data) size, color, mask, + crop, conversion, resolution, arguments @@ -2071,6 +2092,7 @@ implement { { "preview" }, { "display" }, { "mask" }, + { "crop" }, { "conversion" }, { "resolution" }, { "color" }, diff --git a/tex/context/base/mkxl/grph-inc.mkxl b/tex/context/base/mkxl/grph-inc.mkxl index 85f0af73e..ace3e581d 100644 --- a/tex/context/base/mkxl/grph-inc.mkxl +++ b/tex/context/base/mkxl/grph-inc.mkxl @@ -114,6 +114,7 @@ \c!ownerpassword =, \c!compact =, \c!cmyk =, + \c!crop =\v!yes, ] %D Defining figures. @@ -332,6 +333,7 @@ compact {\externalfigureparameter\c!compact}% experiment, share fonts userpassword {\externalfigureparameter\c!userpassword}% ownerpassword{\externalfigureparameter\c!ownerpassword}% + crop {\externalfigureparameter\c!crop}% \ifempty\p_width \else width \dimexpr\p_width\relax \fi diff --git a/tex/context/base/mkxl/libs-imp-curl.lmt b/tex/context/base/mkxl/libs-imp-curl.lmt index b30739794..05b2b8f48 100644 --- a/tex/context/base/mkxl/libs-imp-curl.lmt +++ b/tex/context/base/mkxl/libs-imp-curl.lmt @@ -278,6 +278,8 @@ local function fetch(options) else report("invalid argument") end + else + report("no curl library loaded") end end diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt index 1861cbc49..b7db8e50d 100644 --- a/tex/context/base/mkxl/lpdf-lmt.lmt +++ b/tex/context/base/mkxl/lpdf-lmt.lmt @@ -105,7 +105,7 @@ local trace_details = false trackers.register("backend.details", function(v) t local function compressdata(data,size) local guess = ((size // 4096) + 1) * 2048 - local comp = zlibcompresssize(data,3,guess) + local comp = zlibcompresssize(data,guess,3) -- if comp then -- report() -- report("size %i, guess %i, result %i => %s / %s",size,guess,#comp,guess>=#comp and "hit" or "miss") @@ -114,6 +114,10 @@ local function compressdata(data,size) return comp end +-- local function compressdata(data,size) +-- return zlibcompress(data,3) +-- end + -- we collect them: local flushers = { } @@ -2016,7 +2020,6 @@ local addtocache, flushcache, cache do list = concat(list," ") data[0] = list data = concat(data,"\010",0,d) - local size = #data local strobj = pdfdictionary { Type = p_ObjStm, N = d, @@ -2025,7 +2028,7 @@ local addtocache, flushcache, cache do objects[cache] = offset local fb if compress then --- local comp = zlibcompress(data,3) + local size = #data local comp = compressdata(data,size) if comp and #comp < size then data = comp @@ -2036,12 +2039,13 @@ local addtocache, flushcache, cache do else fb = f_stream_b_d_u end - local b = fb(cache,strobj(),size) + local s = #data + local b = fb(cache,strobj(),s) local e = s_stream_e flush(f,b) flush(f,data) flush(f,e) - offset = offset + #b + #data + #e + offset = offset + #b + s + #e data, d = { }, 0 list, l = { }, 0 coffset = 0 @@ -2271,46 +2275,51 @@ local function flushstreamobj(data,n,dict,comp,nolength) local e = s_stream_e if nolength then b = f_stream_b_d_r(n,dict) - elseif comp ~= false and compress and size > threshold then --- local compdata = zlibcompress(data,3) - local compdata = compressdata(data,size) - if compdata then - local compsize = #compdata - if compsize > size - threshold then - b = dict and f_stream_b_d_u(n,dict,size) or f_stream_b_n_u(n,size) - else - data = compdata - b = dict and f_stream_b_d_c(n,dict,compsize) or f_stream_b_n_c(n,compsize) + else + local done = false + if comp ~= false and compress and size > threshold then + local compdata = compressdata(data,size) + if compdata then + local compsize = #compdata + if compsize <= size - threshold then + data = compdata + size = compsize + done = true + end end + end + if done then + b = dict and f_stream_b_d_c(n,dict,size) or f_stream_b_n_c(n,size) else - b = dict and f_stream_b_d_u(n,dict,size) or f_stream_b_n_u(n,size) + b = dict and f_stream_b_d_u(n,dict,size) or f_stream_b_d_r(n,size) end - else - b = dict and f_stream_b_d_u(n,dict,size) or f_stream_b_n_u(n,size) end flush(f,b) flush(f,data) flush(f,e) objects[n] = offset - offset = offset + #b + #data + #e + offset = offset + #b + size + #e else if nolength then data = f_stream_d_r(n,dict,data) - elseif comp ~= false and compress and size > threshold then --- local compdata = zlibcompress(data,3) - local compdata = compressdata(data,size) - if compdata then - local compsize = #compdata - if compsize > size - threshold then - data = dict and f_stream_d_u(n,dict,size,data) or f_stream_n_u(n,size,data) - else - data = dict and f_stream_d_c(n,dict,compsize,compdata) or f_stream_n_c(n,compsize,compdata) + else + local done = false + if comp ~= false and compress and size > threshold then + local compdata = compressdata(data,size) + if compdata then + local compsize = #compdata + if compsize <= size - threshold then + data = compdata + size = compsize + done = true + end end + end + if done then + data = dict and f_stream_d_c(n,dict,size,data) or f_stream_n_c(n,size,data) else data = dict and f_stream_d_u(n,dict,size,data) or f_stream_n_u(n,size,data) end - else - data = dict and f_stream_d_u(n,dict,size,data) or f_stream_n_u(n,size,data) end if not lastdeferred then lastdeferred = n @@ -2646,10 +2655,10 @@ local openfile, closefile do } local fb if compress then --- local comp = zlibcompress(data,3) 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 @@ -2735,7 +2744,8 @@ do -- updaters.register("backend.update.pdf",function() return setmetatableindex(original) end - function codeinjections.scanimgage(specification) + function codeinjections.scanimage(specification) + -- placeholder, doesn't give back dimensions etc but will be plugged in return specification end diff --git a/tex/context/base/mkxl/spac-chr.lmt b/tex/context/base/mkxl/spac-chr.lmt index ac90926e1..52d8a7de1 100644 --- a/tex/context/base/mkxl/spac-chr.lmt +++ b/tex/context/base/mkxl/spac-chr.lmt @@ -130,10 +130,10 @@ end local function nbsp(head,current) local para = fontparameters[getfont(current)] local attr = getattr(current,a_alignstate) or 0 - if attr >= 1 or attr <= 3 then -- flushright + if attr >= 1 and attr <= 3 then -- flushright head, current = inject_nobreak_space(0x00A0,head,current,para.space,0,0) else - head, current = inject_nobreak_space(0x00A0,head,current,para.space,para.spacestretch,para.spaceshrink) + head, current = inject_nobreak_space(0x00A0,head,current,para.space,para.space_stretch,para.space_shrink) end setsubtype(current,spaceskip_code) return head, current diff --git a/tex/context/base/mkxl/syst-ini.mkxl b/tex/context/base/mkxl/syst-ini.mkxl index be2571a3d..fb85531b7 100644 --- a/tex/context/base/mkxl/syst-ini.mkxl +++ b/tex/context/base/mkxl/syst-ini.mkxl @@ -634,8 +634,8 @@ \permanent\protected\def\defUmathtopaccent #1#2#3#4{\global\immutable\protected\def#1{\Umathaccent "#2 "#3 "#4 }} \permanent\protected\def\defUmathbotaccent #1#2#3#4{\global\immutable\protected\def#1{\Umathbotaccent "#2 "#3 "#4 }} -\permanent\protected\def\defUdelimiterover #1#2#3#4{\writestatus{!}{\string#1}\global\immutable\protected\def#1{\Udelimiterover "#2 "#3 }} -\permanent\protected\def\defUdelimiterunder #1#2#3#4{\writestatus{!}{\string#1}\global\immutable\protected\def#1{\Udelimiterunder "#2 "#3 }} +\permanent\protected\def\defUdelimiterover #1#2#3#4{\global\immutable\protected\def#1{\Udelimiterover "#2 "#3 }} +\permanent\protected\def\defUdelimiterunder #1#2#3#4{\global\immutable\protected\def#1{\Udelimiterunder "#2 "#3 }} \permanent\protected\def\defUdelimiter #1#2#3#4{\global\immutable\protected\def#1{\Udelimiter "#2 "#3 "#4 }} \permanent\protected\def\defUradical #1#2#3{\global\immutable\protected\def#1{\Uradical "#2 "#3 }} \permanent\protected\def\defUroot #1#2#3{\global\immutable\protected\def#1{\Uroot "#2 "#3 }} diff --git a/tex/context/base/mkxl/tabl-xtb.mklx b/tex/context/base/mkxl/tabl-xtb.mklx index b15d99c12..9cce05f18 100644 --- a/tex/context/base/mkxl/tabl-xtb.mklx +++ b/tex/context/base/mkxl/tabl-xtb.mklx @@ -353,14 +353,14 @@ % in text flow: headers and footers only once -\setvalue{\??xtableflushsplit\v!yes}% +\defcsname\??xtableflushsplit\v!yes\endcsname {\clf_x_table_flush method {\v!split}% \relax} % in text flow: headers and footers only once -\setvalue{\??xtableflushsplit\v!no}% +\defcsname\??xtableflushsplit\v!no\endcsname {% \noindent % gives extra line after table % \noindentation % messes up the next indentation % \dontleavehmode % no leftskip @@ -373,11 +373,24 @@ % in text flow: headers and footers get repeated -\setvalue{\??xtableflushsplit\v!repeat}% +% \defcsname\??xtableflushsplit\v!repeat\endcsname +% {\doloop +% {\clf_x_table_flush +% method {\v!split}% +% height \ifdim\pagegoal=\maxdimen\textheight\else\pagegoal\fi +% \relax +% \ifcase\c_tabl_x_state +% \exitloop +% \else +% \page +% \fi}} + +\defcsname\??xtableflushsplit\v!repeat\endcsname {\doloop - {\clf_x_table_flush + {\testpage[5]% for now hard coded, just as the \lineheight below, see mail end of april 2021 + \clf_x_table_flush method {\v!split}% - height \ifdim\pagegoal=\maxdimen\textheight\else\pagegoal\fi + height \ifdim\pagegoal=\maxdimen\textheight\else\dimexpr\pagegoal-\pagetotal-\lineheight\relax\fi \relax \ifcase\c_tabl_x_state \exitloop @@ -385,7 +398,7 @@ \page \fi}} -% \setvalue{\??xtableflushsplit\v!setups}% +% \defcsname\??xtableflushsplit\v!setups\endcsname % {\directsetup{xtable:split:user}} % % \startsetups[xtable:split:user] diff --git a/tex/context/interface/mkii/keys-ro.xml b/tex/context/interface/mkii/keys-ro.xml index bc9e87ddf..9a01df165 100644 --- a/tex/context/interface/mkii/keys-ro.xml +++ b/tex/context/interface/mkii/keys-ro.xml @@ -767,6 +767,7 @@ <cd:constant name='coupling' value='cuplare'/> <cd:constant name='couplingway' value='modcuplare'/> <cd:constant name='criterium' value='criteriu'/> + <cd:constant name='crop' value='crop'/> <cd:constant name='cropoffset' value='cropoffset'/> <cd:constant name='crossreference' value='crossreference'/> <cd:constant name='cssfile' value='cssfile'/> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 4d7a9796a..453ee0018 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-04-21 11:36 +-- merge date : 2021-04-26 00:51 do -- begin closure to overcome local limits and interference |