Re: NSTextView baseline for line of text
Re: NSTextView baseline for line of text
- Subject: Re: NSTextView baseline for line of text
- From: Satoshi Matsumoto <email@hidden>
- Date: Thu, 27 May 2004 09:19:36 +0900
Hi Mark,
on 04.5.27 5:38 AM, Mark Alldritt at email@hidden wrote:
>
How do I find the baseline of a line of text rendered within an NSTextView?
>
I can find the bounding rectangle for a range of text, but I cannot
>
determine the baseline within that rect.
You can find it using NSTypesetter method:
- (float)baselineOffsetInLayoutManager:(NSLayoutManager *)layoutMgr
glyphIndex:(unsigned)glyphIndex
Returns the distance from the bottom of the bounding box of the glyph in
layoutMgr at glyphIndex to its baseline. The text system uses this value to
calculate the vertical position of underlines.
--------
float baseline=[[[yourTextView layoutManager] typesetter]
baselineOffsetInLayoutManager:[yourTextView layoutManager]
glyphIndex:glyphIndex];
Hope that helps,
Satoshi
-----------------------------------------------------
Satoshi Matsumoto <email@hidden>
816-5 Odake, Odawara, Kanagawa, Japan 256-0802
_______________________________________________
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.