Re: Height and location of text within a line in NSLayoutManager ignoring spacing?
Re: Height and location of text within a line in NSLayoutManager ignoring spacing?
- Subject: Re: Height and location of text within a line in NSLayoutManager ignoring spacing?
- From: Douglas Davidson <email@hidden>
- Date: Mon, 18 Feb 2008 10:44:15 -0800
On Feb 18, 2008, at 4:25 AM, Keith Blount wrote:
- lineFragmentRectForGlyphAtIndex:effectiveRange: in combination
with -locationOfGlyphAtIndex: this is better and does give me the
point at which the original glyph would be drawn. However, there
seems to be no way to then offset this for the new character. If I
call NSString's -sizeWithAttributes: on the control character I'm
going to draw, I get padding above and below the character in that
method and cannot find a way to offset that so that it will then get
drawn at the right location.
The key methods here are -
lineFragmentRectForGlyphAtIndex:effectiveRange:, -
lineFragmentUsedRectForGlyphAtIndex:, -locationOfGlyphAtIndex:, and
NSTypesetter's -baselineOffsetInLayoutManager:glyphIndex:. It's a
little difficult for me to describe all of the relationships between
these measurements without a diagram, but you should be able to try
them out and see how they differ in all of the various cases you're
interested in--paragraph spacing, line spacing, line height multiple,
etc. The line fragment rect is the rect within which the line was
laid out. The used rect is the rect within that actually taken up by
the text, including some forms of padding. The baseline offset is the
distance from the bottom of the line fragment rect to the baseline for
a particular glyph.
Douglas Davidson
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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