• 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
Re: Glyphs displayed in a bad direction
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Glyphs displayed in a bad direction


  • Subject: Re: Glyphs displayed in a bad direction
  • From: Aki Inoue <email@hidden>
  • Date: Sun, 27 Nov 2005 14:35:52 -0800

Tristan,

You're not seeing anything with CGContextShowGlyphsAtPoint since you're not setting the font.

With -drawGlyphsForGlyphRange:atPoint:, you're seeing lines drawn from bottom to top since your coordinate system is not flipped. NSLayoutManager requires the coordinate system being drawn to be flipped.

Ideally I should display with Quartz, but I try different ways.
Apple really discourages direct text rendering using Quartz. Text rendering should be performed by higher level API such as ATSUI or Cocoa Text System unless you're developing a Unicode rendering engine by yourself.

If you need to tweak the current graphics state while rendering with NSLayoutManager, you should be able to do so by overriding the - showPackedGlyphs:length:.. method.

Aki

Hello

I have a problem...
Let say two in one.

when I try to draw glyphs from a text layout in a CGContext, with a code like this:

NSLayoutManager* layoutManager = [attachedTextView layoutManager];
long nGlyphs = [layoutManager numberOfGlyphs];
NSRange glyphRange = NSMakeRange(0,nGlyphs);

#ifdef _DRAW_USING_QUARTZ_
NSGlyph* glyphArray = (NSGlyph*)malloc((nGlyphs+1)*sizeof(NSGlyph));
long returnedGlyphs = [layoutManager getGlyphs:glyphArray range:glyphRange];
CGContextShowGlyphsAtPoint(contextRef,textLoc.y,textLoc.y, (CGGlyph*)glyphArray,returnedGlyphs);
#else
[layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:textLoc];
#endif



if _DRAW_USING_QUARTZ_ is defined, then nothings is visible,

by drawing using drawGlyphsForGlyphRange:glyphRange, Glyphs are displayed, but lines are displayed bottom to top (and all the offsets for subscript, superscript, underline..) are reversed.

Ideally I should display with Quartz, but I try different ways.

Any help would be very appreciated!

Tristan

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Glyphs displayed in a bad direction (From: Tristan Leblanc <email@hidden>)

  • Prev by Date: [Moderator] EOT (Re: [OT] WebObjects licensing - Apple please clarify)
  • Next by Date: Re: CFSocket freezes
  • Previous by thread: Glyphs displayed in a bad direction
  • Next by thread: Removing focus rings from NSImageViews
  • Index(es):
    • Date
    • Thread