[NTG-context] Rotation fails in the latest beta

Wolfgang Schuster schuster.wolfgang at googlemail.com
Thu Feb 9 17:34:39 CET 2012


Am 09.02.2012 um 17:09 schrieb Marco:

> On 2012-02-09 Wolfgang Schuster <schuster.wolfgang at googlemail.com> wrote:
> 
>> pack-rul.mkiv:
>> 
>> \def\pack_framed_start_orientation
>> - {\ifcase\p_framed_orientation\else
>> + {\ifcase\p_framed_orientation
> 
> Thanks for the quick fix.
> 
> Why do orientation and rotate produce different results? Example:
> 
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \startbuffer [te]
> 	\starttext
> 		\framed[width=5cm,height=2cm,rulethickness=3pt,align=right]{\tfd Foo}
> 	\stoptext
> \stopbuffer
> 
> \starttext
> 	\startplacefigure [title=Orientation]
> 		\externalfigure [te] [orientation=90, frame=on]
> 	\stopplacefigure
> 
> 	\startplacefigure [title=Rotation]
> 		\rotate[rotation=90]{\externalfigure [te]}
> 	\stopplacefigure
> \stoptext
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


I guess it comes from this part in pack-rul.mkiv, when you rotate the box by 90 or 270 degrees
context switches the width and height of the framed box (which is also used by \externalfigure)
but as you can see he does this first in \pack_framed_start_orientation and a second time in
\pack_framed_stop_orientation_odd.

\def\pack_framed_start_orientation
  {\ifcase\p_framed_orientation
     \let\pack_framed_stop_orientation\relax
   \else
     \scratchcounter\p_framed_orientation % weird .. why
     \divide\scratchcounter\plustwo
     \ifodd\scratchcounter
       \swapmacros\framedwidth\framedheight
       \swapmacros\localwidth\localheight
       \swapdimens\d_framed_height\d_framed_width
       \let\pack_framed_stop_orientation\pack_framed_stop_orientation_odd
     \else
       \let\pack_framed_stop_orientation\pack_framed_stop_orientation_even
     \fi
   \fi}

% why are the dimensions swapped again, this was already done above

\def\pack_framed_stop_orientation_odd
  {\swapmacros\framedwidth\framedheight
   \swapmacros\localwidth\localheight
   \swapdimens\d_framed_height\d_framed_width
   \pack_framed_stop_orientation_even}

Wolfgang


More information about the ntg-context mailing list