diff options
author | Hans Hagen <pragma@wxs.nl> | 2020-09-18 21:00:53 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2020-09-18 21:00:53 +0200 |
commit | 1970df23942ba9c944ea62ff51012f4e46a32974 (patch) | |
tree | 9ab77bdd4a58619f514823a574f30aca291afc58 /tex | |
parent | e7dc9c1fc474fa15a2cbc34d8f543518f5853361 (diff) | |
download | context-1970df23942ba9c944ea62ff51012f4e46a32974.tar.gz |
2020-09-18 20:31:00
Diffstat (limited to 'tex')
27 files changed, 628 insertions, 89 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 3e6741cb3..bd9a2e71a 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{2020.09.15 18:07} +\newcontextversion{2020.09.18 20:28} %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 fef1d6aea..02f157eb2 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{2020.09.15 18:07} +\edef\contextversion{2020.09.18 20:28} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 6e2ec0fb3..29fd6f332 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{2020.09.15 18:07} +\newcontextversion{2020.09.18 20:28} %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 2c1bed4a4..ce1458089 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{2020.09.15 18:07} +\edef\contextversion{2020.09.18 20:28} %D Kind of special: diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl index 9d3edf3c1..ef58cc903 100644 --- a/tex/context/base/mkiv/context.mkxl +++ b/tex/context/base/mkiv/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2020.09.15 18:07} +\edef\contextversion{2020.09.18 20:28} %D Kind of special: @@ -273,7 +273,7 @@ \loadmkxlfile{spac-par} \loadmarkfile{spac-def} \loadmkvifile{spac-prf} -\loadmarkfile{spac-grd} +\loadmkxlfile{spac-grd} %loadmarkfile{anch-pos} diff --git a/tex/context/base/mkiv/font-fil.mklx b/tex/context/base/mkiv/font-fil.mklx index 65cd64428..3bc5d8c26 100644 --- a/tex/context/base/mkiv/font-fil.mklx +++ b/tex/context/base/mkiv/font-fil.mklx @@ -235,24 +235,26 @@ % todo: replace * by ... less messy with features +% % no \ifempty here as #1 can be empty +% % \def\truefontname#name% % {\expandafter\font_helpers_true_fontname#name*\empty*\relax} % % \def\font_helpers_true_fontname#name*#first#rest*#crap\relax % {\ifcsname\??fontfile\fontclass#name\endcsname -% \ifempty#first% +% \ifx#first\empty % \expandafter\truefontname\lastnamedcs % \else % \expandafter\font_helpers_true_fontname_check\lastnamedcs*#first#rest% % \fi % \orelse\ifcsname\??fontfile\defaultfontclass#name\endcsname -% \ifempty#first% +% \ifx#first\empty % \expandafter\truefontname\lastnamedcs % \else % \expandafter\font_helpers_true_fontname_check\lastnamedcs*#first#rest% % \fi % \orelse\ifcsname\??fontfile#name\endcsname -% \ifempty#first% +% \ifx#first\empty % \expandafter\truefontname\lastnamedcs % \else % \expandafter\font_helpers_true_fontname_check\lastnamedcs*#first#rest% @@ -275,30 +277,32 @@ % #name% % \fi} +% no \ifempty here as #1 can be empty + \def\truefontname#name% {\expandafter\font_helpers_true_fontname#name*\empty*\relax} \def\font_helpers_true_fontname#name*#first#rest*#ignore\relax {\ifcsname\??fontfile\fontclass#name\endcsname - \ifempty#first% + \ifx#first\empty \expandafter\truefontname\lastnamedcs \else \expandafter\font_helpers_true_fontname_check\lastnamedcs*#first#rest% \fi \orelse\ifcsname\??fontfile\defaultfontclass#name\endcsname - \ifempty#first% + \ifx#first\empty \expandafter\truefontname\lastnamedcs \else \expandafter\font_helpers_true_fontname_check\lastnamedcs*#first#rest% \fi \orelse\ifcsname\??fontfile#name\endcsname - \ifempty#first% + \ifx#first\empty \expandafter\truefontname\lastnamedcs \else \expandafter\font_helpers_true_fontname_check\lastnamedcs*#first#rest% \fi \else - #name\ifempty#first\else*#first#rest\fi + #name\ifx#first\empty\else*#first#rest\fi \fi} \def\font_helpers_true_fontname_check#name% diff --git a/tex/context/base/mkiv/lang-mis.mkxl b/tex/context/base/mkiv/lang-mis.mkxl index d7e359d90..5ed131d25 100644 --- a/tex/context/base/mkiv/lang-mis.mkxl +++ b/tex/context/base/mkiv/lang-mis.mkxl @@ -322,6 +322,7 @@ \else %\prewordbreak\discretionary{\hbox{#2}}{}{\hbox{#2}}\postwordbreak \wordboundary\discretionary{\hbox{#2}}{}{\hbox{#2}}\wordboundary + %\discretionary options \plusthree{\hbox{#2}}{}{\hbox{#2}}% \fi \fi \nextnextnext} @@ -362,6 +363,7 @@ \setuvalue{\??discretionarymode i}#1% %{\prewordbreak\discretionary{\hbox{#1}}{}{\hbox{#1}}\postwordbreak} {\wordboundary\discretionary{\hbox{#1}}{}{\hbox{#1}}\wordboundary} + %{\discretionary options \plusthree{\hbox{#1}}{}{\hbox{#1}}} \unexpanded\def\definetextmodediscretionary #1 {\setvalue{\??discretionaryaction\detokenize{#1}}} @@ -414,21 +416,26 @@ \else %\prewordbreak\discretionary{}{(-}{(}\prewordbreak \wordboundary\discretionary{}{(-}{(}\wordboundary + %\discretionary options \plusthree{}{(-}{(}% \fi} \definetextmodediscretionary ~ %{\prewordbreak\discretionary{-}{}{\thinspace}\postwordbreak} {\wordboundary\discretionary{-}{}{\thinspace}\wordboundary} + %{\discretionary options \plusthree{-}{}{\thinspace}} \definetextmodediscretionary ' %{\prewordbreak\discretionary{-}{}{'}\postwordbreak} {\wordboundary\discretionary{-}{}{'}\wordboundary} + %{\discretionary options \plusthree{-}{}{'}} \definetextmodediscretionary ^ %{\prewordbreak\discretionary{\hbox{\normalstartimath|\normalstopimath}}{}{\hbox{\normalstartimath|\normalstopimath}}% % \postwordbreak} % bugged - {\wordboundary\discretionary{\hbox{\normalstartimath|\normalstopimath}}{}{\hbox{\normalstartimath|\normalstopimath}}% + {\wordboundary + \discretionary{\hbox{\normalstartimath|\normalstopimath}}{}{\hbox{\normalstartimath|\normalstopimath}}% \wordboundary} % bugged + %{\discretionary options \plusthree{\hbox{\normalstartimath|\normalstopimath}}{}{\hbox{\normalstartimath|\normalstopimath}}} \definetextmodediscretionary < %{\beginofsubsentence\prewordbreak\beginofsubsentencespacing @@ -560,4 +567,19 @@ \disablediscretionaries \to \everycleanupfeatures +%D Here: +%D +%D \startbuffer +%D {\red somelongword}{\blue \compounddiscretionary}{\green somelongword} +%D \stopbuffer +%D +%D \typebuffer \blank {\hsize3mm\getbuffer\par} \blank + +\unexpanded\def\compounddiscretionary + {\discretionary + options \plusthree + {\ifnum\prehyphenchar >\zerocount\char\prehyphenchar \fi}% + {\ifnum\posthyphenchar>\zerocount\char\posthyphenchar\fi}% + {\ifnum\posthyphenchar>\zerocount\char\posthyphenchar\fi}} + \protect \endinput diff --git a/tex/context/base/mkiv/m-mkivmkxl.mkxl b/tex/context/base/mkiv/m-mkivmkxl.mkxl new file mode 100644 index 000000000..9aea14eb2 --- /dev/null +++ b/tex/context/base/mkiv/m-mkivmkxl.mkxl @@ -0,0 +1,3 @@ +% mkiv spacing before figure + +% \let\checkprevdepth\baselinecorrection diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index 67efa8eff..6ca7a7a40 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -494,6 +494,7 @@ return { "dirlre", "dirrle", "dirlro", "dirrlo", -- "lesshyphens", "morehyphens", "nohyphens", "dohyphens", + "compounddiscretionary", -- "Ucheckedstartdisplaymath", "Ucheckedstopdisplaymath", -- diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index 5f594ca3f..3f9b2e15a 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -335,6 +335,7 @@ return { "letfrozen", "letprotected", "linedirection", + "linepar", "localbrokenpenalty", "localcontrolled", "localinterlinepenalty", @@ -406,6 +407,7 @@ return { "tokspre", "tpack", "tracingfonts", + "tracingmath", "unletfrozen", "unletprotected", "vpack", @@ -827,11 +829,13 @@ return { "underline", "unhbox", "unhcopy", + "unhpack", "unkern", "unpenalty", "unskip", "unvbox", "unvcopy", + "unvpack", "uppercase", "vadjust", "valign", diff --git a/tex/context/base/mkiv/pack-com.mkiv b/tex/context/base/mkiv/pack-com.mkiv index 28a3495d4..b806361df 100644 --- a/tex/context/base/mkiv/pack-com.mkiv +++ b/tex/context/base/mkiv/pack-com.mkiv @@ -77,11 +77,15 @@ \to \everyinsidefloat \newcount\c_pack_combinations_nesting % local + \newcount\c_pack_combinations_x % global \newcount\c_pack_combinations_y % global \newcount\c_pack_combinations_max % global -\newbox \b_pack_combinations_captions % global -\newbox \b_pack_combinations_temp % global + +\newdimen\d_pack_combinations_ht % global + +\newbox \b_pack_combinations_captions % global % can go +\newbox \b_pack_combinations_temp % global % can go \newbox \b_pack_combinations_content % local \newbox \b_pack_combinations_caption % local @@ -95,6 +99,9 @@ \newcount\c_pack_combinations_x_saved \newcount\c_pack_combinations_y_saved \newcount\c_pack_combinations_max_saved + +\newdimen\d_pack_combinations_ht_saved + \newbox \b_pack_combinations_captions_saved \newbox \b_pack_combinations_temp_saved \newbox \b_pack_combinations_content_saved @@ -108,6 +115,7 @@ \c_pack_combinations_x_saved \c_pack_combinations_x \c_pack_combinations_y_saved \c_pack_combinations_y \c_pack_combinations_max_saved\c_pack_combinations_max + \d_pack_combinations_ht_saved \d_pack_combinations_ht \setbox\b_pack_combinations_captions_saved\box\b_pack_combinations_captions \setbox\b_pack_combinations_temp_saved \box\b_pack_combinations_temp \setbox\b_pack_combinations_content_saved \box\b_pack_combinations_content @@ -121,6 +129,7 @@ \global\c_pack_combinations_x \c_pack_combinations_x_saved \global\c_pack_combinations_y \c_pack_combinations_y_saved \global\c_pack_combinations_max\c_pack_combinations_max_saved + \global\d_pack_combinations_ht \d_pack_combinations_ht_saved \global\setbox\b_pack_combinations_captions\box\b_pack_combinations_captions_saved \global\setbox\b_pack_combinations_temp \box\b_pack_combinations_temp_saved \setbox\b_pack_combinations_content \box\b_pack_combinations_content_saved @@ -474,35 +483,66 @@ \pack_combinations_flush_captions \egroup} +% \def\pack_combinations_save_caption +% {\global\setbox\b_pack_combinations_captions\hpack +% {\hpack{\box\b_pack_combinations_caption}% +% \unhbox\b_pack_combinations_captions}} +% +% \def\pack_combinations_flush_captions +% {\noalign +% {\ifdim\ht\b_pack_combinations_captions>\zeropoint +% \nointerlineskip % indeed +% \combinationparameter\c!inbetween +% \global\c_pack_combinations_x\c_pack_combinations_max +% \glet\pack_combinations_flush_captions_indeed\pack_combinations_flush_captions_yes +% \else +% \global\setbox\b_pack_combinations_captions\emptybox +% \glet\pack_combinations_flush_captions_indeed\pack_combinations_flush_captions_nop +% \fi}% +% \pack_combinations_flush_captions_indeed +% \crcr} +% +% \def\pack_combinations_flush_captions_yes +% {\global\setbox\b_pack_combinations_captions\hpack +% {\unhbox\b_pack_combinations_captions +% \global\setbox\b_pack_combinations_temp\lastbox}% +% \box\b_pack_combinations_temp +% \global\advance\c_pack_combinations_x\minusone\relax +% \ifnum\c_pack_combinations_x>\zerocount +% \expandafter\pack_combinations_flush_captions_yes_followup +% \else +% \global\setbox\b_pack_combinations_captions\emptybox +% \fi} + +\installcorenamespace{combinationcaption} + \def\pack_combinations_save_caption - {\global\setbox\b_pack_combinations_captions\hpack - {\hpack{\box\b_pack_combinations_caption}% - \unhbox\b_pack_combinations_captions}} + {\ifdim\htdp\b_pack_combinations_caption>\zeropoint + \global\d_pack_combinations_ht\htdp\b_pack_combinations_caption + \fi + \savebox{\??combinationcaption:\number\c_pack_combinations_nesting}{\number\c_pack_combinations_x}{\box\b_pack_combinations_caption}} \def\pack_combinations_flush_captions {\noalign - {\ifdim\ht\b_pack_combinations_captions>\zeropoint + {\ifdim\d_pack_combinations_ht>\zeropoint \nointerlineskip % indeed \combinationparameter\c!inbetween \global\c_pack_combinations_x\c_pack_combinations_max \glet\pack_combinations_flush_captions_indeed\pack_combinations_flush_captions_yes \else - \global\setbox\b_pack_combinations_captions\emptybox \glet\pack_combinations_flush_captions_indeed\pack_combinations_flush_captions_nop \fi}% \pack_combinations_flush_captions_indeed \crcr} \def\pack_combinations_flush_captions_yes - {\global\setbox\b_pack_combinations_captions\hpack - {\unhbox\b_pack_combinations_captions - \global\setbox\b_pack_combinations_temp\lastbox}% - \box\b_pack_combinations_temp - \global\advance\c_pack_combinations_x\minusone\relax - \ifnum\c_pack_combinations_x>\zerocount + {\foundbox{\??combinationcaption:\number\c_pack_combinations_nesting}{\number\c_pack_combinations_x}% + \global\advance\c_pack_combinations_x\minusone + \ifnum\c_pack_combinations_x>\zerocount % \c_pack_combinations_max \expandafter\pack_combinations_flush_captions_yes_followup \else - \global\setbox\b_pack_combinations_captions\emptybox + \global\d_pack_combinations_ht\zeropoint + \initializeboxstack{\??combinationcaption:\number-\c_pack_combinations_nesting}% \fi} \let\pack_combinations_flush_captions_nop\donothing @@ -539,8 +579,15 @@ \let\stopfloatcombination\relax +% \unexpanded\def\pack_combinations_float_hack_a#1% +% {\strc_floats_build_box_separate_split{\getlocalfloat{#1}}% +% \box\b_strc_floats_separate_content} + +% \unexpanded\def\pack_combinations_float_hack_b#1% +% {\box\b_strc_floats_separate_caption} + \unexpanded\def\pack_combinations_float_hack_a#1% - {\strc_floats_build_box_separate_split{\getlocalfloat{#1}}% + {\strc_floats_build_box_separate_split{#1}% \box\b_strc_floats_separate_content} \unexpanded\def\pack_combinations_float_hack_b#1% diff --git a/tex/context/base/mkiv/page-flt.mkiv b/tex/context/base/mkiv/page-flt.mkiv index 01ee8b689..cbbae223b 100644 --- a/tex/context/base/mkiv/page-flt.mkiv +++ b/tex/context/base/mkiv/page-flt.mkiv @@ -48,7 +48,7 @@ \def\page_floats_report_flushed {\showmessage\m!floatblocks3% - {\the\numexpr\totalnoffloats-\savednoffloats\relax}} + {\the\numexpr\totalnoffloats-\savednoffloats\relax}} %D Extra float registers. diff --git a/tex/context/base/mkiv/page-one.mkiv b/tex/context/base/mkiv/page-one.mkiv index 85ed76da1..ada90eccf 100644 --- a/tex/context/base/mkiv/page-one.mkiv +++ b/tex/context/base/mkiv/page-one.mkiv @@ -486,11 +486,24 @@ \fi\fi \fi} +% \def\page_one_place_float_here_indeed +% {\ifgridsnapping +% % otherwise real bad outcome +% \else +% \baselinecorrection % this has to be done better (and definitely not in column mode) +% \fi +% \doplacefloatbox +% \page_floats_report_total +% \dohandlenextfloatindent} + \def\page_one_place_float_here_indeed {\ifgridsnapping % otherwise real bad outcome \else - \baselinecorrection % this has to be done better (and definitely not in column mode) + % this was not really applied (delayed) + % \baselinecorrection % this has to be done better (and definitely not in column mode) + % so we now use this: + \checkprevdepth \fi \doplacefloatbox \page_floats_report_total diff --git a/tex/context/base/mkiv/spac-grd.mkiv b/tex/context/base/mkiv/spac-grd.mkiv index 72d017836..482d0cf2e 100644 --- a/tex/context/base/mkiv/spac-grd.mkiv +++ b/tex/context/base/mkiv/spac-grd.mkiv @@ -300,6 +300,14 @@ \normalstartbaselinecorrection \fi} +%D Different in LMTX, maybe here we can use this in \MKIV: +%D +%D \let\checkprevdepth\forcestrutdepth % mlv only +%D +%D as we have sync issues that makes it not work otherwise. + +\let\checkprevdepth\baselinecorrection + % This is new (and experimental) and might replace some of the above. beware it doesn't always work % out well, e.g. when used grouped and such (e.g. before display math doesn't work out well). diff --git a/tex/context/base/mkiv/spac-grd.mkxl b/tex/context/base/mkiv/spac-grd.mkxl new file mode 100644 index 000000000..3e5030043 --- /dev/null +++ b/tex/context/base/mkiv/spac-grd.mkxl @@ -0,0 +1,378 @@ +%D \module +%D [ file=spac-grd, +%D version=2009.10.16, % 1998.03.10, was core-grd.tex +%D title=\CONTEXT\ Spacing Macros, +%D subtitle=Grid Snapping, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This module will be merged into spac-ver.mkiv. + +\writestatus{loading}{ConTeXt Spacing Macros / Grid Snapping} + +\unprotect + +%D A rather crappy macro that we need to avoid and as such it will probably +%D disappear: + +\installcorenamespace{lastnodepusher} + +\let\poplastnode\relax + +\unexpanded\def\pushlastnode + {\csname\??lastnodepusher + \ifcsname\??lastnodepusher\the\lastnodetype\endcsname + \the\lastnodetype + \else + \s!unknown + \fi + \endcsname} + +\setvalue{\??lastnodepusher\number\kernnodecode}% + {\unexpanded\edef\poplastnode{\kern\the\lastkern\relax}% + \kern-\lastkern} + +\setvalue{\??lastnodepusher\number\gluenodecode}% + {\unexpanded\edef\poplastnode{\vskip\the\lastskip\relax}% + \vskip-\lastskip} + +\setvalue{\??lastnodepusher\number\penaltynodecode}% + {\unexpanded\edef\poplastnode{\penalty\the\lastpenalty\relax}% + \nobreak} + +\setvalue{\??lastnodepusher\s!unknown}% + {\let\poplastnode\relax} + +%D Moved from supp-box: + +%D \macros +%D {startbaselinecorrection,baselinecorrection, +%D showbaselinecorrection,offbaselinecorrection} +%D +%D Spacing around ruled boxes can get pretty messed up. The +%D next macro tries as good as possible to fix this. +%D +%D \startbuffer[1] +%D \startbaselinecorrection +%D \ruledhbox{Rule Brittanica} +%D \stopbaselinecorrection +%D \stopbuffer +%D +%D \typebuffer[1] +%D +%D The macros put some white space around the box: +%D +%D \getbuffer[1] +%D +%D A simple alternative is \type {\baselinecorrection}, which +%D only looks at the previous line. +%D +%D \startbuffer[2] +%D \baselinecorrection +%D \ruledhbox{Rule Brittanica} +%D \baselinecorrection +%D \stopbuffer +%D +%D \typebuffer[2] +%D +%D This time the last preceding line gets a correction,% +%D dependant on the depth. +%D +%D \getbuffer[2] +%D +%D One can make the correction visible by saying \type +%D {\showbaselinecorrection}. Part of the correction is +%D calculated from the dimensions of a~(. One can disble the +%D correction by calling \type {\offbaselinecorrection}. +%D +%D When visualize the first example looks like: +%D +%D {\showbaselinecorrection\getbuffer[1]} +%D +%D and the second one comes out as: +%D +%D {\showbaselinecorrection\getbuffer[2]} + +% \definecolor[GridLineColor][red] +% \definecolor[GridTextColor][blue] + +\newdimen\d_spac_lines_correction_before +\newdimen\d_spac_lines_correction_after + +\newbox \b_spac_lines_correction_before +\newbox \b_spac_lines_correction_after + +\def\spac_lines_initialize_corrections + {\setbox\b_spac_lines_correction_before\hpack{\setstrut\strut}% + \setbox\b_spac_lines_correction_after \hbox {(}% + \d_spac_lines_correction_before\dimexpr\ht\b_spac_lines_correction_before-\ht\b_spac_lines_correction_after\relax + \d_spac_lines_correction_after \dimexpr\dp\b_spac_lines_correction_before-\dp\b_spac_lines_correction_after\relax + \ifdim\d_spac_lines_correction_before<\zeropoint\d_spac_lines_correction_before\zeropoint\fi + \ifdim\d_spac_lines_correction_after <\zeropoint\d_spac_lines_correction_after \zeropoint\fi} + +%unexpanded\def\dotopbaselinecorrection{\kern\d_spac_lines_correction_before} +%unexpanded\def\dobotbaselinecorrection{\kern\d_spac_lines_correction_after } + +% experiment, todo: proper mkiv mechanism +% +% \input ward \par +% \startframedtext test \stopframedtext +% \input ward \par +% \startlinecorrection \framed{xxx} \stoplinecorrection +% \input ward \par +% +% \setupwhitespace[big] +% +% \input ward \par +% \startframedtext test \stopframedtext +% \input ward \par +% \startlinecorrection \framed{xxx} \stoplinecorrection +% \input ward \par + +% to be redone: + +\unexpanded\def\dotopbaselinecorrection{\expandafter\blank\expandafter[\the\d_spac_lines_correction_before]} +\unexpanded\def\dobotbaselinecorrection{\expandafter\blank\expandafter[\the\d_spac_lines_correction_after ]} + +\def\showbaselinecorrection + {\def\dobaselinecorrection % visualization is not watertight! + {\bgroup + \ifdim\prevdepth>\zeropoint + \kern-\prevdepth + \fi + \setbox\scratchbox\emptyhbox + \wd\scratchbox\hsize + \dp\scratchbox\strutdp + \nointerlineskip + \forgetall + \ruledvpack{\box\scratchbox}% + \egroup + \prevdepth\strutdp}% + \def\dotopbaselinecorrection + {\hrule\s!height\d_spac_lines_correction_before}% + \def\dobotbaselinecorrection + {\hrule\s!height\d_spac_lines_correction_after}} + +% \def\dobaselinecorrection % beware, this one is redefined below +% {\ifdim\prevdepth>\zeropoint\kern-\prevdepth\fi +% \kern\strutdp +% \prevdepth\strutdp} + +\def\baselinecorrection + {\endgraf + \ifvmode + \ifdim\prevdepth<\maxdimen + \ifdim\prevdepth<\zeropoint \else + \ifdim\prevdepth<\strutdepth \relax + \pushlastnode + \dobaselinecorrection + \poplastnode + \fi + \fi + \fi + \fi} + +\def\pagebaselinecorrection + {\ifdim\pagegoal<\maxdimen + \ifdim\pagetotal>\lineheight % or \topskip + \scratchdimen\pagetotal + \advance\scratchdimen\lineheight + \ifdim\scratchdimen<\pagegoal + \baselinecorrection + \fi + \fi + \fi} + +\unexpanded\def\startbaselinecorrection + {\bgroup + \let\stopbaselinecorrection\egroup + \ifcase\baselinecorrectionmode + \or % normal + \baselinecorrection + \ifvmode + \setbox\scratchbox\vbox\bgroup\ignorespaces + \let\stopbaselinecorrection\donormalstopbaselinecorrection + \fi + \or % off + \or % force + \baselinecorrection + \ifvmode + \setbox\scratchbox\vbox\bgroup\ignorespaces + \let\stopbaselinecorrection\doforcedstopbaselinecorrection + \fi + \fi} + +\let\stopbaselinecorrection\relax + +\def\donormalstopbaselinecorrection % I have to check columns yet. + {\egroup + \topbaselinecorrection + \box\scratchbox + \botbaselinecorrection + \egroup} + +\def\doforcedstopbaselinecorrection % I have to check columns yet. + {\egroup + \forcedtopbaselinecorrection + \box\scratchbox + \forcedbotbaselinecorrection + \egroup} + +%D We do a bit more checking than needed. The pageborder check +%D is not needed, but I want to look the visualization as good +%D as possible too. + +\setnewconstant\baselinecorrectionmode\plusone + +\def\onbaselinecorrection {\baselinecorrectionmode\plusone } +\def\offbaselinecorrection {\baselinecorrectionmode\plustwo } +\def\forcebaselinecorrection{\baselinecorrectionmode\plusthree} + +%D \macros +%D {topbaselinecorrection,botbaselinecorrection} +%D +%D The actual top and bottom corrections are implemented as: + +\def\topbaselinecorrection + {\ifvmode \ifdim\pagegoal<\maxdimen + \forcedtopbaselinecorrection + \fi \fi} + +\def\forcedtopbaselinecorrection + {\ifvmode + \bgroup + \spac_lines_initialize_corrections + \whitespace % no longer ok + \nointerlineskip + \dotopbaselinecorrection + \egroup + \fi} + +\def\botbaselinecorrection + {\ifvmode + \bgroup + \spac_lines_initialize_corrections + \dobotbaselinecorrection + \allowbreak % new, otherwise problems when many in a row + \prevdepth\strutdp + \egroup + \fi} + +\let\forcedbotbaselinecorrection\botbaselinecorrection + +% nointerlineskip +% +% startpacked +% \startlinecorrection \framed{test} \stoplinecorrection +% \startlinecorrection \framed{test} \stoplinecorrection +% \stoppacked + +\def\forcedtopbaselinecorrection + {\ifvmode + \bgroup + \spac_lines_initialize_corrections + \vspacing[\v!white] +% \nointerlineskip % + \dotopbaselinecorrection + \egroup +\fi} + +\def\dobaselinecorrection + {\ifdim\prevdepth>\zeropoint + \vspacing[\the\dimexpr-\prevdepth+\strutdp\relax]% + \else + \vspacing[\the\dimexpr\strutdp\relax]% + \fi + \prevdepth\strutdp} + +% \def\dobaselinecorrection +% {\scratchdimen\dimexpr\ifdim\prevdepth>\zeropoint-\prevdepth+\fi\strutdp\relax +% \vspacing[\the\scratchdimen]% +% \prevdepth\strutdp} +% +% some day: +% +% \def\dobaselinecorrection +% {\clf_checkstrutdepth\strutdp} +% +% \def\baselinecorrection +% {\endgraf +% \ifvmode +% \ifdim\prevdepth<\maxdimen +% \ifdim\prevdepth<\zeropoint \else +% \ifdim\prevdepth<\strutdepth \relax +% % works in mvl: +% % \forcestrutdepth +% % doesn't work immediately (unless enforced with penalty): +% % \pushlastnode +% % \dobaselinecorrection +% % \poplastnode +% % works ok: +% \clf_checkstrutdepth\strutdp +% \fi +% \fi +% \fi +% \fi} + +%D For the moment only with placefloats (should work in mvl and boxes): + +\unexpanded\def\checkprevdepth + {\endgraf + \ifvmode + \ifdim\prevdepth<\maxdimen + \ifdim\prevdepth<\zeropoint \else + \ifdim\prevdepth<\strutdepth \relax + \clf_checkstrutdepth\strutdp + \fi + \fi + \fi + \fi} + +\let\normalstartbaselinecorrection\startbaselinecorrection + +\unexpanded\def\startbaselinecorrection + {\ifgridsnapping + \snaptogrid[\v!normal]\vbox\bgroup + \let\stopbaselinecorrection\egroup + \else + \normalstartbaselinecorrection + \fi} + +% This is new (and experimental) and might replace some of the above. beware it doesn't always work +% out well, e.g. when used grouped and such (e.g. before display math doesn't work out well). + +% \unexpanded\def\fakenextstrutline +% {\par +% \begingroup +% \reseteverypar +% \dontleavehmode\hpack to \zeropoint{\page_sides_anchor\hss\strut}% just a tracer +% \vskip-\parskip +% \vskip-\struttotal +% \endgroup} + +% \unexpanded\def\fakenextstrutline +% {\par +% \begingroup +% \reseteverypar +% \dontleavehmode\hpack{\strut}\par +% \clf_fakenextstrutline +% \ifdim\pagetotal>\lineheight +% \pagetotal\dimexpr\pagetotal-\lineheight\relax +% \fi +% \endgroup} + +% \unexpanded\def\fakenextstrutline +% {\par +% \begingroup +% \reseteverypar +% \forgetall +% \dontleavehmode\hpack{\strut}\par +% \clf_removelastline +% \endgroup} + +\protect \endinput diff --git a/tex/context/base/mkiv/spac-ver.lua b/tex/context/base/mkiv/spac-ver.lua index b2d5a3e2d..2f0d54227 100644 --- a/tex/context/base/mkiv/spac-ver.lua +++ b/tex/context/base/mkiv/spac-ver.lua @@ -39,6 +39,7 @@ local unpack = unpack or table.unpack local allocate = utilities.storage.allocate local todimen = string.todimen local formatters = string.formatters +local abs = math.abs local nodes = nodes local trackers = trackers @@ -181,7 +182,6 @@ local gluecodes = nodes.gluecodes local penalty_code = nodecodes.penalty local kern_code = nodecodes.kern local glue_code = nodecodes.glue -local insert_code = nodecodes.ins local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist local rule_code = nodecodes.rule @@ -2157,32 +2157,47 @@ do end end - local trace = false + local trace = false + local last = nil + local vmode_code = tex.modelevels.vertical + local temp_code = nodecodes.temp + local getnest = tex.getnest + local getlist = tex.getlist trackers.register("vspacing.forcestrutdepth",function(v) trace = v end) - local last = nil + -- abs : negative is inner - -- function vspacing.forcestrutdepth(n,depth,trace_mode,plus) - -- local box = texgetbox(n) - -- if box then - -- box = tonut(box) - -- local head = getlist(box) - -- if head then - -- local tail = find_node_tail(head) - -- if tail and getid(tail) == hlist_code then - -- local dp = getdepth(tail) - -- if dp < depth then - -- setdepth(tail,depth) - -- outer.prevdepth = depth - -- if trace or trace_mode > 0 then - -- nuts.setvisual(tail,"depth") - -- end - -- end - -- end - -- end - -- end - -- end + function vspacing.checkstrutdepth(depth) + local nest = getnest() + if abs(nest.mode) == vmode_code and nest.head then + local tail = nest.tail + local id = tail.id + if id == hlist_code then + if tail.depth < depth then + tail.depth = depth + end + nest.prevdepth = depth + elseif id == temp_code and getnest("ptr") == 0 then + local head = getlist("page_head") + if head then + tail = nodes.tail(head) + if tail and tail.id == hlist_code then + if tail.depth < depth then + tail.depth = depth + end + nest.prevdepth = depth + end + end + end + end + end + + interfaces.implement { + name = "checkstrutdepth", + arguments = "dimension", + actions = vspacing.checkstrutdepth, + } function vspacing.forcestrutdepth(n,depth,trace_mode,plus) local box = texgetbox(n) diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex ff922bab8..1d6c21209 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 fd0b5705c..a88eadca5 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-con.mkvi b/tex/context/base/mkiv/strc-con.mkvi index 66ff3097b..681e813b7 100644 --- a/tex/context/base/mkiv/strc-con.mkvi +++ b/tex/context/base/mkiv/strc-con.mkvi @@ -1052,7 +1052,7 @@ \begingroup \simplifycommands \xdef\currentconstructionbookmark{\detokenize\expandafter{\normalexpanded{\constructionparameter\c!title}}}% - \endgroup + \endgroup \fi \fi \fi \ifx\currentconstructionlist\empty diff --git a/tex/context/base/mkiv/strc-flt.mkvi b/tex/context/base/mkiv/strc-flt.mkvi index 3e57a857b..91cc3f666 100644 --- a/tex/context/base/mkiv/strc-flt.mkvi +++ b/tex/context/base/mkiv/strc-flt.mkvi @@ -2203,6 +2203,8 @@ {\box\floatbox}}} % special purpose: used in floatcombinations +% +% todo : keep float content and caption separated in local \newbox\b_strc_floats_separate_content \newbox\b_strc_floats_separate_caption @@ -2211,37 +2213,44 @@ {\settrue\c_floats_adapt_to_caption_width \settrue\c_floats_store_minimal_package} +% \def\strc_floats_build_box_separate_make +% {\offinterlineskip +% \vpack to \onepoint{\box\b_strc_floats_content}\break +% \vpack to \onepoint{\box\b_strc_floats_caption}} + +%D Remark for \LMTX: we don't want to migrate inserts here so we unpack +%D (could be a flag). When migrated, the inserts end up in the vertical +%D list and we no longer have just a box (but inserts and lines again). + +% \def\strc_floats_build_box_separate_split#1% +% {\setbox\scratchbox\vpack{#1}% +% \setbox\scratchbox\vbox\bgroup +% \unvpack\scratchbox +% \setbox\scratchbox\lastbox % can have (unmigrated) inserts +% \unvpack\scratchbox +% \setbox\scratchbox\lastbox % can have (unmigrated) inserts +% \unvpack\scratchbox +% \setbox\scratchbox\lastbox % can have (unmigrated) inserts +% \splittopskip\zeropoint +% \global\setbox\b_strc_floats_separate_content\vsplit\scratchbox to \onepoint +% \global\setbox\b_strc_floats_separate_caption\vsplit\scratchbox to \onepoint +% \egroup +% \global\setbox\b_strc_floats_separate_content\vpack +% {\unvbox\b_strc_floats_separate_content +% \setbox\scratchbox\lastbox +% \unvbox\scratchbox}% +% \global\setbox\b_strc_floats_separate_caption\tpack +% {\unvbox\b_strc_floats_separate_caption +% \setbox\scratchbox\lastbox +% \unvbox\scratchbox}} + \def\strc_floats_build_box_separate_make - {\offinterlineskip - \vpack to \onepoint{\box\b_strc_floats_content}\break - \vpack to \onepoint{\box\b_strc_floats_caption}} - -\def\strc_floats_build_box_separate_split#1% - {\setbox\scratchbox\vbox\bgroup - \setbox\scratchbox\vpack{#1}% - \unvbox\scratchbox\relax - \setbox\scratchbox\lastbox - %\doloop{% - \unvbox\scratchbox - \setbox\scratchbox\lastbox - % \ifdim\ht\scratchbox=2\onepoint - \unvbox\scratchbox - \setbox\scratchbox\lastbox - % \exitloop - % \fi - %}% - \splittopskip\zeropoint - \global\setbox\b_strc_floats_separate_content\vsplit\scratchbox to \onepoint - \global\setbox\b_strc_floats_separate_caption\vsplit\scratchbox to \onepoint - \egroup - \global\setbox\b_strc_floats_separate_content\vpack - {\unvbox\b_strc_floats_separate_content - \setbox\scratchbox\lastbox - \unvbox\scratchbox}% - \global\setbox\b_strc_floats_separate_caption\tpack - {\unvbox\b_strc_floats_separate_caption - \setbox\scratchbox\lastbox - \unvbox\scratchbox}} + {\savebox\??localfloatstack{\number\numexpr\c_strc_localfloats_n+1\relax:a}{\box\b_strc_floats_content}% + \savebox\??localfloatstack{\number\numexpr\c_strc_localfloats_n+1\relax:b}{\box\b_strc_floats_caption}} + +\unexpanded\def\strc_floats_build_box_separate_split#1% + {\global\setbox\b_strc_floats_separate_content\vpack{\foundbox\??localfloatstack{\number#1:a}}% + \global\setbox\b_strc_floats_separate_caption\tpack{\foundbox\??localfloatstack{\number#1:b}}} % \def\strc_floats_build_box_step#1% % {\doifdefined{\??floatbuilder#1}{\def\floatcaptionarrangement{#1}\quitcommalist}} diff --git a/tex/context/base/mkiv/strc-itm.mklx b/tex/context/base/mkiv/strc-itm.mklx index 609bfac29..86d2275d7 100644 --- a/tex/context/base/mkiv/strc-itm.mklx +++ b/tex/context/base/mkiv/strc-itm.mklx @@ -676,6 +676,12 @@ \strc_itemgroups_insert_item_counter_indeed \fi} +\installcorenamespace{itemstopper} + +\setvalue{\??itemstopper\v!yes }{\itemgroupparameter\c!stopper} +\setvalue{\??itemstopper\v!display}{\ifconditional\c_strc_itemgroups_inline\else\itemgroupparameter\c!stopper\fi} +\setvalue{\??itemstopper\v!inline }{\ifconditional\c_strc_itemgroups_inline\itemgroupparameter\c!stopper\fi} + \def\strc_itemgroups_insert_item_counter_indeed % quite slow ... every time this setup .. but it {\begingroup % can be optimized ... best move some to strc-num \setupcounter @@ -690,7 +696,7 @@ \c!prefixconnector=\itemgroupparameter\c!prefixconnector, \c!criterium=\itemgroupparameter\c!criterium, \c!numberorder=\ifconditional\c_strc_itemgroups_reverse\v!reverse\else\v!normal\fi, - \c!numberstopper=\expdoif{\itemgroupparameter\c!placestopper}\v!yes{\itemgroupparameter\c!stopper}, + \c!numberstopper=\begincsname\??itemstopper\itemgroupparameter\c!placestopper\endcsname, \c!numberconversionset=\v_strc_itemgroups_counter, \c!numbersegments=\currentitemgroupsegments]% % there will be a fixedconversion key diff --git a/tex/context/base/mkiv/strc-itm.mkvi b/tex/context/base/mkiv/strc-itm.mkvi index ce1bcc6f5..a46923d3e 100644 --- a/tex/context/base/mkiv/strc-itm.mkvi +++ b/tex/context/base/mkiv/strc-itm.mkvi @@ -676,6 +676,12 @@ \strc_itemgroups_insert_item_counter_indeed \fi} +\installcorenamespace{itemstopper} + +\setvalue{\??itemstopper\v!yes }{\itemgroupparameter\c!stopper} +\setvalue{\??itemstopper\v!display}{\ifconditional\c_strc_itemgroups_inline\else\itemgroupparameter\c!stopper\fi} +\setvalue{\??itemstopper\v!inline }{\ifconditional\c_strc_itemgroups_inline\itemgroupparameter\c!stopper\fi} + \def\strc_itemgroups_insert_item_counter_indeed % quite slow ... every time this setup .. but it {\begingroup % can be optimized ... best move some to strc-num \setupcounter @@ -690,7 +696,7 @@ \c!prefixconnector=\itemgroupparameter\c!prefixconnector, \c!criterium=\itemgroupparameter\c!criterium, \c!numberorder=\ifconditional\c_strc_itemgroups_reverse\v!reverse\else\v!normal\fi, - \c!numberstopper=\expdoif{\itemgroupparameter\c!placestopper}\v!yes{\itemgroupparameter\c!stopper}, + \c!numberstopper=\begincsname\??itemstopper\itemgroupparameter\c!placestopper\endcsname, \c!numberconversionset=\v_strc_itemgroups_counter, \c!numbersegments=\currentitemgroupsegments]% % there will be a fixedconversion key diff --git a/tex/context/base/mkiv/strc-not.mkvi b/tex/context/base/mkiv/strc-not.mkvi index 9cd8ecbf7..b1b119dc1 100644 --- a/tex/context/base/mkiv/strc-not.mkvi +++ b/tex/context/base/mkiv/strc-not.mkvi @@ -27,6 +27,20 @@ \unexpanded\def\unvboxed {\ifvmode\unvbox \else\box \fi} % will change or used more often \unexpanded\def\unvcopied{\ifvmode\unvcopy\else\copy\fi} % will change or used more often +%D \LMTX\ testcase: +%D +%D \starttyping +%D \hbox {\hbox{\footnote{HH1}\footnote{HH2}}} \par +%D \hbox {\hbox{x\footnote{XHH1}x\footnote{XHH2}}} \par +%D \vbox {\setbox0\hbox{\footnote{VH1}\footnote{VH2}}\box0} \par +%D \vbox {\hbox{\footnote{VH1}xxx\footnote{VH2}}} \par +%D \vbox {\hbox{\footnote{VH1}\footnote{VH2}} +%D \hbox{\footnote{VH1}\footnote{VH2}}} \par +%D \vbox {\hbox{x\footnote{XVH1}x\footnote{XVH2}}} \par +%D \vbox {\vbox{\footnote{VV1}\footnote{VV2}}} \par % two lines +%D \vbox {\vbox{x\footnote{XVV1}x\footnote{XVV2}}} \par +%D \stoptyping + %D Notes have two handlers: notations and notes. Although notations can be defined %D independently it makes not much sense. In principle we can treat notes as lists %D but they are currently done as a variant on enumerations. I will provide a list diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv index 06ef9dbe3..70a467ec5 100644 --- a/tex/context/base/mkiv/syst-ini.mkiv +++ b/tex/context/base/mkiv/syst-ini.mkiv @@ -1193,4 +1193,9 @@ \def\tokenized#1{\scantextokens\expandafter{\normalexpanded{#1}}} \fi +\ifdefined \unhpack \else + \let\unhpack\unhbox + \let\unvpack\unvbox +\fi + \protect \endinput diff --git a/tex/context/base/mkiv/syst-ini.mkxl b/tex/context/base/mkiv/syst-ini.mkxl index ce54b71e4..4a6352566 100644 --- a/tex/context/base/mkiv/syst-ini.mkxl +++ b/tex/context/base/mkiv/syst-ini.mkxl @@ -658,6 +658,7 @@ \tracingifs \plusone \tracingnesting \plustwo \tracingassigns \plustwo + \tracingmath \plusone \showboxbreadth \maxcount \showboxdepth \maxcount} @@ -668,6 +669,7 @@ \protected\def\tracingnone {\showboxdepth \plusthree \showboxbreadth \plusfive + \tracingmath \zerocount \tracingassigns \zerocount \tracingnesting \zerocount \tracingifs \zerocount diff --git a/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv b/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv index cc9559d8b..dc31715a4 100644 --- a/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv +++ b/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv @@ -235,6 +235,8 @@ %D It doesn't hurt to have these, at least for the moment (can go to type-imp-symbol) -\definefontsynonym [ZapfDingbats] [\s!file:uzdr] [\s!features=dingbats]% [\s!goodies=dingbats] +\definefontsynonym [ZapfDingbats] [\s!file:uzdr*dingbats] % works better with symbols + +% \definefontsynonym [ZapfDingbats] [\s!file:uzdr] [\s!features=dingbats]% [\s!goodies=dingbats] \endinput diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 90eadfd07..09391be3f 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 : 2020-09-15 18:07 +-- merge date : 2020-09-18 20:28 do -- begin closure to overcome local limits and interference |