drawRect - top to bottom text
-
Hi,
I'm currently using NSString's member function drawInRect:withAttributes:
and as it says in the documentation, the origin of the text is being
displayed from the rect's bottom left corner.
My question is if there's any way to make the origin the top left corner
with out having to override the isFlipped function. The reason I don't want
to use this function is because it'll change everything else that i've set
in place. I just want my text to start from the top of the rectangle and
progress downward.
Any ideas?
Thanks in advance,
Wayne
_________________________________________________________________
Powerful Parental Controls Let your child discover the best the Internet has
to offer.
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&D
I=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
Start enjoying all the benefits of MSN® Premium right now and get the
first two months FREE*. -
At 20:20 Uhr -0800 01.11.2004, Wayne Lau wrote:> My question is if there's any way to make the origin the top left
> corner with out having to override the isFlipped function. The
> reason I don't want to use this function is because it'll change
> everything else that i've set in place. I just want my text to start
> from the top of the rectangle and progress downward.
Maths?
Call sizeWithAttributes: and then add the height to your drawing coordinate.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de -
> I'm currently using NSString's member function
> drawInRect:withAttributes:
> and as it says in the documentation, the origin of the text is being
> displayed from the rect's bottom left corner.
>
> My question is if there's any way to make the origin the top left
> corner
> with out having to override the isFlipped function. The reason I don't
> want
> to use this function is because it'll change everything else that i've
> set
> in place. I just want my text to start from the top of the rectangle
> and
> progress downward.
Presumably you are trying to draw multiple lines of text with
drawInRect:withAttributes;?
drawInRect:withAttributes: is a fairly simplistic tool. I don't think
you're going to have much luck working around it's behavior. You might
be able to use the NSAffineTransform in combination with Quartz calls
to change the origin, change the axis, change the text matrix, use
drawInRect:withAttributes:, and then restore everything back.
You'd probably be better off in the long run, however, just putting
together a text layout yourself and drawing the lines wherever you
think they should go. More information on that can be found at:
<http://developer.apple.com/documentation/Cocoa/Conceptual/
TextArchitecture/index.html>
Scott -
>> TextArchitecture/index.html>
> You'd probably be better off in the long run, however, just putting
> together a text layout yourself and drawing the lines wherever you
> think they should go. More information on that can be found at:
>
> <http://developer.apple.com/documentation/Cocoa/Conceptual/
Sorry... When you get to that link, see the section "Assembling the
Text System by Hand"


