discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: text question


From: Alexander Malmberg
Subject: Re: text question
Date: Mon, 23 Jun 2003 23:15:26 +0200

Pete French wrote:
[snip]
> I can get the size of the text using usedRectForTextContainer: - but that
> always giuves me an origin of 0,0. How can I find out the offset of the
> baseline itno the rect so that I can calulate tghe part of the rectangle
> which is above the baseline ?

You can't. GSHorizontalTypesetter does have an internal notion of a
baseline for each line, but that information is lost before it gets to
the layout manager.

A good approximation would be to get the starting location of the first
run of nominally spaced glyphs
(-rangeOfNominallySpacedGlyphsContainingIndex:startLocation:) inside the
first line frag rect (-lineFragmentRectForGlyphAtIndex:effectiveRange:).
This will be on the first line's baseline most of the time, but it won't
work if the text has baseline adjustment attributes, or if the text is
spread over several lines.

- Alexander Malmberg




reply via email to

[Prev in Thread] Current Thread [Next in Thread]