• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
text drawing question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

text drawing question


  • Subject: text drawing question
  • From: Vinay Prabhu <email@hidden>
  • Date: Wed, 25 Apr 2007 13:33:49 +0530
  • Importance: Normal

Hi,

Is it possible to flip the NSTextContainer view coordinates?

In my application, I would like to draw the flipped text.
Code,
NSTextStorage* textStorage = [[NSTextStorage alloc]
initWithAttributedString:drawString];
NSLayoutManager* layoutManager = [[NSLayoutManager alloc] init];
NSTextContainer* textContainer = [[NSTextContainer alloc]
initWithContainerSize:rect.size];
[layoutManager  addTextContainer:textContainer];
[textStorage addLayoutManager:layoutManager];
NSRange glyphRange = [layoutManager
glyphRangeForTextContainer:textContainer ];

[[NSGraphicsContext currentContext] saveGraphicsState];

NSAffineTransform* affineTransform = [NSAffineTransform transform];
[affineTransform  translateXBy:0 yBy:rect.size.height];
[affineTransform  scaleXBy:1 yBy:-1];
[affineTransform concat];
[layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:rect.origin];

[[NSGraphicsContext currentContext] restoreGraphicsState];

With the above code, instead of flipping character by character, it flipps
the entire drawing coordinates.
So instead of drawing like,
Line 1
Line 2
Line 3

It draws like,
Line3
Line2
Line1

So how do I flip character by character and draw?

Regards
Vinay

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: text drawing question
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: NSAffineTransform question
  • Next by Date: Re: Quartz flash screen updates
  • Previous by thread: Re: NSAffineTransform question
  • Next by thread: Re: text drawing question
  • Index(es):
    • Date
    • Thread