discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Line height in NSText


From: Pierre-Yves Rivaille
Subject: Re: Line height in NSText
Date: Fri, 08 Feb 2002 19:08:36 +0100

Hello,
I had the same problem lately, so I'll share my experiments and
problems with you.
The way i believe it should work is to call [NSFont -defaultLineHeight].
(please note that the current version is not working, i'll commit a
working version to CVS in the next minutes, so it should be in CVS
by the time you read this message)
Then you should add to it the current paragraphstyle's linespacing
[NSParagraphStyle -lineSpacing] or the paragraphspacing
[NSParagraphStyle -paragraphSpacing]. However those two values
default to 0, so you don't really care about them.

Another way would be to apply an NSParagraphStyle with
maximumLineHeight and minimumLineHeight set to the same value to
the whole text.

*BUT* all this is not working because empty lines keep the same height
whatever font/paragraphstyle you use.
So there are 4 solutions :
- fix this bug (i believe it's a bug), or wait for it to be fixed
- detect empyt lines and take them into account when you calculate
 your marker position
- don't use empty lines (this only applies if your text cannot be edited)
- use a font size (or paragraphstyle's maximumheight/minimumheight)
  which makes your non-empty lines the same size as the empty lines
 (helvetica 10 is ok)

I've been writting code that could be used to put marker on the side of
a text with variable height. Unfortunately it is not completly finished,
but it could prove helpful to you (drop me a mail if you want it).

Pierre-Yves Rivaille

On 2002-02-07 17:50:32 +0100 Dirk Lattermann <dlatt@alqualonde.de> wrote:

Hello,

I would like to place a marker (e.g., a triangle) next to
a line of text in a plain NSText object (no rtf). The marker should be
placed
outside the NSText view.  To achieve this, I would like to know
the "baseline skip" in the NSText. Is it possible to query the NSText
object
about this?  If not, how can I get at this information?

TIA,
Dirk Lattermann

_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
http://mail.gnu.org/mailman/listinfo/discuss-gnustep





reply via email to

[Prev in Thread] Current Thread [Next in Thread]