gnustep-dev
[Top][All Lists]
Advanced

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

Rendering of fixed-width fonts


From: Adrian Robert
Subject: Rendering of fixed-width fonts
Date: Tue, 15 Mar 2005 09:33:08 -0500

I recently posted about how the Art backend renders the supposedly fixed-width "VeraSansMono-Roman" in a non-fixed width way. For reference, here is the shot of size 12 showing a regular grid rendering on the bottom:

PNG image



The problem is not, apparently Art's; if you run FreeType's own rendering test (I think called 'ftstring' or something like that), the result is the same as the top row above. Digging further, [NSFont -widthOfString] reports that 'm' in size 12 is width of 6.0 while all other characters are 7.0. (Super-simple test program attached.) This information comes from the "advancement" info in the font. At different sizes, other characters besides 'm' are the "odd ones out".

So now to the questions.

First, I can't find any reference to this on the web. Is everyone rendering this font character-by-character manually? Leaving the question of what's happening in Gnome/Gtk aside, if I render in GNUstep using a call to DPSmoveto() followed by DPSshow() for every character, the problem goes away. It looks like this is what Terminal.app does. Surprisingly, on Art this is actually reasonably fast, but on Xlib performance is unacceptable.

This leads to the next question -- is it possible to detect at runtime whether you are running under Art or Xlib? (So as to change rendering strategies.)

Is there any more efficient way to render with regular spacing than repeated calls to moveto and show?

Sllightly OT, there are no DPS commands on OS X, right? You have to use the Quartz functions, which all start with "CG"? (The API does not look as clean as DPS, but hopefully it grows on one?)

Finally, does anyone have an opinion on whether a fixed-width font should have different advancements like VeraSansMono? Is this a bug in the font? None of the fonts I've tried under Xlib have the problem, and FreeMono under Art lacks the problem. I haven't seen the issue with any fonts on OS X. But the Vera fonts are supposed to be good, and look nice, so why does the monospace one have this problem?


Attachment: testFontWidth.m
Description: Binary data



thanks,
Adrian

reply via email to

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