From 94506ae16cbb3851986ebf900316894301f46667 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 11 Feb 2003 00:00:00 +0100 Subject: stable 2003.02.11 --- metapost/context/base/mp-core.mp | 41 +++++++++++++++++++++++++++------------- metapost/context/base/mp-page.mp | 18 ++++++++++++++++++ 2 files changed, 46 insertions(+), 13 deletions(-) (limited to 'metapost') diff --git a/metapost/context/base/mp-core.mp b/metapost/context/base/mp-core.mp index 5f1341a69..ad90766f4 100644 --- a/metapost/context/base/mp-core.mp +++ b/metapost/context/base/mp-core.mp @@ -336,10 +336,12 @@ enddef ; boolean compensate_multi_par_topskip ; boolean span_multi_column_pars ; boolean auto_multi_par_hsize ; +boolean enable_multi_par_fallback ; compensate_multi_par_topskip := true ; span_multi_column_pars := false ; auto_multi_par_hsize := false ; % true ; +enable_multi_par_fallback := true ; vardef multi_par_at_top (expr i) = (round (ypart ulcorner multipars[i]) = round (ypart ulcorner @@ -715,6 +717,27 @@ fi ; % first loop + if enable_multi_par_fallback and + (nxy[fpos]=RealPageNumber) and + (nxy[tpos]=RealPageNumber) and not + (InsideSomeTextArea(lxy[fpos]) and + InsideSomeTextArea(rxy[tpos])) : + + % fallback + + multipar := + + llxy[fpos] -- + lrxy[tpos] -- + urxy[tpos] -- + ulxy[fpos] -- cycle ; + + save_multipar (i,1,multipar) ; + + else : + + % normal + for i=1 upto NOfTextAreas : TopSkipCorrection := 0 ; @@ -725,6 +748,7 @@ fi ; if (nxy[fpos]=RealPageNumber) and (InsideTextArea(i,par_start_pos)) : + % first one in chain ii := i ; @@ -839,19 +863,6 @@ fi ; fi ; - elseif (nxy[tpos]=RealPageNumber) : - - % outside text area, fall back / test on: pascal werkboek - - multipar := - - llxy[fpos] -- - lrxy[tpos] -- - urxy[tpos] -- - ulxy[fpos] -- cycle ; - - save_multipar (i,1,multipar) ; - else : multipar := if obey_multi_par_hang : @@ -949,6 +960,10 @@ snapped_multi_pos(ulxy[tpos]) -- endfor ; + % end of normal/fallback + +fi ; + if span_multi_column_pars : endgroup ; fi ; diff --git a/metapost/context/base/mp-page.mp b/metapost/context/base/mp-page.mp index 032844ce3..05a433395 100644 --- a/metapost/context/base/mp-page.mp +++ b/metapost/context/base/mp-page.mp @@ -119,6 +119,24 @@ vardef InsideSavedTextArea (expr _i_, _xy_) = (round(ypart _xy_) <= round(ypart urcorner SavedTextAreas[_i_])) ) enddef ; +vardef InsideSomeTextArea(expr _xy_) = + save ok ; boolean ok ; ok := false ; + for i := 1 upto NOfTextAreas : + if InsideTextArea(i,_xy_) : ok := true ; fi ; + exitif ok ; + endfor ; + ok +enddef ; + +vardef InsideSomeSavedTextArea(expr _xy_) = + save ok ; boolean ok ; ok := false ; + for i := 1 upto NOfSavedTextAreas : + if InsideSavedTextArea(i,_xy_) : ok := true ; fi ; + exitif ok ; + endfor ; + ok +enddef ; + vardef TextAreaX (expr x) = numeric _TextAreaX_ ; _TextAreaX_ := 0 ; for i := 1 upto NOfTextAreas : -- cgit v1.2.3