I have code that lays out text on a path. It essentially boils down to the technique given in the Text Layout Programming Guide example code (Circle text) of setting up a transform before letting the layout manager get on with its normal work, done by calling -[NSLayoutManager drawGlyphsForGlyphRange:atPoint:]; where the point is calculated from the -locationOfGlyphAtIndex: method (each glyph has to be drawn individually for obvious reasons, so the glyph range is always length 1)

This works great for almost everything you can do with an attributed string, but doesn't handle superscripts properly. Any super- or subscripted glyph always ends up on the baseline.

I have tried two things so far:

a) ask the typesetter, using -[NSTypesetter baselineOffsetInLayoutManager:glyphIndex:];

That produces nothing different for the superscripted characters.

b) going back to the original string's superscript attribute. That could work, since I have complete control over the baseline for each character. However, the superscript attribute is an integer which I understand to mean n units of "superscriptness" in proportion to h, where h is ??? lineheight? font height? I can't find any information on how this value can be turned into a baseline position.

So that would be good to know if anyone can help. That still leaves me mystified as to why the layout manager doesn't "just work" though.

--Graham


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to