Font drawing and line spacing.
Font drawing and line spacing.
- Subject: Font drawing and line spacing.
- From: Paul Fox <email@hidden>
- Date: Mon, 8 Jul 2002 00:35:31 +0000
Can anyone help with this issue?
If I am using the Monaco font at 9.0 pt size, say for example in
Terminal, then I notice a large interline gap. I cannot decrease
the line spacing in the prefs dialog for that font.
If I draw using Monaco-9 in my app, I pretty get the same
gap depending on which definition of 'font height' I use, e.g.
defaultLineHeightForFont.
If I play with BBEdit (which I believe is a Carbon app?) with Monaco-9
the interline gap is optimal - small as I would expect/like.
So how does it do this, ie which primitives/methods in Carbon or Cocoa
should I play with?
If I set my interline height to [NSFont descender] - [NSFont ascender]
then I can get the same line spacing as BBEdit but there is a problem
because when drawing the strings (with [NSString drawAtPoint]) it wants
to put too much height into the font with the net result of losing
the bottom pixel of the line above.
I am 'correcting' for this by setting a clipping region to avoid
overwriting the line above. This seems needlessly expensive and
has some side effects in my scrolling code.
I've tried looking at the CG lib, NSLayoutManager and related class
pages but cannot see what the 'trick' is. Am I going about this the
right way or am I fighting the system?
thanx
_______________________________________________
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.