diff options
24 files changed, 308 insertions, 210 deletions
diff --git a/metapost/context/base/mpxl/mp-math.mpxl b/metapost/context/base/mpxl/mp-math.mpxl index 3d9ad81d3..404d42160 100644 --- a/metapost/context/base/mpxl/mp-math.mpxl +++ b/metapost/context/base/mpxl/mp-math.mpxl @@ -172,16 +172,6 @@ else : % decimal fi ; -%D Variant on post to the mailing list by MC: - -vardef atantwo(expr dy, dx) = - if dx == 0 : - if dy < 0 : - fi pi / 2 - else : - atan(dy/dx) if dx > 0 : if dy < 0 : - else : + fi pi fi - fi -enddef ; - permanent m_acos, m_acosh, m_asin, m_asinh, m_atan, m_atantwo, m_atanh, m_cbrt, m_ceil, m_copysign, m_cos, m_cosh, m_deg, m_erf, m_erfc, m_exp, m_exptwo, m_expm, m_fabs, diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 6bcff2af2..e1de3bd24 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{2022.10.14 10:13} +\newcontextversion{2022.10.15 10:32} %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 e02334f8d..85524aa83 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{2022.10.14 10:13} +\edef\contextversion{2022.10.15 10:32} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-nl.mkii b/tex/context/base/mkii/mult-nl.mkii index 81d3f32f0..ca90b7129 100644 --- a/tex/context/base/mkii/mult-nl.mkii +++ b/tex/context/base/mkii/mult-nl.mkii @@ -93,7 +93,6 @@ \setinterfacevariable{author}{auteur} \setinterfacevariable{auto}{auto} \setinterfacevariable{autointro}{autointro} -\setinterfacevariable{autopunctuation}{autopunctuation} \setinterfacevariable{back}{terug} \setinterfacevariable{background}{achtergrond} \setinterfacevariable{backmatter}{uitleidingen} @@ -677,9 +676,13 @@ \setinterfaceconstant{authoretaltext}{authoretaltext} \setinterfaceconstant{auto}{auto} \setinterfaceconstant{autocase}{autocase} +\setinterfaceconstant{autofencing}{autofencing} \setinterfaceconstant{autofile}{autofile} \setinterfaceconstant{autofocus}{autofocus} \setinterfaceconstant{autohang}{autohang} +\setinterfaceconstant{autonumbers}{autonumbers} +\setinterfaceconstant{autopunctuation}{autopunctuation} +\setinterfaceconstant{autospacing}{autospacing} \setinterfaceconstant{autostrut}{autostrut} \setinterfaceconstant{autowidth}{autobreedte} \setinterfaceconstant{availableheight}{beschikbarehoogte} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 688232bf2..400fc6983 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{2022.10.14 10:13} +\newcontextversion{2022.10.15 10:32} %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 7b5df628c..e0608818f 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -49,7 +49,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2022.10.14 10:13} +\edef\contextversion{2022.10.15 10:32} %D Kind of special: diff --git a/tex/context/base/mkiv/math-act.lua b/tex/context/base/mkiv/math-act.lua index 80f58020d..5aa3f0ff0 100644 --- a/tex/context/base/mkiv/math-act.lua +++ b/tex/context/base/mkiv/math-act.lua @@ -234,7 +234,7 @@ sequencers.appendaction("aftercopyingcharacters", "system","mathematics.tweakaft -- a couple of predefined tweaks: -local tweaks = { } +local tweaks = { subsets = { } } mathematics.tweaks = tweaks -- function tweaks.fixbadprime(target,original) diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 982b677cd..a51e3ea39 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 9469ffdf0..8c4219a01 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index e8f8e5e2e..bb6268f4a 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{2022.10.14 10:13} +\newcontextversion{2022.10.15 10:32} %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 bf5dd9a07..c322164c3 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{2022.10.14 10:13} +\immutable\edef\contextversion{2022.10.15 10:32} %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 69adc09a9..1dfb73f17 100644 --- a/tex/context/base/mkxl/driv-shp.lmt +++ b/tex/context/base/mkxl/driv-shp.lmt @@ -871,11 +871,11 @@ local gluewidth = effectiveglue(current,this_box,true) 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 = width * (cur_h // width) cur_h = ref_h - shipbox_h - cur_h else cur_h = ref_h - shipbox_h - cur_h - cur_h = width * (cur_h / width) + cur_h = width * (cur_h // width) cur_h = ref_h - shipbox_h - cur_h end if cur_h < save_h then diff --git a/tex/context/base/mkxl/lpdf-ano.lmt b/tex/context/base/mkxl/lpdf-ano.lmt index b0d398457..e3904f16e 100644 --- a/tex/context/base/mkxl/lpdf-ano.lmt +++ b/tex/context/base/mkxl/lpdf-ano.lmt @@ -468,7 +468,7 @@ end) local function flushdestination(specification) local names = specification.names local view = specification.view - local r = pdfpagereference(c_realpageno) + local r = pdfpagereference(texgetcount(c_realpageno)) if (references.innermethod ~= v_name) and (view == defaultview or not view or view == "") then r = pagedestinations[r] else diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index d13c2447c..29af7a659 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -51,7 +51,9 @@ \unprotect -%D We move these definitions into the format: +\newdimen\mathstrutht +\newdimen\mathstrutdp +\newcount\mathnestinglevel \registerctxluafile{math-ini}{autosuffix} \registerctxluafile{math-dim}{autosuffix} @@ -720,7 +722,7 @@ %D %D \start \blank \getbuffer \blank \stop -\newcount\mathnestinglevel +% \newcount\mathnestinglevel % see top \appendtoks \advance\mathnestinglevel\plusone @@ -1864,8 +1866,8 @@ \permanent\protected\def\topstrut{\srule\s!width\zeropoint\s!height\strutht \s!depth\zeropoint\relax} \permanent\protected\def\botstrut{\srule\s!width\zeropoint\s!height\zeropoint\s!depth\strutdp \relax} -\newdimen\mathstrutht -\newdimen\mathstrutdp +% \newdimen\mathstrutht % see top +% \newdimen\mathstrutdp % see top \appendtoks \mathstrutht\strutht @@ -4368,6 +4370,27 @@ \permanent\tolerant\protected\def\setmathgroupset[#1]% {\mathdictgroup\clf_groupsetgroup{#1}\relax} +%D Only for testing (limited line span): +%D +%D \starttyping +%D test \im {z + \mathaxisbelow x + 2 - a = 1} test \par +%D test \im {z + \mathaxisontop x + 2 - a = 1} test +%D \stoptyping + +\definesystemattribute[mathaxis][public] + +\def\math_axis_inject#1% + {\mathatom \s!class \mathghostcode \s!unpack { + \showmakeup[strut]% todo: shortcut + \srule + \s!height \dimexpr\Umathaxis\mathstyle+.2\points\relax + \s!depth -\dimexpr\Umathaxis\mathstyle-.2\points\relax + \s!attr \mathaxisattribute #1% + \relax}} + +\permanent\protected\def\mathaxisbelow{\math_axis_inject\plusone} +\permanent\protected\def\mathaxisontop{\math_axis_inject\plustwo} + \protect \endinput % % not used (yet) diff --git a/tex/context/base/mkxl/math-noa.lmt b/tex/context/base/mkxl/math-noa.lmt index 30b7b0448..a53810437 100644 --- a/tex/context/base/mkxl/math-noa.lmt +++ b/tex/context/base/mkxl/math-noa.lmt @@ -2469,7 +2469,6 @@ do local traversehlist = nuts.traversers.hlist local texgetdimen = tex.getdimen - local texgetglue = tex.getglue local texgetcount = tex.getcount local newrule = nuts.pool.outlinerule @@ -2478,12 +2477,16 @@ do local a_mathsnap = attributes.private("mathsnap") + local d_mathstrutht = tex.isdimen("mathstrutht") + local d_mathstrutdp = tex.isdimen("mathstrutdp") + local c_mathnesting = tex.iscount("mathnestinglevel") + local trace_snapping = false registertracker("math.snapping", function(v) trace_snapping = v end) local report_snapping = logreporter("mathematics","snapping") function handlers.snap(h,_,_,_,_,level) -- if not level or level == 0 then - if texgetcount("mathnestinglevel") == 1 then + if texgetcount(c_mathnesting) == 1 then local trace_color if trace_snapping == "frame" then trace_color = "darkgray" @@ -2498,8 +2501,8 @@ do if step then local done = false if not dd then - ht = texgetdimen("mathstrutht") - dp = texgetdimen("mathstrutdp") + ht = texgetdimen(d_mathstrutht) + dp = texgetdimen(d_mathstrutdp) hd = ht + dp -- lineskip can be large in alignments -- dd = hd / 12 diff --git a/tex/context/base/mkxl/mlib-int.lmt b/tex/context/base/mkxl/mlib-int.lmt index 837630850..9165d5423 100644 --- a/tex/context/base/mkxl/mlib-int.lmt +++ b/tex/context/base/mkxl/mlib-int.lmt @@ -8,28 +8,17 @@ if not modules then modules = { } end modules ['mlib-int'] = { local factor = number.dimenfactors.bp local mpstring = mp.string -local mpboolean = mp.boolean +local injectnumeric = mp.inject.numeric +local isdimen = tex.isdimen +local iscount = tex.iscount local getdimen = tex.getdimen local getcount = tex.getcount local getmacro = tokens.getters.macro local get = tex.get -local emwidths = fonts.hashes.emwidths -local exheights = fonts.hashes.exheights local registerscript = metapost.registerscript local registerdirect = metapost.registerdirect -local on_right_page = structures.pages.on_right -local is_odd_page = structures.pages.is_odd -local in_body_page = structures.pages.in_body -local page_fraction = structures.pages.fraction -local layout_has_changed = structures.pages.has_changed - -local function defaultcolormodel() -- can be helper - local colormethod = getcount("MPcolormethod") - return (colormethod == 0 or colormethod == 1) and 1 or 3 -end - do local t = os.date("*t") -- maybe this should be a very early on global @@ -62,134 +51,174 @@ do end -local injectnumeric = mp.inject.numeric - -registerdirect("PaperHeight", function() return getdimen("paperheight") * factor end) -registerdirect("PaperWidth", function() return getdimen("paperwidth") * factor end) -registerdirect("PrintPaperHeight", function() return getdimen("printpaperheight") * factor end) -registerdirect("PrintPaperWidth", function() return getdimen("printpaperwidth") * factor end) -registerdirect("TopSpace", function() return getdimen("topspace") * factor end) -registerdirect("BottomSpace", function() return getdimen("bottomspace") * factor end) -registerdirect("BackSpace", function() return getdimen("backspace") * factor end) -registerdirect("CutSpace", function() return getdimen("cutspace") * factor end) -registerdirect("MakeupHeight", function() return getdimen("makeupheight") * factor end) -registerdirect("MakeupWidth", function() return getdimen("makeupwidth") * factor end) -registerdirect("TopHeight", function() return getdimen("topheight") * factor end) -registerdirect("TopDistance", function() return getdimen("topdistance") * factor end) -registerdirect("HeaderHeight", function() return getdimen("headerheight") * factor end) -registerdirect("HeaderDistance", function() return getdimen("headerdistance") * factor end) -registerdirect("TextHeight", function() return getdimen("textheight") * factor end) -registerdirect("FooterDistance", function() return getdimen("footerdistance") * factor end) -registerdirect("FooterHeight", function() return getdimen("footerheight") * factor end) -registerdirect("BottomDistance", function() return getdimen("bottomdistance") * factor end) -registerdirect("BottomHeight", function() return getdimen("bottomheight") * factor end) -registerdirect("LeftEdgeWidth", function() return getdimen("leftedgewidth") * factor end) -registerdirect("LeftEdgeDistance", function() return getdimen("leftedgedistance") * factor end) -registerdirect("LeftMarginWidth", function() return getdimen("leftmarginwidth") * factor end) -registerdirect("LeftMarginDistance", function() return getdimen("leftmargindistance") * factor end) -registerdirect("TextWidth", function() return getdimen("textwidth") * factor end) -registerdirect("RightMarginDistance", function() return getdimen("rightmargindistance") * factor end) -registerdirect("RightMarginWidth", function() return getdimen("rightmarginwidth") * factor end) -registerdirect("RightEdgeDistance", function() return getdimen("rightedgedistance") * factor end) -registerdirect("RightEdgeWidth", function() return getdimen("rightedgewidth") * factor end) -registerdirect("InnerMarginDistance", function() return getdimen("innermargindistance") * factor end) -registerdirect("InnerMarginWidth", function() return getdimen("innermarginwidth") * factor end) -registerdirect("OuterMarginDistance", function() return getdimen("outermargindistance") * factor end) -registerdirect("OuterMarginWidth", function() return getdimen("outermarginwidth") * factor end) -registerdirect("InnerEdgeDistance", function() return getdimen("inneredgedistance") * factor end) -registerdirect("InnerEdgeWidth", function() return getdimen("inneredgewidth") * factor end) -registerdirect("OuterEdgeDistance", function() return getdimen("outeredgedistance") * factor end) -registerdirect("OuterEdgeWidth", function() return getdimen("outeredgewidth") * factor end) -registerdirect("PageOffset", function() return getdimen("pagebackgroundoffset") * factor end) -registerdirect("PageDepth", function() return getdimen("pagebackgrounddepth") * factor end) -registerdirect("LayoutColumns", function() return getcount("layoutcolumns") end) -registerdirect("LayoutColumnDistance", function() return getdimen("layoutcolumndistance") * factor end) -registerdirect("LayoutColumnWidth", function() return getdimen("layoutcolumnwidth") * factor end) -registerdirect("SpineWidth", function() return getdimen("spinewidth") * factor end) -registerdirect("PaperBleed", function() return getdimen("paperbleed") * factor end) - -registerdirect("RealPageNumber", function() return getcount("realpageno") end) -registerdirect("LastPageNumber", function() return getcount("lastpageno") end) - -registerdirect("PageNumber", function() return getcount("userpageno") end) -registerdirect("NOfPages", function() return getcount("lastpageno") end) - -registerdirect("SubPageNumber", function() return getcount("subpageno") end) -registerdirect("NOfSubPages", function() return getcount("lastsubpageno") end) - -registerdirect("CurrentColumn", function() return getcount("mofcolumns") end) -registerdirect("NOfColumns", function() return getcount("nofcolumns") end) - -registerdirect("BaseLineSkip", function() return get ("baselineskip",true) * factor end) -registerdirect("LineHeight", function() return getdimen("lineheight") * factor end) -registerdirect("BodyFontSize", function() return getdimen("bodyfontsize") * factor end) - -registerdirect("TopSkip", function() return get ("topskip",true) * factor end) -registerdirect("StrutHeight", function() return getdimen("strutht") * factor end) -registerdirect("StrutDepth", function() return getdimen("strutdp") * factor end) - -registerdirect("CurrentWidth", function() return get ("hsize") * factor end) -registerdirect("CurrentHeight", function() return get ("vsize") * factor end) - -registerdirect("EmWidth", function() return emwidths [false] * factor end) -registerdirect("ExHeight", function() return exheights[false] * factor end) - -registerdirect("HSize", function() return get ("hsize") * factor end) -registerdirect("VSize", function() return get ("vsize") * factor end) -registerdirect("LastPageNumber", function() return getcount("lastpageno") end) - -registerdirect("OverlayWidth", function() return getdimen("d_overlay_width") * factor end) -registerdirect("OverlayHeight", function() return getdimen("d_overlay_height") * factor end) -registerdirect("OverlayDepth", function() return getdimen("d_overlay_depth") * factor end) -registerdirect("OverlayLineWidth", function() return getdimen("d_overlay_linewidth") * factor end) -registerdirect("OverlayOffset", function() return getdimen("d_overlay_offset") * factor end) -registerdirect("OverlayRegion", function() return getmacro("m_overlay_region") end) ---------------("CurrentLayout", function() return getmacro("currentlayout") end) - --- registerscript("PageFraction", function() return mpboolean(page_fraction ()) end) --- registerscript("OnRightPage", function() return mpboolean(on_right_page ()) end) --- registerscript("OnOddPage", function() return mpboolean(is_odd_page ()) end) --- registerscript("InPageBody", function() return mpboolean(in_body_page ()) end) - -registerdirect("PageFraction", function() return page_fraction () end) -registerdirect("OnRightPage", function() return on_right_page () end) -registerdirect("OnOddPage", function() return is_odd_page () end) -registerdirect("InPageBody", function() return in_body_page () end) -registerdirect("LastChangedLayoutPage",function() return getcount("c_page_layouts_changed") end) -registerdirect("SwapMarginDimensions", function() token.expandmacro("swapmargindimensions") end) - -registerdirect("PageFraction", page_fraction ) -registerdirect("OnRightPage", on_right_page ) -registerdirect("OnOddPage", is_odd_page ) -registerdirect("InPageBody", in_body_page ) --- registerdirect("LayoutHasChanged", layout_has_changed) - -registerdirect("defaultcolormodel", defaultcolormodel) - --- see node-rul.* - --- offset is a multiplier --- factor is the amount - -registerdirect("RuleWidth", function() return getdimen("d_rule_width") * factor end) -registerdirect("RuleHeight", function() return getdimen("d_rule_height") * factor end) -registerdirect("RuleDepth", function() return getdimen("d_rule_depth") * factor end) -registerdirect("RuleH", function() return getdimen("d_rule_h") * factor end) -registerdirect("RuleV", function() return getdimen("d_rule_v") * factor end) -registerdirect("RuleThickness", function() return getdimen("d_rule_line") * factor end) -registerdirect("RuleOffset", function() return getdimen("d_rule_offset") / 65536 end) --- registerdirect("RuleOffset", function() return getdimen("d_rule_offset") * factor end) -registerdirect("RuleDirection", function() return getmacro("c_rule_direction") end) --- registerdirect("RuleFactor", function() print(getmacro("m_rule_factor")) return (tonumber(getmacro("m_rule_factor")) or 0) * factor end) -registerdirect("RuleFactor", function() return getdimen("d_rule_factor") * factor end) -registerdirect("RuleOption", function() return getmacro("m_rule_option") end) ---------------("RuleColor", function() return getmacro("m_rule_color") end) -registerscript("RuleColor", function() return getmacro("m_rule_color") end) +do + + local d_paperheight = isdimen("paperheight") registerdirect("PaperHeight", function() return getdimen(d_paperheight) * factor end) + local d_paperwidth = isdimen("paperwidth") registerdirect("PaperWidth", function() return getdimen(d_paperwidth) * factor end) + local d_printpaperheight = isdimen("printpaperheight") registerdirect("PrintPaperHeight", function() return getdimen(d_printpaperheight) * factor end) + local d_printpaperwidth = isdimen("printpaperwidth") registerdirect("PrintPaperWidth", function() return getdimen(d_printpaperwidth) * factor end) + local d_topspace = isdimen("topspace") registerdirect("TopSpace", function() return getdimen(d_topspace) * factor end) + local d_bottomspace = isdimen("bottomspace") registerdirect("BottomSpace", function() return getdimen(d_bottomspace) * factor end) + local d_backspace = isdimen("backspace") registerdirect("BackSpace", function() return getdimen(d_backspace) * factor end) + local d_cutspace = isdimen("cutspace") registerdirect("CutSpace", function() return getdimen(d_cutspace) * factor end) + local d_makeupheight = isdimen("makeupheight") registerdirect("MakeupHeight", function() return getdimen(d_makeupheight) * factor end) + local d_makeupwidth = isdimen("makeupwidth") registerdirect("MakeupWidth", function() return getdimen(d_makeupwidth) * factor end) + local d_topheight = isdimen("topheight") registerdirect("TopHeight", function() return getdimen(d_topheight) * factor end) + local d_topdistance = isdimen("topdistance") registerdirect("TopDistance", function() return getdimen(d_topdistance) * factor end) + local d_headerheight = isdimen("headerheight") registerdirect("HeaderHeight", function() return getdimen(d_headerheight) * factor end) + local d_headerdistance = isdimen("headerdistance") registerdirect("HeaderDistance", function() return getdimen(d_headerdistance) * factor end) + local d_textheight = isdimen("textheight") registerdirect("TextHeight", function() return getdimen(d_textheight) * factor end) + local d_footerdistance = isdimen("footerdistance") registerdirect("FooterDistance", function() return getdimen(d_footerdistance) * factor end) + local d_footerheight = isdimen("footerheight") registerdirect("FooterHeight", function() return getdimen(d_footerheight) * factor end) + local d_bottomdistance = isdimen("bottomdistance") registerdirect("BottomDistance", function() return getdimen(d_bottomdistance) * factor end) + local d_bottomheight = isdimen("bottomheight") registerdirect("BottomHeight", function() return getdimen(d_bottomheight) * factor end) + local d_leftedgewidth = isdimen("leftedgewidth") registerdirect("LeftEdgeWidth", function() return getdimen(d_leftedgewidth) * factor end) + local d_leftedgedistance = isdimen("leftedgedistance") registerdirect("LeftEdgeDistance", function() return getdimen(d_leftedgedistance) * factor end) + local d_leftmarginwidth = isdimen("leftmarginwidth") registerdirect("LeftMarginWidth", function() return getdimen(d_leftmarginwidth) * factor end) + local d_leftmargindistance = isdimen("leftmargindistance") registerdirect("LeftMarginDistance", function() return getdimen(d_leftmargindistance) * factor end) + local d_textwidth = isdimen("textwidth") registerdirect("TextWidth", function() return getdimen(d_textwidth) * factor end) + local d_rightmargindistance = isdimen("rightmargindistance") registerdirect("RightMarginDistance", function() return getdimen(d_rightmargindistance) * factor end) + local d_rightmarginwidth = isdimen("rightmarginwidth") registerdirect("RightMarginWidth", function() return getdimen(d_rightmarginwidth) * factor end) + local d_rightedgedistance = isdimen("rightedgedistance") registerdirect("RightEdgeDistance", function() return getdimen(d_rightedgedistance) * factor end) + local d_rightedgewidth = isdimen("rightedgewidth") registerdirect("RightEdgeWidth", function() return getdimen(d_rightedgewidth) * factor end) + +end + +do + + local onrightpage = structures.pages.on_right + + registerdirect("InnerMarginDistance", function() return getdimen(onrightpage() and d_leftmargindistance or d_rightmargindistance) * factor end) + registerdirect("InnerMarginWidth", function() return getdimen(onrightpage() and d_leftmarginwidth or d_rightmarginwidth ) * factor end) + registerdirect("OuterMarginDistance", function() return getdimen(onrightpage() and d_rightmargindistance or d_leftmargindistance ) * factor end) + registerdirect("OuterMarginWidth", function() return getdimen(onrightpage() and d_rightmarginwidth or d_leftmarginwidth ) * factor end) + registerdirect("InnerEdgeDistance", function() return getdimen(onrightpage() and d_leftmargindistance or d_rightmargindistance) * factor end) + registerdirect("InnerEdgeWidth", function() return getdimen(onrightpage() and d_leftmarginwidth or d_rightmarginwidth ) * factor end) + registerdirect("OuterEdgeDistance", function() return getdimen(onrightpage() and d_rightedgedistance or d_leftedgedistance ) * factor end) + registerdirect("OuterEdgeWidth", function() return getdimen(onrightpage() and d_rightedgewidth or d_leftedgewidth ) * factor end) + +end + +do + + local d_pagebackgroundoffset = isdimen("pagebackgroundoffset") registerdirect("PageOffset", function() return getdimen(d_pagebackgroundoffset) * factor end) + local d_pagebackgrounddepth = isdimen("pagebackgrounddepth") registerdirect("PageDepth", function() return getdimen(d_pagebackgrounddepth) * factor end) + local c_layoutcolumns = iscount("layoutcolumns") registerdirect("LayoutColumns", function() return getcount(c_layoutcolumns) end) + local d_layoutcolumndistance = isdimen("layoutcolumndistance") registerdirect("LayoutColumnDistance", function() return getdimen(d_layoutcolumndistance) * factor end) + local d_layoutcolumnwidth = isdimen("layoutcolumnwidth") registerdirect("LayoutColumnWidth", function() return getdimen(d_layoutcolumnwidth) * factor end) + local d_spinewidth = isdimen("spinewidth") registerdirect("SpineWidth", function() return getdimen(d_spinewidth) * factor end) + local d_paperbleed = isdimen("paperbleed") registerdirect("PaperBleed", function() return getdimen(d_paperbleed) * factor end) + +end + +do + + local c_realpageno = getcount("realpageno") registerdirect("RealPageNumber", function() return getcount(c_realpageno) end) + local c_lastpageno = getcount("lastpageno") registerdirect("LastPageNumber", function() return getcount(c_lastpageno) end) + + local c_userpageno = getcount("userpageno") registerdirect("PageNumber", function() return getcount(c_userpageno) end) + local c_lastpageno = getcount("lastpageno") registerdirect("NOfPages", function() return getcount(c_lastpageno) end) + + local c_subpageno = getcount("subpageno") registerdirect("SubPageNumber", function() return getcount(c_subpageno) end) + local c_lastsubpageno = getcount("lastsubpageno") registerdirect("NOfSubPages", function() return getcount(c_lastsubpageno) end) + + local c_mofcolumns = getcount("mofcolumns") registerdirect("CurrentColumn", function() return getcount(c_mofcolumns) end) + local c_nofcolumns = getcount("nofcolumns") registerdirect("NOfColumns", function() return getcount(c_nofcolumns) end) + +end + +do + + registerdirect("BaseLineSkip", function() return get("baselineskip",true) * factor end) + registerdirect("TopSkip", function() return get("topskip",true) * factor end) + registerdirect("CurrentWidth", function() return get("hsize") * factor end) + registerdirect("CurrentHeight", function() return get("vsize") * factor end) + registerdirect("HSize", function() return get("hsize") * factor end) + registerdirect("VSize", function() return get("vsize") * factor end) + + local emwidths = fonts.hashes.emwidths + local exheights = fonts.hashes.exheights + + registerdirect("EmWidth", function() return emwidths [false] * factor end) + registerdirect("ExHeight", function() return exheights[false] * factor end) + +end + +do + + local d_lineheight = isdimen("lineheight") registerdirect("LineHeight", function() return getdimen(d_lineheight) * factor end) + local d_bodyfontsize = isdimen("bodyfontsize") registerdirect("BodyFontSize", function() return getdimen(d_bodyfontsize) * factor end) + local d_strutht = isdimen("strutht") registerdirect("StrutHeight", function() return getdimen(d_strutht) * factor end) + local d_strutdp = isdimen("strutdp") registerdirect("StrutDepth", function() return getdimen(d_strutdp) * factor end) + +end + +do + + local d_overlay_width = isdimen("d_overlay_width") registerdirect("OverlayWidth", function() return getdimen(d_overlay_width) * factor end) + local d_overlay_height = isdimen("d_overlay_height") registerdirect("OverlayHeight", function() return getdimen(d_overlay_height) * factor end) + local d_overlay_depth = isdimen("d_overlay_depth") registerdirect("OverlayDepth", function() return getdimen(d_overlay_depth) * factor end) + local d_overlay_linewidth = isdimen("d_overlay_linewidth") registerdirect("OverlayLineWidth", function() return getdimen(d_overlay_linewidth) * factor end) + local d_overlay_offset = isdimen("d_overlay_offset") registerdirect("OverlayOffset", function() return getdimen(d_overlay_offset) * factor end) + registerdirect("OverlayRegion", function() return getmacro("m_overlay_region") end) + --------------("CurrentLayout", function() return getmacro("currentlayout") end) + +end + +do + + registerdirect("LastChangedLayoutPage",function() return getcount("c_page_layouts_changed") end) + registerdirect("SwapMarginDimensions", function() token.expandmacro("swapmargindimensions") end) + + registerdirect("PageFraction", structures.pages.fraction) + registerdirect("OnRightPage", structures.pages.on_right) + registerdirect("OnOddPage", structures.pages.is_odd) + registerdirect("InPageBody", structures.pages.in_body) + --------------("LayoutHasChanged", structures.pages.has_changed) + +end + +do + + local function defaultcolormodel() -- can be helper + local colormethod = getcount("MPcolormethod") + return (colormethod == 0 or colormethod == 1) and 1 or 3 + end + + registerdirect("defaultcolormodel", defaultcolormodel) + +end + +do + + -- see node-rul.* + -- offset is a multiplier + -- factor is the amount + + -- TODO: dimensions are yet undefined so we will move this + + registerdirect("RuleWidth", function() return getdimen("d_rule_width") * factor end) + registerdirect("RuleHeight", function() return getdimen("d_rule_height") * factor end) + registerdirect("RuleDepth", function() return getdimen("d_rule_depth") * factor end) + registerdirect("RuleH", function() return getdimen("d_rule_h") * factor end) + registerdirect("RuleV", function() return getdimen("d_rule_v") * factor end) + registerdirect("RuleThickness", function() return getdimen("d_rule_line") * factor end) + registerdirect("RuleOffset", function() return getdimen("d_rule_offset") / 65536 end) -- not factor + registerdirect("RuleDirection", function() return getmacro("c_rule_direction") end) + registerdirect("RuleFactor", function() return getdimen("d_rule_factor") * factor end) + registerdirect("RuleOption", function() return getmacro("m_rule_option") end) + registerscript("RuleColor", function() return getmacro("m_rule_color") end) + +end -- see typo-ada.* -registerdirect("AdaptiveWidth", function() return getdimen("d_adaptive_width") * factor end) -registerdirect("AdaptiveHeight", function() return getdimen("d_adaptive_height") * factor end) -registerdirect("AdaptiveDepth", function() return getdimen("d_adaptive_depth") * factor end) -registerdirect("AdaptiveThickness", function() return getdimen("d_adaptive_line") * factor end) -registerdirect("AdaptiveColor", function() return getmacro("m_adaptive_color") end) +do + + local d_adaptive_width = isdimen("d_adaptive_width") registerdirect("AdaptiveWidth", function() return d_adaptive_width * factor end) + local d_adaptive_height = isdimen("d_adaptive_height") registerdirect("AdaptiveHeight", function() return d_adaptive_height * factor end) + local d_adaptive_depth = isdimen("d_adaptive_depth") registerdirect("AdaptiveDepth", function() return d_adaptive_depth * factor end) + local d_adaptive_line = isdimen("d_adaptive_line") registerdirect("AdaptiveThickness", function() return d_adaptive_line * factor end) + registerdirect("AdaptiveColor", function() return getmacro("m_adaptive_color") end) + +end diff --git a/tex/context/base/mkxl/page-ini.lmt b/tex/context/base/mkxl/page-ini.lmt index ec2278c01..c2acd7f21 100644 --- a/tex/context/base/mkxl/page-ini.lmt +++ b/tex/context/base/mkxl/page-ini.lmt @@ -34,10 +34,12 @@ local active = false local trace = false trackers.register("pages.mark",function(v) trace = v end) +local c_realpageno = tex.iscount("realpageno") + function pages.mark(name,list,settings) active = true -- - local realpage = texgetcount("realpageno") + local realpage = texgetcount(c_realpageno) if type(settings) == "string" then settings = settings_to_hash(settings) end @@ -111,7 +113,7 @@ end local function marked(name) if active then - local realpage = texgetcount("realpageno") + local realpage = texgetcount(c_realpageno) if last ~= 0 then for i=last,realpage-1 do -- print(last) @@ -132,7 +134,7 @@ end local function markedparameter(name,key) if active then - local pagedata = rawget(data,texgetcount("realpageno")) + local pagedata = rawget(data,texgetcount(c_realpageno)) if pagedata then pagedata = pagedata[name] if pagedata then @@ -223,7 +225,7 @@ local function autopageaction() if active then local nofauto = #autolist if nofauto > 0 then - local realpage = texgetcount("realpageno") + local realpage = texgetcount(c_realpageno) for i=1,nofauto do local entry = autolist[i] local names = entry[1] @@ -254,7 +256,7 @@ local function stopmarked() local nofauto = #autolist if nofauto > 0 then if not texlists.pagehead then - local realpage = texgetcount("realpageno") + local realpage = texgetcount(c_realpageno) for i=1,nofauto do local entry = autolist[i] local names = entry[1] diff --git a/tex/context/base/mkxl/spac-ali.lmt b/tex/context/base/mkxl/spac-ali.lmt index 02aaf9efd..05b517d3d 100644 --- a/tex/context/base/mkxl/spac-ali.lmt +++ b/tex/context/base/mkxl/spac-ali.lmt @@ -31,6 +31,7 @@ local nextlist = nuts.traversers.list local new_stretch = nuts.pool.stretch local a_realign = attributes.private("realign") +local c_realpageno = tex.iscount("realpageno") local texsetattribute = tex.setattribute local texgetcount = tex.getcount @@ -103,7 +104,7 @@ local function handler(head,leftpage,realpageno) end function alignments.handler(head) - return handler(head,isleftpage(),texgetcount("realpageno")) + return handler(head,isleftpage(),texgetcount(c_realpageno)) end local enabled = false diff --git a/tex/context/base/mkxl/spac-ver.lmt b/tex/context/base/mkxl/spac-ver.lmt index 283109f03..127dd0bf9 100644 --- a/tex/context/base/mkxl/spac-ver.lmt +++ b/tex/context/base/mkxl/spac-ver.lmt @@ -114,6 +114,8 @@ local d_bodyfontstrutheight = tex.isdimen("bodyfontstrutheight") local d_bodyfontstrutdepth = tex.isdimen("bodyfontstrutdepth") local d_globalbodyfontstrutheight = tex.isdimen("globalbodyfontstrutheight") local d_globalbodyfontstrutdepth = tex.isdimen("globalbodyfontstrutdepth") +----- d_strutht = tex.isdimen("strutht") +local d_strutdp = tex.isdimen("strutdp") local nuts = nodes.nuts local tonut = nuts.tonut @@ -970,6 +972,8 @@ do -- local cmd = token.create("vspacingfromtempstring") -- local cmd = token.create("vspacingpredefinedvalue") -- not yet known + local s_scratchskip = tex.isskip("scratchskip") + local function handler(multiplier, keyword, detail) if not keyword then report_vspacing("unknown directive %a",s) @@ -1024,7 +1028,7 @@ do -- setmacro("tempstring",keyword) -- runlocal(ctx_vspacingfromtempstring) -- - amount, stretch, shrink = texgetglue("scratchskip") + amount, stretch, shrink = texgetglue(s_scratchskip) if not stretch then stretch = 0 end @@ -2547,22 +2551,22 @@ do local mark_code = nodes.nodecodes.mark local line_code = nodes.listcodes.line - local nuts = nodes.nuts - local getid = nuts.getid - local getsubtype = nuts.getsubtype - local getdepth = nuts.getdepth - local setdepth = nuts.setdepth + -- local nuts = nodes.nuts + -- local getid = nuts.getid + -- local getsubtype = nuts.getsubtype + -- local getdepth = nuts.getdepth + -- local setdepth = nuts.setdepth local gettotal = nuts.gettotal local getspeciallist = nuts.getspeciallist local setspeciallist = nuts.setspeciallist local triggerbuildpage = tex.triggerbuildpage - local texgetdimen = tex.getdimen - local texsetdimen = tex.setdimen + -- local texgetdimen = tex.getdimen + -- local texsetdimen = tex.setdimen local texgetnest = tex.getnest - local texget = tex.get - local texset = tex.set + -- local texget = tex.get + -- local texset = tex.set local trace = false trackers.register("otr.forcestrutdepth", function(v) trace = v and function(n) @@ -2605,7 +2609,7 @@ do for n, id, subtype in treversenode, tail do if id == hlist_code then if subtype == line_code then - local strutdp = texgetdimen("strutdp") + local strutdp = texgetdimen(d_strutdp) local delta = strutdp - getdepth(n) if delta > 0 then setdepth(n,strutdp) @@ -2629,7 +2633,7 @@ do -- if abs(nest.mode) == vmode_code and nest.head then local tail = nest.tail if tail.id == hlist_code and tail.subtype == line_code then - local strutdp = texgetdimen("strutdp") + local strutdp = texgetdimen(d_strutdp) if tail.depth < strutdp then tail.depth = strutdp end diff --git a/tex/context/base/mkxl/strc-pag.mkxl b/tex/context/base/mkxl/strc-pag.mkxl index a959faf18..19fd573dd 100644 --- a/tex/context/base/mkxl/strc-pag.mkxl +++ b/tex/context/base/mkxl/strc-pag.mkxl @@ -21,12 +21,14 @@ % Allocation: -\ifdefined\realpageno \else \permanent\countdef\realpageno \zerocount \fi \realpageno \plusone -\ifdefined\userpageno \else \permanent\countdef\userpageno \plusone \fi \userpageno \plusone -\ifdefined\subpageno \else \permanent\countdef\subpageno \plustwo \fi \subpageno \plusone % was \zerocount but that doesn't work well with bytext -\ifdefined\arrangeno \else \permanent\countdef\arrangeno \plusthree \fi \arrangeno \zerocount % ! -\ifdefined\pagenoshift \else \permanent\countdef\pagenoshift\plusfour \fi \pagenoshift\zerocount % ! -\ifdefined\lastpageno \else \permanent\countdef\lastpageno \plusfive \fi \lastpageno \zerocount % ! +\ifdefined\realpageno \else \permanent\countdef\realpageno \zerocount \fi \realpageno \plusone +\ifdefined\userpageno \else \permanent\countdef\userpageno \plusone \fi \userpageno \plusone +\ifdefined\subpageno \else \permanent\countdef\subpageno \plustwo \fi \subpageno \plusone % was \zerocount but that doesn't work well with bytext +\ifdefined\arrangeno \else \permanent\countdef\arrangeno \plusthree \fi \arrangeno \zerocount % ! +\ifdefined\pagenoshift \else \permanent\countdef\pagenoshift \plusfour \fi \pagenoshift \zerocount % ! +\ifdefined\lastpageno \else \permanent\countdef\lastpageno \plusfive \fi \lastpageno \zerocount % ! +\ifdefined\lastuserpageno\else \permanent\countdef\lastuserpageno\plussix \fi \lastuserpageno\zerocount % ! +\ifdefined\lastsubpageno \else \permanent\countdef\lastsubpageno \plusseven \fi \lastsubpageno \zerocount % ! \ifdefined\pageno \else \aliased\let\pageno\userpageno \fi @@ -101,7 +103,9 @@ \strc_counters_set\s!realpage\realpageno \strc_counters_set\s!userpage\userpageno \strc_counters_set\s!subpage \subpageno - \lastpageno\lastcountervalue[\s!realpage]\relax + \lastpageno \lastcountervalue[\s!realpage]\relax + \lastuserpageno\lastcountervalue[\s!userpage]\relax + \lastsubpageno \lastcountervalue[\s!subpage ]\relax \to \everyinitializepagecounters \aliased\let\setuppagenumber\setupuserpagenumber diff --git a/tex/context/base/mkxl/trac-vis.lmt b/tex/context/base/mkxl/trac-vis.lmt index 73483d47a..e00944413 100644 --- a/tex/context/base/mkxl/trac-vis.lmt +++ b/tex/context/base/mkxl/trac-vis.lmt @@ -1301,15 +1301,53 @@ end local ruledstrut do - local strut_size = 65536 * 8 / 10 - local strut_code = nodes.rulecodes.strut - - ruledstrut = function(head,current) - if getsubtype(current) == strut_code and getwidth(current) == 0 then - -- maybe force gray - setwidth(current,strut_size) - setattr(current,a_layer,l_strut) - head, current = insertnodeafter(head,current,new_kern(-strut_size)) + local strut_size = 65536 * 8 / 10 + local strut_code = nodes.rulecodes.strut + local math_code = nodes.nodecodes.math + local traverseid = nuts.traverseid + local rangedimensions = nuts.rangedimensions + local a_mathaxis = attributes.private("mathaxis") + + ruledstrut = function(head,current,parent) + if getwidth(current) == 0 then + if getsubtype(current) == strut_code then + local w = strut_size + local a = getattr(current,a_mathaxis) + if a then + local b, e + for n in traverseid(math_code,current) do + e = n + break + end + for n in traverseid(math_code,current,true) do + b = n + break + end + if not b then + b = head + end + if not e then + e = nuts.tail(b) + end + w = rangedimensions(parent,b,e) + setwidth(current,w) + setcolor(current,"trace:ds") + settransparency(current,"trace:ds") + head, current, rule = nuts.remove(head,current) + local kern = new_kern(-w) + if a == 2 then + insertnodebefore(head,e,kern) + insertnodebefore(head,e,rule) + else + insertnodeafter(head,b,kern) + insertnodeafter(head,b,rule) + end + else + setwidth(current,w) + head, current = insertnodeafter(head,current,new_kern(w)) + end + setattr(current,a_layer,l_strut) + end end return head, current end @@ -1708,7 +1746,7 @@ do goto list elseif id == rule_code then if trace_strut then - head, current = ruledstrut(head,current) + head, current = ruledstrut(head,current,parent) end elseif id == whatsit_code then if trace_whatsit then diff --git a/tex/context/base/mkxl/typo-bld.lmt b/tex/context/base/mkxl/typo-bld.lmt index 0920eeafd..00ff9f267 100644 --- a/tex/context/base/mkxl/typo-bld.lmt +++ b/tex/context/base/mkxl/typo-bld.lmt @@ -40,8 +40,6 @@ local texset = tex.set local getspeciallist = nodes.nuts.getspeciallist local setspeciallist = nodes.nuts.setspeciallist -local texgetdimen = tex.getdimen - local nodes = nodes local nodeidstostring = nodes.idstostring local nodepool = nodes.pool diff --git a/tex/context/interface/mkii/keys-nl.xml b/tex/context/interface/mkii/keys-nl.xml index d0ccd5522..13abd22dd 100644 --- a/tex/context/interface/mkii/keys-nl.xml +++ b/tex/context/interface/mkii/keys-nl.xml @@ -96,7 +96,6 @@ <cd:variable name='author' value='auteur'/> <cd:variable name='auto' value='auto'/> <cd:variable name='autointro' value='autointro'/> - <cd:variable name='autopunctuation' value='autopunctuation'/> <cd:variable name='back' value='terug'/> <cd:variable name='background' value='achtergrond'/> <cd:variable name='backmatter' value='uitleidingen'/> @@ -683,9 +682,13 @@ <cd:constant name='authoretaltext' value='authoretaltext'/> <cd:constant name='auto' value='auto'/> <cd:constant name='autocase' value='autocase'/> + <cd:constant name='autofencing' value='autofencing'/> <cd:constant name='autofile' value='autofile'/> <cd:constant name='autofocus' value='autofocus'/> <cd:constant name='autohang' value='autohang'/> + <cd:constant name='autonumbers' value='autonumbers'/> + <cd:constant name='autopunctuation' value='autopunctuation'/> + <cd:constant name='autospacing' value='autospacing'/> <cd:constant name='autostrut' value='autostrut'/> <cd:constant name='autowidth' value='autobreedte'/> <cd:constant name='availableheight' value='beschikbarehoogte'/> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index c87c4ee52..10d1591d5 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 : 2022-10-14 10:13 +-- merge date : 2022-10-15 10:32 do -- begin closure to overcome local limits and interference |