From 0bfaf7db3a4495c91871b17e20cebecdff4a5dde Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sun, 20 Jun 2004 00:00:00 +0200 Subject: stable 2004.06.20 --- metapost/context/base/metafun.mp | 55 ++++--- metapost/context/base/mp-core.mp | 11 +- metapost/context/base/mp-figs.mp | 50 ------ metapost/context/base/mp-spec.mp | 158 ++----------------- metapost/context/base/mp-text.mp | 321 ++++++++++++++++++--------------------- metapost/context/base/mp-tool.mp | 152 ++++++------------ 6 files changed, 240 insertions(+), 507 deletions(-) delete mode 100644 metapost/context/base/mp-figs.mp (limited to 'metapost') diff --git a/metapost/context/base/metafun.mp b/metapost/context/base/metafun.mp index 5071013c5..f8cab41bf 100644 --- a/metapost/context/base/metafun.mp +++ b/metapost/context/base/metafun.mp @@ -1,15 +1,15 @@ %D \module %D [ file=metafun.mp, %D version=2000.07.15, -%D title=\CONTEXT\ \METAPOST\ graphics, -%D subtitle=format generation file, +%D title=\CONTEXT\ \METAPOST\ graphics, +%D subtitle=format generation file, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. %D When generating many graphics at runtime, it can save run %D time to use a format file. We could have named this file @@ -21,29 +21,28 @@ %D (and as a result in buggy boundingbox and special %D handling). By using the name \type {metatex} we make sure %D that we use (unless overloaded) the settings of \type -%D {mpost}. - -if unknown ahangle : - input plain.mp ; % John Hobby's file -else : - let dump = relax ; -fi ; - -input mp-tool.mp ; -input mp-spec.mp ; -input mp-core.mp ; -input mp-page.mp ; -input mp-text.mp ; -input mp-shap.mp ; -input mp-butt.mp ; -input mp-char.mp ; -input mp-step.mp ; -input mp-grph.mp ; -input mp-figs.mp ; - -% mp-form.mp ; -input mp-grid.mp ; -input mp-func.mp ; +%D {mpost}. + +if unknown ahangle : + input plain.mp ; % John Hobby's file +else : + let dump = relax ; +fi ; + +input mp-tool.mp ; +input mp-spec.mp ; +input mp-core.mp ; +input mp-page.mp ; +input mp-text.mp ; +input mp-shap.mp ; +input mp-butt.mp ; +input mp-char.mp ; +input mp-step.mp ; +input mp-grph.mp ; + +% mp-form.mp ; +input mp-grid.mp ; +input mp-func.mp ; string metafunversion ; @@ -57,7 +56,7 @@ metafunversion = "metafun" & " " & let normalend = end ; def end = - ; message "" ; message metafunversion ; message "" ; normalend ; + message "" ; message metafunversion ; message "" ; normalend ; enddef ; dump ; endinput . diff --git a/metapost/context/base/mp-core.mp b/metapost/context/base/mp-core.mp index eb038163e..51d2d0025 100644 --- a/metapost/context/base/mp-core.mp +++ b/metapost/context/base/mp-core.mp @@ -520,12 +520,11 @@ par_hang_after := ra + estimated_par_lines(py-fy) ; if (par_hang_indent>0) and (par_hang_after<0) and obey_multi_par_hang : pair _ul_ ; _ul_ := (xpart ulcorner multipar, ypart snapped_multi_pos(ulxy[fpos])); pair _pa_ ; _pa_ := _ul_ shifted (0,par_hang_after*par_line_height) ; -% _pa_ := (xpart _pa_,max(ypart _pa_,ypart llcorner multipar)) ; - _pa_ := (xpart _pa_,max(ypart _pa_ -TopSkipCorrection,ypart llcorner multipar)) ; + _pa_ := (xpart _pa_,max(ypart _pa_,ypart llcorner multipar)) ; if same_area : -% _pa_ := (xpart _pa_,max(ypart _pa_,ypart llxy[tpos])) ; - _pa_ := (xpart _pa_,max(ypart _pa_ -TopSkipCorrection,ypart llxy[tpos])) ; + _pa_ := (xpart _pa_,max(ypart _pa_,ypart llxy[tpos])) ; fi ; +% vervalt: if obey_multi_par_more and (round(par_line_height)>0) : par_hang_after := min(0,round(par_hang_after + (ypart urxy[fpos]-ypart _pa_)/par_line_height)) ; @@ -540,8 +539,7 @@ par_hang_after := ra + estimated_par_lines(py-fy) ; vardef right_top_hang (expr same_area) = -% par_hang_after := ra - estimated_par_lines(py-fy) ; -par_hang_after := ra + estimated_par_lines(py-fy) ; +par_hang_after := ra - estimated_par_lines(py-fy) ; if (par_hang_indent<0) and (par_hang_after<0) and obey_multi_par_hang : pair _ur_ ; _ur_ := (xpart urcorner multipar, ypart snapped_multi_pos(urxy[fpos])) ; @@ -1242,7 +1240,6 @@ vardef PrepareSyncTasks(expr n, collapse, extendtop, prestartnext) = NOfSyncPaths := NOfSyncPaths + 1 ; if not ok : if i>1 : -% not yet correct when two of the same follow each other if sync_t[n][i-1] = sync_t[n][i] : SyncPaths[NOfSyncPaths] := SyncBox(n, i, SyncLeftOffset, SyncWidth, PaperHeight, -PaperHeight) ; SyncTasks[NOfSyncPaths] := i ; diff --git a/metapost/context/base/mp-figs.mp b/metapost/context/base/mp-figs.mp deleted file mode 100644 index aa6bc0399..000000000 --- a/metapost/context/base/mp-figs.mp +++ /dev/null @@ -1,50 +0,0 @@ -%D \module -%D [ file=mp-tool.mp, -%D version=2003.01.15, -%D title=\CONTEXT\ \METAPOST\ graphics, -%D subtitle=figures, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See licen-en.pdf for -%C details. - -if unknown context_tool : input mp-tool ; fi ; -if known context_figs : endinput ; fi ; - -boolean context_figs ; context_figs := true ; - -% todo: check defined - -def registerfigure(expr name,width,height) = - begingroup ; - save s ; string s ; s := cleanstring(name) ; - scantokens( s & "_width := " & decimal(width)) ; - scantokens( s & "_height := " & decimal(width)) ; - endgroup ; -enddef ; - -vardef figuresize(expr name) = - save s ; string s ; s := cleanstring(name) ; - save p ; pair p ; - scantokens( "p := " & "(" & s & "_width" & "," & s & "_height" & ")" ) ; - p -enddef ; - -vardef figurewidth(expr name) = - xpart figuresize(name) -enddef ; - -vardef figureheight(expr name) = - ypart figuresize(name) -enddef ; - -def figuredimensions = figuresize enddef ; % for old times sake - -def naturalfigure(expr name) = - externalfigure name xyscaled(figuresize(name)) -enddef ; - -endinput diff --git a/metapost/context/base/mp-spec.mp b/metapost/context/base/mp-spec.mp index bef6cd2fa..b005eb381 100644 --- a/metapost/context/base/mp-spec.mp +++ b/metapost/context/base/mp-spec.mp @@ -414,106 +414,34 @@ resetspotcolors ; boolean spotcolors ; spotcolors := false ; % true string spotcolorpattern[] ; % needed for transparancies -% vardef spotcolor(expr p, s) = -% if spotcolors : -% save ok, pc_tag ; boolean ok ; string pc_tag ; -% pc_tag := "_pct_"&p ; -% if not unstringed(pc_tag) : -% _spotcolor_number_ := _spotcolor_number_ + 1 ; -% setunstringed(pc_tag,_spotcolor_number_) ; -% fi ; -% pp := getunstringed(pc_tag) ; -% if unknown spotcolorhash[pp][s] : -% ok := false ; % not yet defined -% elseif spotcolorhash[pp][s] = -1 : -% ok := false ; % locally defined and undefined -% else : -% ok := true ; % globally already defined -% fi ; -% if not ok : -% save ss ; string ss ; ss := p & " " & decimal s ; -% _spotcolor_counter_ := _spotcolor_counter_ + 1 ; -% spotcolorpattern[_spotcolor_counter_/1000] := ss ; -% spotcolorhash[pp][s] := _spotcolor_counter_ ; -% flush_special(2, 5, decimal _spotcolor_counter_ & " " & ss) ; -% _local_specials_ := _local_specials_ & -% "spotcolorhash["&decimal pp&"]["&decimal s&"]:=-1;" ; -% fi ; -% (_special_signal_/1000,2/1000,spotcolorhash[pp][s]/1000) -% else : -% (1-s,1-s,1-s) -% fi -% enddef ; - -% vardef spotcolor(expr p, s) = -% if spotcolors : -% save ok, pc_tag ; boolean ok ; string pc_tag ; -% pc_tag := "_pct_"&p ; -% if not unstringed(pc_tag) : -% _spotcolor_number_ := _spotcolor_number_ + 1 ; -% setunstringed(pc_tag,_spotcolor_number_) ; -% fi ; -% pp := getunstringed(pc_tag) ; -% if unknown spotcolorhash[pp][s] : -% ok := false ; % not yet defined -% elseif spotcolorhash[pp][s] = -1 : -% ok := false ; % locally defined and undefined -% else : -% ok := true ; % globally already defined -% fi ; -% if not ok : -% save ss ; string ss ; ss := p & " " & decimal s ; -% _spotcolor_counter_ := _spotcolor_counter_ + 1 ; -% spotcolorpattern[_spotcolor_counter_/1000] := ss ; -% spotcolorhash[pp][s] := _spotcolor_counter_ ; -% flush_special(2, 5, decimal _spotcolor_counter_ & " " & ss) ; -% _local_specials_ := _local_specials_ & -% "spotcolorhash["&decimal pp&"]["&decimal s&"]:=-1;" ; -% fi ; -% (_special_signal_/1000,2/1000,spotcolorhash[pp][s]/1000) -% else : -% (1-s,1-s,1-s) -% fi -% enddef ; - vardef spotcolor(expr p, s) = - multitonecolor(p, 1, "", decimal s) -enddef ; - -vardef multitonecolor(expr n, f, d, p) = % name fractions names factors if spotcolors : save ok, pc_tag ; boolean ok ; string pc_tag ; - pc_tag := "_pct_" & n ; + pc_tag := "_pct_"&p ; if not unstringed(pc_tag) : _spotcolor_number_ := _spotcolor_number_ + 1 ; setunstringed(pc_tag,_spotcolor_number_) ; fi ; pp := getunstringed(pc_tag) ; - pc_tag := "_pct_"& decimal f & "_" & if d = "" : n else : d fi & "_" & p ; % check for d empty - if not unstringed(pc_tag) : - _spotcolor_number_ := _spotcolor_number_ + 1 ; - setunstringed(pc_tag,_spotcolor_number_) ; - fi ; - ps := getunstringed(pc_tag) ; - if unknown spotcolorhash[pp][ps] : + if unknown spotcolorhash[pp][s] : ok := false ; % not yet defined - elseif spotcolorhash[pp][ps] = -1 : + elseif spotcolorhash[pp][s] = -1 : ok := false ; % locally defined and undefined else : ok := true ; % globally already defined fi ; if not ok : - save ss ; string ss ; ss := n & " " & decimal f & " " & if d = "" : n else : d fi & " " & p ; + save ss ; string ss ; ss := p & " " & decimal s ; _spotcolor_counter_ := _spotcolor_counter_ + 1 ; spotcolorpattern[_spotcolor_counter_/1000] := ss ; - spotcolorhash[pp][ps] := _spotcolor_counter_ ; - flush_special(2, 7, decimal _spotcolor_counter_ & " " & ss) ; + spotcolorhash[pp][s] := _spotcolor_counter_ ; + flush_special(2, 5, decimal _spotcolor_counter_ & " " & ss) ; _local_specials_ := _local_specials_ & - "spotcolorhash["&decimal pp&"]["&decimal ps&"]:=-1;" ; + "spotcolorhash["&decimal pp&"]["&decimal s&"]:=-1;" ; fi ; - (_special_signal_/1000,2/1000,spotcolorhash[pp][ps]/1000) + (_special_signal_/1000,2/1000,spotcolorhash[pp][s]/1000) else : - .5white + (1-s,1-s,1-s) fi enddef ; @@ -531,63 +459,6 @@ differencetransparent := 11 ; exclusiontransparent := 12 ; % fill fullcircle scaled 10cm withcolor transparant(.8,3,color) ; -% vardef transparent(expr n, t, c) = -% save s, ss, nn, cc, is_cmyk, is_spot, ok ; -% string s, ss ; numeric nn ; color cc ; boolean is_cmyk, is_spot, ok ; -% % transparancy type -% if string n : -% if expandafter known scantokens(n&"transparent") : -% nn := scantokens(n&"transparent") ; -% else : -% nn := 0 ; -% fi -% else : % nn := min(n,13) -% nn := if n<13 : n else : nn := 0 fi ; -% fi ; -% % we need to expand the color (can be cmyk(..) or predefined) -% cc := c ; % expand color -% % check for cmyk special -% is_cmyk := (redpart cc = _special_signal_/1000) -% and (greenpart cc = 1/1000) ; -% is_spot := (redpart cc = _special_signal_/1000) -% and (greenpart cc = 2/1000) ; -% % build special string, fetch cmyk components -% s := decimal nn & " " & decimal t & " " & -% if is_cmyk : cmykcolorpattern[bluepart cc] -% elseif is_spot : spotcolorpattern[bluepart cc] -% else : dddecimal cc fi ; -% % check if this one is already used -% ss := "tr_" & s ; -% % efficiency hack -% if expandafter unknown scantokens(ss) : -% ok := false ; % not yet defined -% elseif scantokens(ss) < 0 : -% ok := false ; % locally defined and undefined -% else : -% ok := true ; % globally already defined -% fi ; -% if not ok : -% if is_spot : -% flush_special(5, 6, s) ; -% elseif is_cmyk : -% flush_special(4, 8, s) ; -% else : -% flush_special(3, 7, s) ; -% fi ; -% scantokens(ss) := _special_counter_ ; -% _local_specials_ := _local_specials_ & -% "scantokens(" & ditto & ss & ditto & ") := -1 ;" ; -% fi ; -% % go ahead -% if is_spot : -% (_special_signal_/1000,5/1000,scantokens(ss)/1000) -% elseif is_cmyk : -% (_special_signal_/1000,4/1000,scantokens(ss)/1000) -% else : -% (_special_signal_/1000,3/1000,scantokens(ss)/1000) -% fi -% enddef ; - vardef transparent(expr n, t, c) = save s, ss, nn, cc, is_cmyk, is_spot, ok ; string s, ss ; numeric nn ; color cc ; boolean is_cmyk, is_spot, ok ; @@ -614,12 +485,7 @@ vardef transparent(expr n, t, c) = elseif is_spot : spotcolorpattern[bluepart cc] else : dddecimal cc fi ; % check if this one is already used - ss := cleanstring("tr_" & s) ; - % we now have rather unique names, i.e. a color spec of .234 becomes - % tr..._234.... and metapost gives a number overflow (parse error) - % for variables like tr_12345678 which may result from many decimal - % positions (imo mp bug) - ss := asciistring(ss) ; + ss := "tr_" & s ; % efficiency hack if expandafter unknown scantokens(ss) : ok := false ; % not yet defined @@ -630,7 +496,7 @@ vardef transparent(expr n, t, c) = fi ; if not ok : if is_spot : - flush_special(5, 8, s) ; + flush_special(5, 6, s) ; elseif is_cmyk : flush_special(4, 8, s) ; else : @@ -704,4 +570,4 @@ enddef ; % spotcolor is already scaled -endinput ; +endinput ; \ No newline at end of file diff --git a/metapost/context/base/mp-text.mp b/metapost/context/base/mp-text.mp index 2e061df09..cb6bb3895 100644 --- a/metapost/context/base/mp-text.mp +++ b/metapost/context/base/mp-text.mp @@ -2,182 +2,165 @@ %D [ file=mp-text.mp, %D version=2000.07.10, %D title=\CONTEXT\ \METAPOST\ graphics, -%D subtitle=text support, +%D subtitle=text support, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See licen-en.pdf for -%C details. +%C therefore copyrighted by \PRAGMA. See licen-en.pdf for +%C details. %D Under construction. -if unknown context_tool : input mp-tool ; fi ; -if known context_text : endinput ; fi ; +if unknown context_tool : input mp-tool ; fi ; +if known context_text : endinput ; fi ; -boolean context_text ; context_text := true ; +boolean context_text ; context_text := true ; -if unknown noftexpictures : - numeric noftexpictures ; noftexpictures := 0 ; -fi ; +if unknown noftexpictures : + numeric noftexpictures ; noftexpictures := 0 ; +fi ; -if unknown texpictures[1] : - picture texpictures[] ; -fi ; +if unknown texpictures[1] : + picture texpictures[] ; +fi ; -numeric textextoffset ; textextoffset := 0 ; +numeric textextoffset ; textextoffset := 0 ; -% vardef textext@#(expr txt) = -% interim labeloffset := textextoffset ; -% noftexpictures := noftexpictures + 1 ; -% if string txt : -% write "% figure " & decimal charcode & " : " & -% "texpictures[" & decimal noftexpictures & "] := btex " & -% txt & " etex ;" to jobname & ".mpt" ; -% if unknown texpictures[noftexpictures] : -% thelabel@#("unknown",origin) +% vardef textext@#(expr txt) = +% interim labeloffset := textextoffset ; +% noftexpictures := noftexpictures + 1 ; +% if string txt : +% write "% figure " & decimal charcode & " : " & +% "texpictures[" & decimal noftexpictures & "] := btex " & +% txt & " etex ;" to jobname & ".mpt" ; +% if unknown texpictures[noftexpictures] : +% thelabel@#("unknown",origin) % else : -% thelabel@#(texpictures[noftexpictures],origin) -% fi +% thelabel@#(texpictures[noftexpictures],origin) +% fi % else : -% thelabel@#(txt,origin) -% fi -% enddef ; - -boolean hobbiestextext ; hobbiestextext := false ; -% string textextstring ; textextstring := "" ; - -% def resettextextdirective = -% textextstring := "" ; -% enddef ; - -% def textextdirective text t = -% textextstring := textextstring & t ; -% enddef ; - -vardef textext@#(expr txt) = - save _s_ ; string _s_ ; - interim labeloffset := textextoffset ; - noftexpictures := noftexpictures + 1 ; - if string txt : -% if textextstring <> "" : -% _s_ := "verbatimtex " & textextstring & " etex ;" ; -% else : -% _s_ := "" ; -% fi ; +% thelabel@#(txt,origin) +% fi +% enddef ; + +boolean hobbiestextext ; hobbiestextext := false ; + +vardef textext@#(expr txt) = + interim labeloffset := textextoffset ; + noftexpictures := noftexpictures + 1 ; + if string txt : if hobbiestextext : % the tex.mp method as fallback (see tex.mp) -% write _s_ to "mptextmp.mp" ; - write _s_ & "btex " & txt & " etex" to "mptextmp.mp" ; + write "btex " & txt & " etex" to "mptextmp.mp" ; write EOF to "mptextmp.mp" ; scantokens "input mptextmp" else : -% write "% setup : " & _s_ to jobname & ".mpt" ; - write "% figure " & decimal charcode & " : " & - "texpictures[" & decimal noftexpictures & "] := btex " & - txt & " etex ;" to jobname & ".mpt" ; - if unknown texpictures[noftexpictures] : - thelabel@#("unknown",origin) + write "% figure " & decimal charcode & " : " & + "texpictures[" & decimal noftexpictures & "] := btex " & + txt & " etex ;" to jobname & ".mpt" ; + if unknown texpictures[noftexpictures] : + thelabel@#("unknown",origin) else : - thelabel@#(texpictures[noftexpictures],origin) + thelabel@#(texpictures[noftexpictures],origin) fi - fi + fi else : - thelabel@#(txt,origin) - fi -enddef ; - -string laboff_ ; laboff_ := "" ; -string laboff_c ; laboff_c := "" ; -string laboff_l ; laboff_l := ".lft" ; -string laboff_r ; laboff_r := ".rt" ; -string laboff_b ; laboff_b := ".bot" ; -string laboff_t ; laboff_t := ".top" ; -string laboff_lt ; laboff_lt := ".ulft" ; -string laboff_rt ; laboff_rt := ".urt" ; -string laboff_lb ; laboff_lb := ".llft" ; -string laboff_rb ; laboff_rb := ".lrt" ; -string laboff_tl ; laboff_tl := ".ulft" ; -string laboff_tr ; laboff_tr := ".urt" ; -string laboff_bl ; laboff_bl := ".llft" ; -string laboff_br ; laboff_br := ".lrt" ; - -vardef textextstr(expr s, a) = - save ss ; string ss ; - ss := "laboff_" & a ; - ss := scantokens ss ; + thelabel@#(txt,origin) + fi +enddef ; + +string laboff_ ; laboff_ := "" ; +string laboff_c ; laboff_c := "" ; +string laboff_l ; laboff_l := ".lft" ; +string laboff_r ; laboff_r := ".rt" ; +string laboff_b ; laboff_b := ".bot" ; +string laboff_t ; laboff_t := ".top" ; +string laboff_lt ; laboff_lt := ".ulft" ; +string laboff_rt ; laboff_rt := ".urt" ; +string laboff_lb ; laboff_lb := ".llft" ; +string laboff_rb ; laboff_rb := ".lrt" ; +string laboff_tl ; laboff_tl := ".ulft" ; +string laboff_tr ; laboff_tr := ".urt" ; +string laboff_bl ; laboff_bl := ".llft" ; +string laboff_br ; laboff_br := ".lrt" ; + +vardef textextstr(expr s, a) = + save ss ; string ss ; + ss := "laboff_" & a ; + ss := scantokens ss ; ss := "textext" & ss & "(" & ditto & s & ditto & ")" ; - scantokens ss -enddef ; + scantokens ss +enddef ; -pair laboff.origin ; laboff.origin = (infinity,infinity) ; -pair laboff.raw ; laboff.raw = (infinity,infinity) ; +pair laboff.origin ; laboff.origin = (infinity,infinity) ; +pair laboff.raw ; laboff.raw = (infinity,infinity) ; -vardef thelabel@#(expr s, z) = +vardef thelabel@#(expr s, z) = save p ; picture p ; p = s if not picture s : infont defaultfont scaled defaultscale fi ; - if laboff@#<>laboff.origin : - (p shifted (z + labeloffset*laboff@# - (labxf@#*lrcorner p + + if laboff@#<>laboff.origin : + (p shifted (z + labeloffset*laboff@# - (labxf@#*lrcorner p + labyf@#*ulcorner p + (1-labxf@#-labyf@#)*llcorner p))) else : (p shifted z) fi enddef; -def build_parshape (expr p, offset_or_path, dx, dy, +def build_parshape (expr p, offset_or_path, dx, dy, baselineskip, strutheight, strutdepth, topskip) = - - if unknown trace_parshape : - boolean trace_parshape ; trace_parshape := false ; + + if unknown trace_parshape : + boolean trace_parshape ; trace_parshape := false ; fi ; begingroup ; - save q, l, r, line, tt, bb, - n, hsize, vsize, vvsize, voffset, hoffset, width, indent, - ll, lll, rr, rrr, cp, cq, t, b ; + save q, l, r, line, tt, bb, + n, hsize, vsize, vvsize, voffset, hoffset, width, indent, + ll, lll, rr, rrr, cp, cq, t, b ; - path q, l, r, line, tt, bb ; + path q, l, r, line, tt, bb ; numeric n, hsize, vsize, vvsize, voffset, hoffset, width[], indent[] ; - pair ll, lll, rr, rrr, cp, cq, t, b ; + pair ll, lll, rr, rrr, cp, cq, t, b ; - n := 0 ; cp := center p ; + n := 0 ; cp := center p ; - if path offset_or_path : - q := offset_or_path ; cq := center q ; - voffset := dy ; - hoffset := dx ; - else : - q := p ; cq := center q ; + if path offset_or_path : + q := offset_or_path ; cq := center q ; + voffset := dy ; + hoffset := dx ; + else : + q := p ; cq := center q ; hoffset := offset_or_path + dx ; - voffset := offset_or_path + dy ; - fi ; + voffset := offset_or_path + dy ; + fi ; - hsize := xpart lrcorner q - xpart llcorner q ; - vsize := ypart urcorner q - ypart lrcorner q ; + hsize := xpart lrcorner q - xpart llcorner q ; + vsize := ypart urcorner q - ypart lrcorner q ; - q := p shifted - cp ; + q := p shifted - cp ; - startsavingdata ; + startsavingdata ; - savedata "\global\parvoffset " & decimal voffset&"bp " ; - savedata "\global\parhoffset " & decimal hoffset&"bp " ; - savedata "\global\parwidth " & decimal hsize&"bp " ; - savedata "\global\parheight " & decimal vsize&"bp " ; + savedata "\global\parvoffset " & decimal voffset&"bp " ; + savedata "\global\parhoffset " & decimal hoffset&"bp " ; + savedata "\global\parwidth " & decimal hsize&"bp " ; + savedata "\global\parheight " & decimal vsize&"bp " ; - if not path offset_or_path : - q := q xscaled ((hsize-2hoffset)/hsize) - yscaled ((vsize-2voffset)/vsize) ; - fi ; + if not path offset_or_path : + q := q xscaled ((hsize-2hoffset)/hsize) + yscaled ((vsize-2voffset)/vsize) ; + fi ; - hsize := xpart lrcorner q - xpart llcorner q ; - vsize := ypart urcorner q - ypart lrcorner q ; + hsize := xpart lrcorner q - xpart llcorner q ; + vsize := ypart urcorner q - ypart lrcorner q ; - t := (ulcorner q -- urcorner q) intersection_point q ; - b := (llcorner q -- lrcorner q) intersection_point q ; + t := (ulcorner q -- urcorner q) intersection_point q ; + b := (llcorner q -- lrcorner q) intersection_point q ; - if xpart directionpoint t of q < 0 : - q := reverse q ; + if xpart directionpoint t of q < 0 : + q := reverse q ; fi ; l := q cutbefore t ; @@ -186,82 +169,82 @@ def build_parshape (expr p, offset_or_path, dx, dy, r := q cutbefore b ; r := r if xpart point 0 of q > 0 : & q fi cutafter t ; -% tt := (ulcorner q -- urcorner q) shifted (0,-topskip) ; -% bb := (llcorner q -- lrcorner q) shifted (0,strutdepth) ; +% tt := (ulcorner q -- urcorner q) shifted (0,-topskip) ; +% bb := (llcorner q -- lrcorner q) shifted (0,strutdepth) ; % -% l := l cutbefore (l intersection_point tt) ; -% l := l cutafter (l intersection_point bb) ; -% r := r cutbefore (r intersection_point bb) ; -% r := r cutafter (r intersection_point tt) ; +% l := l cutbefore (l intersection_point tt) ; +% l := l cutafter (l intersection_point bb) ; +% r := r cutbefore (r intersection_point bb) ; +% r := r cutafter (r intersection_point tt) ; - if trace_parshape : + if trace_parshape : drawarrow p withpen pencircle scaled 2pt withcolor red ; drawarrow l shifted cp withpen pencircle scaled 1pt withcolor green ; drawarrow r shifted cp withpen pencircle scaled 1pt withcolor blue ; - fi ; + fi ; - vardef found_point (expr lin, pat, sig) = + vardef found_point (expr lin, pat, sig) = pair a, b ; a := pat intersection_point (lin shifted (0,strutheight)) ; - if intersection_found : + if intersection_found : a := a shifted (0,-strutheight) ; else : a := pat intersection_point lin ; fi ; b := pat intersection_point (lin shifted (0,-strutdepth)) ; - if intersection_found : - if sig : - if xpart b > xpart a : a := b shifted (0,strutdepth) fi ; - else : - if xpart b < xpart a : a := b shifted (0,strutdepth) fi ; - fi ; - fi ; - a + if intersection_found : + if sig : + if xpart b > xpart a : a := b shifted (0,strutdepth) fi ; + else : + if xpart b < xpart a : a := b shifted (0,strutdepth) fi ; + fi ; + fi ; + a enddef ; - if (strutheight+strutdepth= ASCII "0") and (ASCII si <= ASCII "9") : - ss := ss & char(scantokens(si) + ASCII "A") ; - else : - ss := ss & si ; - fi ; + ss := ss & if known _clean_ascii[ASCII si] : _clean_ascii[ASCII si] else : si fi ; endfor ; ss enddef ; @@ -2257,4 +2195,4 @@ enddef ; % done -endinput ; +endinput ; \ No newline at end of file -- cgit v1.2.3