Superscript vs. drawGlyphsForGlyphRange:atPoint:
Superscript vs. drawGlyphsForGlyphRange:atPoint:
- Subject: Superscript vs. drawGlyphsForGlyphRange:atPoint:
- From: "R. Scott Thompson" <email@hidden>
- Date: Thu, 2 Dec 2004 15:00:25 -0600
I'm working with a cross platform application which exchanges text
style information by using RTF as an intermediary. For the most part
the application works fine. I'm running into a problem, however, when
I want to use text that contains superscripts (and presumably any other
baseline offset?
When I get the RTF text, I convert it to an attributed string. I then
proceed to "assemble the text system by hand" and eventually call on
the layout manager to drawGlyphsForGlyphRange:atPoint:
Because the first line of text contains a superscripted character,
however, and because the drawing routine draws relative to the upper
left corner of the text drawing, the entire block of text is shifted
downward (presumably by an amount related to the baseline offset of the
superscript character).
I'd very much prefer it if I could ask the computer to draw the text in
such a way that the superscript character draws "upward and outside of
the container" rather than shifting the entire text layout downward to
account for the superscript character.
To put it another way, I would like to draw the text so that the
baseline of the first line of text matches the baseline that would have
been used had the text not contained the superscript character in it.
Is there an "easy" mechanism for calculating the offset I need to apply
to the drawing position to achieve this effect? Can I simply run
through the first line of the layout, find the maximum baseline shift,
and offset by that amount somewhere?
Scott
_______________________________________________
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