diff options
author | Karl Berry <karl@freefriends.org> | 2021-03-06 21:58:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-03-06 21:58:15 +0000 |
commit | 974640d66e61e81cb197ad96fdff7b08343e4c5a (patch) | |
tree | 2e1f75f32f312b7f24ba82b4590ae230bcd6f399 /Master/texmf-dist/tex/context/base/mkiv/grph-trf.mkiv | |
parent | b4fa72e61230aca75f7f6fbf988821f71edfb6b2 (diff) |
context
git-svn-id: svn://tug.org/texlive/trunk@58167 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/grph-trf.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/grph-trf.mkiv | 163 |
1 files changed, 62 insertions, 101 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/grph-trf.mkiv b/Master/texmf-dist/tex/context/base/mkiv/grph-trf.mkiv index f9218036c33..d6a6acd78ca 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/grph-trf.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/grph-trf.mkiv @@ -24,6 +24,8 @@ %D We could move the calculations to \LUA\ and clean up this lot anyway. On the %D other hand, there is some danger of messing up so it has a real low priority. +\registerctxluafile{grph-trf}{} + % local: \newdimen\d_grph_scale_x_size @@ -794,6 +796,8 @@ \installcorenamespace {rotatelocation} \installcorenamespace {rotatepreset} +% todo: scratchcounters + \newdimen\d_grph_rotate_x_size \newdimen\d_grph_rotate_y_size \newdimen\d_grph_rotate_x_offset @@ -811,6 +815,10 @@ \let\d_grph_rotate_saved_height\!!heightb \let\d_grph_rotate_saved_depth \!!depthb +\let\d_grph_rotate_new_width \!!widthc +\let\d_grph_rotate_new_height\!!heightc +\let\d_grph_rotate_new_depth \!!depthc + \newconditional\c_grph_rotate_obey_depth \newconditional\c_grph_rotate_not_fit \newconditional\c_grph_rotate_center @@ -948,111 +956,30 @@ \d_grph_rotate_saved_width \wd\nextbox \d_grph_rotate_saved_height\ht\nextbox \d_grph_rotate_saved_depth \dp\nextbox - \setbox\nextbox\naturalvpack{\vskip.5\ht\nextbox\hskip-.5\wd\nextbox\box\nextbox}% + \setbox\nextbox\naturalhpack{\hskip-.5\wd\nextbox\lower.5\ht\nextbox\box\nextbox}% \smashbox\nextbox \fi + % \d_grph_rotate_width \wd\nextbox \d_grph_rotate_height\ht\nextbox \d_grph_rotate_depth \dp\nextbox - \setbox\nextbox\naturalvpack{\naturalhpack{\raise\dp\nextbox\box\nextbox}}% - \d_grph_rotate_used_height \ht\nextbox - % much of the next happens in lua (all the sin and cos) so we can do that in - % one go if needed - \setcalculatedcos\cos\p_rotation_rotation - \setcalculatedsin\sin\p_rotation_rotation - \ifdim\sin\points>\zeropoint - \ifdim\cos\points>\zeropoint - \grph_rotate_calculate_a - \grph_rotate_apply - \else - \grph_rotate_calculate_b - \grph_rotate_apply - \wd\nextbox\ifconditional\c_grph_rotate_not_fit\sin\d_grph_rotate_depth\else\d_grph_rotate_x_size\fi - \fi - \else - \ifdim\cos\points<\zeropoint - \grph_rotate_calculate_c - \grph_rotate_apply - \wd\nextbox\ifconditional\c_grph_rotate_not_fit\negated\sin\d_grph_rotate_height\else\d_grph_rotate_x_size\fi - \else\ifdim\sin\points=\zeropoint - \grph_rotate_calculate_d - \grph_rotate_apply - % no wd ? - \else - \grph_rotate_calculate_e - \grph_rotate_apply - \wd\nextbox\ifconditional\c_grph_rotate_not_fit\negated\sin\d_grph_rotate_height\else\d_grph_rotate_x_size\fi - \fi\fi - \fi - \ifconditional\c_grph_rotate_center - \setbox\nextbox\naturalvpack{\vskip-.5\d_grph_rotate_saved_height\hskip.5\d_grph_rotate_saved_height\box\nextbox}% - \wd\nextbox\d_grph_rotate_saved_width - \ht\nextbox\d_grph_rotate_saved_height - \dp\nextbox\d_grph_rotate_saved_depth - \fi - \boxcursor\box\nextbox} - -\def\grph_rotate_calculate_a - {\d_grph_rotate_x_size\dimexpr\cos\d_grph_rotate_width+\sin\d_grph_rotate_used_height\relax - \d_grph_rotate_y_size\dimexpr\sin\d_grph_rotate_width+\cos\d_grph_rotate_used_height\relax - \d_grph_rotate_x_position\zeropoint - \d_grph_rotate_y_position\cos\d_grph_rotate_used_height - \ifconditional\c_grph_rotate_not_fit - \d_grph_rotate_x_offset\dimexpr\negated\sin\d_grph_rotate_used_height+\sin\d_grph_rotate_depth\relax - \fi - \ifconditional\c_grph_rotate_obey_depth - \d_grph_rotate_y_offset\cos\d_grph_rotate_depth - \fi} - -\def\grph_rotate_calculate_b - {\d_grph_rotate_x_size\dimexpr\negated\cos\d_grph_rotate_width+\sin\d_grph_rotate_used_height\relax - \d_grph_rotate_y_size\dimexpr\sin\d_grph_rotate_width+\negated\cos\d_grph_rotate_used_height\relax - \d_grph_rotate_x_position\negated\cos\d_grph_rotate_width - \d_grph_rotate_y_position\zeropoint - \ifconditional\c_grph_rotate_not_fit - \d_grph_rotate_x_offset\dimexpr-\d_grph_rotate_x_size+\sin\d_grph_rotate_depth\relax - \fi - \ifconditional\c_grph_rotate_obey_depth - \d_grph_rotate_y_offset\negated\cos\d_grph_rotate_height - \fi} - -\def\grph_rotate_calculate_c - {\d_grph_rotate_x_size\dimexpr\negated\cos\d_grph_rotate_width+\negated\sin\d_grph_rotate_used_height\relax - \d_grph_rotate_y_size\dimexpr\negated\sin\d_grph_rotate_width+\negated\cos\d_grph_rotate_used_height\relax - \d_grph_rotate_x_position\d_grph_rotate_x_size - \d_grph_rotate_y_position\negated\sin\d_grph_rotate_width - \ifconditional\c_grph_rotate_not_fit - \d_grph_rotate_x_offset\dimexpr-\d_grph_rotate_x_size+\negated\sin\d_grph_rotate_height\relax - \fi - \ifconditional\c_grph_rotate_obey_depth - \d_grph_rotate_y_offset\dimexpr\d_grph_rotate_y_size+\cos\d_grph_rotate_depth\relax - \fi} - -\def\grph_rotate_calculate_d - {\d_grph_rotate_x_size\dimexpr\cos\d_grph_rotate_width+\negated\sin\d_grph_rotate_used_height\relax - \d_grph_rotate_y_size\dimexpr\negated\sin\d_grph_rotate_width+\cos\d_grph_rotate_used_height\relax - \d_grph_rotate_x_position\zeropoint - \d_grph_rotate_y_position\d_grph_rotate_y_size - \d_grph_rotate_x_offset\zeropoint - \ifconditional\c_grph_rotate_obey_depth - \d_grph_rotate_y_offset\d_grph_rotate_depth - \fi} - -\def\grph_rotate_calculate_e - {\d_grph_rotate_x_size\dimexpr\cos\d_grph_rotate_width+\negated\sin\d_grph_rotate_used_height\relax - \d_grph_rotate_y_size\dimexpr\negated\sin\d_grph_rotate_width+\cos\d_grph_rotate_used_height\relax - \d_grph_rotate_x_position\negated\sin\d_grph_rotate_used_height - \d_grph_rotate_y_position\d_grph_rotate_y_size - \ifconditional\c_grph_rotate_not_fit - \d_grph_rotate_x_offset\dimexpr-\d_grph_rotate_x_size+\negated\sin\d_grph_rotate_height\relax - \fi - \ifconditional\c_grph_rotate_obey_depth - \d_grph_rotate_y_offset\negated\sin\d_grph_rotate_depth - \fi} - -\def\grph_rotate_apply - {\setbox\nextbox\naturalvpack to \d_grph_rotate_y_size - {\vfill + % + \setbox\nextbox\naturalvpack{\naturalhpack{\raise\dp\nextbox\box\nextbox}}% can we do without + % + \d_grph_rotate_used_height\ht\nextbox + % + \clf_analyzerotate % rather accurate + \p_rotation_rotation\space + \d_grph_rotate_width + \d_grph_rotate_height + \d_grph_rotate_depth + \d_grph_rotate_used_height + \c_grph_rotate_not_fit + \c_grph_rotate_obey_depth + \relax + % + \setbox\nextbox\naturalvpack to \d_grph_rotate_y_size + {\vfilll \naturalhpack to \d_grph_rotate_x_size {\dostartrotation\p_rotation_rotation \wd\nextbox\zeropoint @@ -1061,9 +988,24 @@ \dostoprotation \hfill}% \kern\d_grph_rotate_y_position}% + % \setbox\nextbox\naturalhpack {\kern\dimexpr\d_grph_rotate_x_position+\d_grph_rotate_x_offset\relax - \lower\d_grph_rotate_y_offset\box\nextbox}} + \lower\d_grph_rotate_y_offset + \box\nextbox}% + % + \ifconditional\c_grph_rotate_center + \setbox\nextbox\naturalhpack{\hskip.5\d_grph_rotate_saved_width\lower-.5\d_grph_rotate_saved_height\box\nextbox}% + \wd\nextbox\d_grph_rotate_saved_width + \ht\nextbox\d_grph_rotate_saved_height + \dp\nextbox\d_grph_rotate_saved_depth + \else + \wd\nextbox\d_grph_rotate_new_width + \ht\nextbox\d_grph_rotate_new_height + \dp\nextbox\d_grph_rotate_new_depth + \fi + % + \boxcursor\box\nextbox} % \dostepwiserecurse{0}{360}{10} % {\startlinecorrection[blank] @@ -1077,4 +1019,23 @@ % \hbox to .2\hsize{\hss\ruledhbox{\rotate[location=high] {\ruledhbox{\bfb (high)}}}}} % \stoplinecorrection} +% \def\Test{\ruledhbox{% +% \def\DemoX{\vl\kern.5\emwidth\vl}% +% \kern\emwidth\ruledhpack{\green\rotate[rotation=20] {\ruledhpack{\DemoX}}}% +% \kern\emwidth\ruledhpack{\blue \rotate[rotation=0] {\ruledhpack{\DemoX}}}% +% \kern\emwidth\ruledhpack{\red \rotate[rotation=-20] {\ruledhpack{\DemoX}}}% +% \kern\emwidth\ruledhpack{\green\rotate[rotation=200] {\ruledhpack{\DemoX}}}% +% \kern\emwidth\ruledhpack{\blue \rotate[rotation=180] {\ruledhpack{\DemoX}}}% +% \kern\emwidth\ruledhpack{\red \rotate[rotation=-200]{\ruledhpack{\DemoX}}}% +% \kern\emwidth}} + +% \startTEXpage[offset=10pt,align=middle] +% \setuprotate[location=fit] \Test \par {\infofont\setstrut\strut fit} \par +% \setuprotate[location=depth] \Test \par {\infofont\setstrut\strut depth} \par +% \setuprotate[location=broad] \Test \par {\infofont\setstrut\strut broad} \par +% \setuprotate[location=high] \Test \par {\infofont\setstrut\strut high} \par +% \setuprotate[location=middle] \Test \par {\infofont\setstrut\strut middle} \par +% \setuprotate[location=default] \Test \par {\infofont\setstrut\strut default} \par +% \stopTEXpage + \protect \endinput |