Re: NSTextViews with embedded pictures and vertical alignment
Re: NSTextViews with embedded pictures and vertical alignment
- Subject: Re: NSTextViews with embedded pictures and vertical alignment
- From: Nicko van Someren <email@hidden>
- Date: Wed, 30 Jun 2004 17:54:07 +0100
On 30 Jun 2004, at 16:56, Douglas Davidson wrote:
However, the original problem proposed here sounds like it's just an
image attachment, which would most easily be handled by a standard
NSTextAttachment and the standard NSTextAttachmentCell that it
automatically generates. In that case, the thing to do would be to
set a baseline offset via NSBaselineOffsetAttributeName on the
attachment character in the attributed string.
Aha. That's a much better solution in the circumstances.
In TextEdit, you can manipulate this with the Font/Baseline/Raise and
Lower menu items; if you're doing it programmatically, you can just
directly set a value for the attribute on the text.
I just tried this in TextEdit and noticed an unexpected behaviour. It
seems that if I lower the image baseline then while it does indeed sit
below the line it seems to keep the same total rise above the line, so
the height of the image cell is increased by the amount by which the
baseline is lowered and there is a section of white space inserted
between the top of the image and the line above. I would have expected
that the size of the cell would remain the same and that lowering the
baseline would simply drop the whole image down. It turns out that the
same happens with text (unsurprisingly, given my understanding of the
layout system) and this means that, for instance, TextEdit seems
incapable of displaying a row of letters with some in larger font than
others and with the tops of all the letters aligned without also having
blank space above the line. At the bottom of this mail is a fragment
of RTF that demonstrates this.
Is this a bug, is it a feature or am I misunderstanding what the
baseline offset is designed to do?
For those of you at WWDC, I'll be presenting an example of doing this
programmatically in session 411.
I'd love to come. You can't move the conference over to England for me
can you? :-)
Cheers,
Nicko
======= RTF to show baseline offset issue =======
{\rtf1\mac\ansicpg10000\cocoartf102
{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\f0\fs24 \cf0 XXXX\
X
\fs80 \dn40 X
\fs24 \up0 X\
XXXX\
}
=================================================
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.