In article <1147957749.691701.225960@[EMAIL PROTECTED]
>,
"Neel" <nilesh_ibmr@[EMAIL PROTECTED]
> wrote:
> Hi,
> One of the module of my project of Landscap Re****t needs, where text is
> shown rotated by 90 degrees/ exactly vertically. I donīt know, how to
> rotate this text. I have seen past threads related to the same, also
> found CCapionPlus class has been written to resolve the same issue,but
> could not locate the same. Can anyone tell me which API should i use to
> put /draw text vertically. Can i use MacDrawText(...) ?
>
> Can anyone help me to solve.
>
> This is the code which draw text horizontally.
>
> // Prints the Text at the specified position
> virtual void DrawString(int f nX, int f nY, char *f cpStr)
> {
> ::RGBForeColor(&m sRGB Text);
> MoveTo(f nX, f nY + 12);
> ::DrawText((void *) f cpStr, 0, strlen(f cpStr));
>
> if ( m bLandScapeMode )
> {
> // Here want to draw text vertically / rotate to 90 degree.
> }
> }
I'd privately sent you CCaptionPlus, but it doesn't include sup****t for
high quality printing. _That_ was previously discussed in this newsgroup:
From: "Ilja A. Iwas" <iwas@[EMAIL PROTECTED]
>
Subject: Re: printing problem
Date: Mon, 14 Feb 2000 13:51:56 +0100
....
In article <davep-1302000936460001@[EMAIL PROTECTED]
>, Dave Polaschek
<davep@[EMAIL PROTECTED]
> wrote:
.....
> Thanks to Daves help I was able to put together a pane that prints
> rotated text (90 or -90 degrees rotated) on screen and on postscript
> printers. I wasn't able to see what happens on QuickDraw printers,
> since I don't have access to one.
you can do a search using http://groups.google.com
to find it.
A more modern way to do this would be to use code similiar to Apple's
CircleView.m from their CircleView sample code, condensed here:
NSGraphicsContext *context = [NSGraphicsContext currentContext];
NSRect lineFragmentRect = [layoutManager
lineFragmentRectForGlyphAtIndex:glyphIndex effectiveRange:NULL];
layoutLocation = [layoutManager locationForGlyphAtIndex:glyphIndex];
NSAffineTransform *transform = [NSAffineTransform transform];
[transform translateXBy:viewLocation.x yBy:viewLocation.y];
[transform rotateByRadians:-angle];
[context saveGraphicsState];
[transform concat];
// drawGlyphsForGlyphRange: draws the glyph at its laid-out location in
container coordinates.
// Since we are using the transform to place the glyph, we subtract the
laid-out location here.
[layoutManager drawGlyphsForGlyphRange:NSMakeRange(glyphIndex, 1)
atPoint:NSMakePoint(-layoutLocation.x, -layoutLocation.y)];
[context restoreGraphicsState];
Naturally, this omits critical details. See the original sample code, on
Apple's web site.
And, the above would involve re-writing your program to use Objective-C,
at least in part.
The idea of using a transformation matrix and letting the text system
rotate the text should also work with QuicktimeGraphicIm****ters.


|