text woes, the next chapter
text woes, the next chapter
- Subject: text woes, the next chapter
- From: Robert Clair <email@hidden>
- Date: Fri, 3 Dec 2004 10:32:03 -0500
More strange and unwanted behavior from the text system. I'm
trying to get a reasonably accurate bounding box of the glyphs
laid out in a text container.
Both
[NSLayoutManager boundingRectForGlyphRange:inTextContainer:]
(used with the entire range of glyphs) and
[NSLayoutManger usedRectForTextContainer:]
sometimes return rectangles that are correct vertically, but extend
horizontally
all the way to one or both (for centered alignment) edges of the
container.
Not my idea of a bounding box.
It can be coded around - getting the range of glyphs for each line
(minus the line end
character[s]), using boundingRectForGlyphRange:inTextContainer: for
each line
range and then unioning the resulting rects seems to work, but it would
be nicer
if the layout manager routines behaved more sensibly. Any suggestions
as to
what might be causing this would be appreciated.
Another annoyance -
I'm turning my glyphs into paths at one point, using
glyph = [nyLayoutManager glyphAtIndex: glyphIndex];
[path appendBezierPathWithGlyphs: &glyph count: 1 inFont: aFont];
This produces random trash glyphs (mostly boxes, but cute negative
space question
marks for Zapafino). On investigation the reason is that this code puts
out glyph = 0
after ligatures. For example in Times an "fl", which is advertised as
being two characters
and one glyph (the ligature) comes out as two glyphs - the glyph for
the ligature and
glyph 0. This is easy enough to filter out, but, again, is there some
reason for this behavior ?
TIA
.....Bob Clair
_______________________________________________
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