One of the things that bugs me about text on OS X is that it's laid out from 
the top edge of a bounding box, not based off a baseline. In particular, 
CATextLayer lays out text from its top edge, but provides no way to find out 
the baseline that results. This makes laying out layers with text labels quite 
hard work when ensuring that text that can vary in size or that uses a mix of 
fonts stays aligned to a particular baseline.

Since CATextLayer has no -baseline method, is there any other way to figure 
this out? If it's only using a single font, things aren't too bad, since the 
ascender can be obtained from the font (though since any of several different 
font objects or even just a string can be assigned as the -font property, this 
requires a little bit of effort). Much harder is if a mix of fonts is used, or 
if font substitution was necessary due to unsupported characters in the font. 
In that case you have to effectively perform all of the line layout yourself, 
just to figure the baseline, yet surely CATextLayer is already doing exacty the 
same work internally.

Am I missing something more obvious, or is it really this hard?


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

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

Reply via email to