• 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
Setting the origin of a GC and Text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting the origin of a GC and Text


  • Subject: Setting the origin of a GC and Text
  • From: Jim Crafton <email@hidden>
  • Date: Sun, 6 Jul 2003 23:25:27 -0400

I am a bit stumped at the moment:
If I draw text (using the advice of the Apple docs which say that using
NSLayoutManager and friends is ultimately the most efficient way to do
it), and reduce the bounding box of the NSTextContainer it wraps the
text from bottom to top, i.,e. each line is progressively *higher* than
the next due to the bottom left default origin (which really strikes me
as being rather dumb, but whatever).
So I need to know how to deal with this - any advice would be greatly
appreciated. I tried the following (in my experiment NSView subclass's
drawRect())

NSAffineTransform* topLeftXFrm = [NSAffineTransform transform];
[topLeftXFrm scaleXBy:1.0 yBy:-1.0];
[topLeftXFrm translateXBy:0.0 yBy: -bds.size.height];
[topLeftXFrm concat];

//then do text set up

//then draw it
NSRange glyphRange = [layoutManager
glyphRangeForTextContainer:textContainer];
[layoutManager drawGlyphsForGlyphRange: glyphRange atPoint:
NSMakePoint(30,100)];

What I get is text that is laid out top to bottom, as you'd expect but
the glyphs are all backwards, like looking in a mirror! Obviously I
have done something rather stupid to say the least!

Cheers

Jim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Setting the origin of a GC and Text
      • From: Douglas Davidson <email@hidden>
    • Re: Setting the origin of a GC and Text
      • From: "Alastair J.Houghton" <email@hidden>
    • Re: Setting the origin of a GC and Text
      • From: Jim Crafton <email@hidden>
References: 
 >Re: Setting the origin of a GC (From: Jim Crafton <email@hidden>)

  • Prev by Date: Re: GCC 3.3 problems
  • Next by Date: Re: Setting the origin of a GC and Text
  • Previous by thread: Re: Setting the origin of a GC
  • Next by thread: Re: Setting the origin of a GC and Text
  • Index(es):
    • Date
    • Thread