Re: Font drawing and line spacing.
Re: Font drawing and line spacing.
- Subject: Re: Font drawing and line spacing.
- From: Paul Fox <email@hidden>
- Date: Mon, 8 Jul 2002 13:37:02 +0100
>
On mandag, juli 8, 2002, at 10:38 , Paul Fox wrote:
>
>
>> How large? This is a grab from my program, using Monaco 9.0 and I think
>
>> the space is adequate! :-)
>
> Yes - I think there is a difference when looking at documentation where
>
> the spaciousness is aesthetic pleasing, and looking at code where
>
> you want to get as much on the screen as possible. I want to know
>
>
hmm... I certainly wouldn't use a program with less spacing than the
>
grab I sent you. On the lines which are closest together there are only
>
two lines of empty pixels between them -- I just tried to render the
>
same without the lineGab (i.e. just ascender + descender) and it looks
>
horrible...
Yes - because something is smelling of fish inside Cocoa. You can lose
one more pixel without problem - but its not easily 'doable'. As I mentioned,
BBEdit does it quite nicely.
>
> how BBEdit does it! I am about to embark on playing hard with
>
> NSTypesetter and friends to see if I can do it properly.
>
>
Since BBEdit is a Carbon app then you can be certain that it doesn't use
>
NSLayoutManager.
Yep. I tried putting breakpoints on various CGContextShow functions and it
never hit them. This tells me it isnt even doing pure Carbon drawing.
I am presently playing with the ATSUI functions, because it looks like
this is the level to get down and dirty.
>
Either do your own layout then it shouldn't be a problem or perhaps just
>
overlaod the defaultLineHeight for NSFont to return ascender + descender.
If I could actually understand NSLayoutManager and NSTypesetter and a few
other classes then I would. But my playing with NSLayoutManager doesnt
show any speedups. ATSUI is certainly faster than NSString and am trying
to get something to work before I can decide (a) how much faster and (b)
whether it solves this problem.
Overriding the line ht is certainly an interesting idea as that might just
fool things. But I fear not.
>
> Also - interestingly, your image is anti-aliased whereas its not on
>
> my screen (I dont think I changed any defaults tho).
>
>
Yes, that's very weird -- furthermore, you said that when your lines got
>
too close to each other then one would erase the other. All text
>
rendering here happens as ORing the glyphs onto the view port...
A character glyph looks sorta:
-----------
| | Letter "T" inside a bounding box and the glyph bounding
| |-----| | box adds extra white space all around the char.
| |*****| |
| | * | | Note the extra pixel at top and bottom - one is redundant
| | * | | without fear of overlap. But if you fake the font ht to
| | * | | subtract 1, then you can overwrite the bottom pixel
| | * | | of the prior line, e.g. something like:
| |__*__| |
| |
|---------|
-----------
| |
| |-----| | lower case "j"
| | | |
| | * | |
| | | |
| | * | |
| | * | |
| |__*__| |
| ** |
|---------|
(I may be out by one pixel row on the diagrams - as there are more excess
pixels than I make out).
_______________________________________________
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.