diff options
author | Karl Berry <karl@freefriends.org> | 2019-02-28 15:11:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-02-28 15:11:56 +0000 |
commit | cc17ad601696f5cf966c8a0b9d79144cd42828a6 (patch) | |
tree | f6007b9b2f886d942f9b30b4797e8718001f65bd /Master/texmf-dist/metapost/context/base/mpiv/mp-bare.mpiv | |
parent | e298746bb92cdf7e87bc3b5b9bd973b6c429a47f (diff) |
context for tl19
git-svn-id: svn://tug.org/texlive/trunk@50165 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost/context/base/mpiv/mp-bare.mpiv')
-rw-r--r-- | Master/texmf-dist/metapost/context/base/mpiv/mp-bare.mpiv | 92 |
1 files changed, 44 insertions, 48 deletions
diff --git a/Master/texmf-dist/metapost/context/base/mpiv/mp-bare.mpiv b/Master/texmf-dist/metapost/context/base/mpiv/mp-bare.mpiv index c6194b1ee00..8f517b268c3 100644 --- a/Master/texmf-dist/metapost/context/base/mpiv/mp-bare.mpiv +++ b/Master/texmf-dist/metapost/context/base/mpiv/mp-bare.mpiv @@ -14,75 +14,71 @@ if known context_bare : endinput ; fi ; boolean context_bare ; context_bare := true ; -numeric mfun_tt_w[], mfun_tt_h[], mfun_tt_d[] ; +vardef colordecimals primary c = + if cmykcolor c : + decimal cyanpart c & ":" & decimal magentapart c & ":" & decimal yellowpart c & ":" & decimal blackpart c + elseif rgbcolor c : + decimal redpart c & ":" & decimal greenpart c & ":" & decimal bluepart c + else : + decimal c + fi +enddef ; + +rgbcolor mfun_tt_r ; numeric mfun_tt_n ; mfun_tt_n := 0 ; -picture mfun_tt_p ; mfun_tt_p := nullpicture ; picture mfun_tt_o ; mfun_tt_o := nullpicture ; picture mfun_tt_c ; mfun_tt_c := nullpicture ; -if unknown mfun_trial_run : - boolean mfun_trial_run ; - mfun_trial_run := false ; -fi ; - -if unknown mfun_first_run : - boolean mfun_first_run ; - mfun_first_run := true ; -fi ; - def mfun_reset_tex_texts = mfun_tt_n := 0 ; - mfun_tt_p := nullpicture ; mfun_tt_o := nullpicture ; % redundant mfun_tt_c := nullpicture ; % redundant enddef ; def mfun_flush_tex_texts = - addto currentpicture also mfun_tt_p -enddef ; - -extra_beginfig := extra_beginfig & "mfun_reset_tex_texts ;" ; -extra_endfig := "mfun_flush_tex_texts ; mfun_reset_tex_texts ; " & extra_endfig ; - -vardef colordecimals primary c = - if cmykcolor c : - decimal cyanpart c & ":" & decimal magentapart c & ":" & decimal yellowpart c & ":" & decimal blackpart c - elseif rgbcolor c : - decimal redpart c & ":" & decimal greenpart c & ":" & decimal bluepart c - else : - decimal c - fi enddef ; -vardef rawtextext(expr str) = % todo: avoid currentpicture - if str = "" : +vardef rawtextext(expr s) = + if s = "" : nullpicture else : mfun_tt_n := mfun_tt_n + 1 ; mfun_tt_c := nullpicture ; - if mfun_trial_run : - mfun_tt_o := nullpicture ; - addto mfun_tt_o doublepath origin _op_ ; % save drawoptions - addto mfun_tt_c doublepath unitsquare - withprescript "tx_number=" & decimal mfun_tt_n - withprescript "tx_stage=trial" - withprescript "tx_color=" & colordecimals colorpart mfun_tt_o - withpostscript str ; - addto mfun_tt_p also mfun_tt_c ; - elseif known mfun_tt_d[mfun_tt_n] : - addto mfun_tt_c doublepath unitsquare - xscaled mfun_tt_w[mfun_tt_n] - yscaled (mfun_tt_h[mfun_tt_n] + mfun_tt_d[mfun_tt_n]) - shifted (0,-mfun_tt_d[mfun_tt_n]) - withprescript "tx_number=" & decimal mfun_tt_n - withprescript "tx_stage=final" ; - else : - addto mfun_tt_c doublepath unitsquare ; % unitpicture - fi ; + mfun_tt_o := nullpicture ; + addto mfun_tt_o doublepath origin _op_ ; % save drawoptions + mfun_tt_r := runscript("mp.SomeText(" & decimal mfun_tt_n & "," & ditto & s & ditto & ")") ; + addto mfun_tt_c doublepath unitsquare + xscaled redpart mfun_tt_r + yscaled (greenpart mfun_tt_r + bluepart mfun_tt_r) + shifted (0,-bluepart mfun_tt_r) + withprescript "mf_object=text" + withprescript "tx_index=" & decimal mfun_tt_n + withprescript "tx_color=" & colordecimals colorpart mfun_tt_o + ; mfun_tt_c fi enddef ; +vardef rawmadetext = + mfun_tt_n := mfun_tt_n + 1 ; + mfun_tt_c := nullpicture ; + mfun_tt_o := nullpicture ; + addto mfun_tt_o doublepath origin _op_ ; % save drawoptions + mfun_tt_r := runscript("mp.MadeText(" & decimal mfun_tt_n & ")") ; + addto mfun_tt_c doublepath unitsquare + xscaled redpart mfun_tt_r + yscaled (greenpart mfun_tt_r + bluepart mfun_tt_r) + shifted (0,-bluepart mfun_tt_r) + withprescript "mf_object=text" + withprescript "tx_index=" & decimal mfun_tt_n + withprescript "tx_color=" & colordecimals colorpart mfun_tt_o + ; + mfun_tt_c +enddef ; + +extra_beginfig := extra_beginfig & "mfun_reset_tex_texts ;" ; +extra_endfig := "mfun_flush_tex_texts ; mfun_reset_tex_texts ; " & extra_endfig ; + primarydef str infont name = % nasty hack if name = "" : rawtextext(str) |