PDFdev is a service provided by PDFzone.com | http://www.pdfzone.com
_____________________________________________________________

Thanks Mark.  Actually 45 isn't required.  Doing too many things at once and
numbers just kept rolling outta my head.

Gordon Campbell
PRO-SYS Consultants Ltd.
(780) 993-0704
www.epro-sys.com

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Mark Storer
Sent: Friday, June 20, 2003 3:13 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PDFdev] Rotating Text


PDFdev is a service provided by PDFzone.com | http://www.pdfzone.com
_____________________________________________________________

In general, the values are:
a     b    c    d    h  v
cos, -sin, sin, cos, x, y

0, 90, 180, and 270 are pretty standard.  Why 45 as well?

Here's a slice of code from a text layout engine I did a few years ago.

static Fixed fixedNegOne = fixedZero - fixedOne;
static Fixed matrixRot[4][4] =
{// a           b            c            d
  {fixedOne,    0,           0,           fixedOne},
  {0,           fixedNegOne, fixedOne,    0},
  {fixedNegOne, 0,           0,           fixedNegOne},

  {0,           fixedOne,    fixedNegOne, 0}
};

In case you're not used to Adobe's PDF-speak, "Fixed" is a fixed point float
type, 16.16.  Regular math operators work for addition and subtraction, but
you need helper functions for anything else.

Note that I didn't get those sin/cos values from some book somewhere, just
empirical observation.  I built a Word file with text rotated at the various
cardinal angles, then took a look at the content streams to figure out what
was going on.  Elementary my dear Watson.

I ended up computing the three matrixes (translate, rotate, scale) I needed
independantly and then combining them in the proper order.  MUCH easier than
figuring out what the final values are supposed to be out of the gate (which
is how I did it the first itteration of that code...  Ouch).

I also ended up writing some code to blow the pages media box out by 1000 in
all directions, and drawing a rectangle for the original page borders so I
could find out where the text went while I was getting this stuff to work.
And there's STILL at least one pair of "sign" errors in that code.  I only
know where one half of a pair is, but "If it ain't broke" and all that.

--Mark Storer
  Software Engineer
  Cardiff Software
#include <disclaimer>
typdef std::disclaimer<Cardiff> Discard;


> -----Original Message-----
> From: Gordon Campbell [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 20, 2003 1:54 PM
> To: [EMAIL PROTECTED]
> Subject: [PDFdev] Rotating Text
>
>
>
> PDFdev is a service provided by PDFzone.com | http://www.pdfzone.com
> _____________________________________________________________
>
> What would the Text matrix look like if I wanted to print a
> text string at a
> 45,90,180 and 270 degree angle? (assume I know the X,Y coordinates)
>
> TIA,
> Gordon Campbell
> PRO-SYS Consultants Ltd.
> (780) 993-0704
> www.epro-sys.com
>
>
>
>
> To change your subscription:
> http://www.pdfzone.com/discussions/lists-pdfdev.html
>

To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfdev.html



To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfdev.html

Reply via email to