On 7 Dec 2012, at 17:40, Leonardo <mac.iphone....@gmail.com> wrote: > Hi, > I am getting serious difficulties at drawing an attributed string within an > attachmentCell and get it aligned on the baseline. > I have a NSTextView. I add an attachment with its attachmentCell. > In the method cellFrameForTextContainer I return a > cell.frame.height = font.ascender - font.descender; > In the method drawWithFrame: of the cell, I draw the string with > drawAtPoint: cellFrame.origin.x, cellFrame.origin.y - font.descender; > It works well with some font and size: the attachment string is aligned with > the rest of the text (with same font and size) in the NSTextView. > E.g. with Futura Medium >= 17 the string is "always" aligned. > > But with Futura Medium < 18 the string goes lower than the baseline. Why? > What do I miss there?
Try using the following method instead: -drawWithRect:options:attributes: See Aki Inoue's explanation in http://lists.apple.com/archives/cocoa-dev/2012/Sep/msg00442.html -drawAtPoint uses a different layout strategy that can have these sort of effects. Jonathan _______________________________________________ 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