Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / August 2007



Tip: Looking for answers? Try searching our database.

Drawing text at an angle within a view?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
slashlos - 29 Aug 2007 03:22 GMT
This is probably a silly question, but when drawing within a common
view, drawing various shapes and text, can you draw text at an angle?

I don't see an attribute for angle or rotation but it seems to me that
in order to have text drawn at an angle, its housing view must be rotated?
Signature

 /los "I was a teenage net-random"
------------------------------------------------------------------------
Opinions expressed here are mine and not necessarily those of my employer!
------------------------------------------------------------------------

David Phillip Oster - 29 Aug 2007 05:31 GMT
> This is probably a silly question, but when drawing within a common
> view, drawing various shapes and text, can you draw text at an angle?
>
> I don't see an attribute for angle or rotation but it seems to me that
> in order to have text drawn at an angle, its housing view must be rotated?

The following works just fine for me:

@implementation RotatedView
- (void)drawRect:(NSRect)rect {
  NSAffineTransform *t = [NSAffineTransform transform];
  [t translateXBy:200. yBy:200.];
  [t rotateByDegrees:40.];
  [t translateXBy:-200. yBy:-200.];
  [t set];
  [@"Hello World" drawAtPoint:NSMakePoint(100., 100.)  
withAttributes:nil];
  [[NSAffineTransform transform] set];
}

@end
David Phillip Oster - 29 Aug 2007 16:32 GMT
> > This is probably a silly question, but when drawing within a common
> > view, drawing various shapes and text, can you draw text at an angle?
[quoted text clipped - 17 lines]
>
> @end

See also:

file:///Developer/Examples/AppKit/CircleView/  for an example of using
the NSTextView system to lay out text so it follows the curve of a
circle.
slashlos - 31 Aug 2007 02:21 GMT
> See also:
>
> file:///Developer/Examples/AppKit/CircleView/  for an example of using
> the NSTextView system to lay out text so it follows the curve of a
> circle.

Thanks for doc pointer, it's what I needed.
Signature

 /los "I was a teenage net-random"
------------------------------------------------------------------------
Opinions expressed here are mine and not necessarily those of my employer!
------------------------------------------------------------------------

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.