Re: FreeType

Ash Henstock <[email protected]> Mon, 2 Jan 2006 10:50:57 +0000
Newsgroups gmane.games.devel.general
Message-ID <[email protected]>
I'm not completely sure how PyGame works but this snippet of OpenGL Red Book
text was helpful to me when trying to get better 2D rasterisation.

" If exact two-dimensional rasterization is desired, you must carefully
specify both the orthographic projection and the vertices of primitives that
are to be rasterized. The orthographic projection should be specified with
integer coordinates, as shown in the following example:

gluOrtho2D(0, width, 0, height);

where width and height are the dimensions of the viewport. Given this
projection matrix, polygon vertices and pixel image positions should be
placed at integer coordinates to rasterize predictably. For example,
glRecti(0, 0, 1, 1) reliably fills the lower left pixel of the viewport, and
glRasterPos2i(0, 0) reliably positions an unzoomed image at the lower left
of the viewport. Point vertices, line vertices, and bitmap positions should
be placed at half-integer locations, however. For example, a line drawn from
(x1, 0.5) to (x2, 0.5) will be reliably rendered along the bottom row of
pixels int the viewport, and a point drawn at (0.5, 0.5) will reliably fill
the same pixel as glRecti(0, 0, 1, 1).

An optimum compromise that allows all primitives to be specified at integer
positions, while still ensuring predictable rasterization, is to translate x
and y by 0.375, as shown in the following code fragment. Such a translation
keeps polygon and pixel image edges safely away from the centers of pixels,
while moving line vertices close enough to the pixel centers."

Can't say as I found a completely satisfactory solution yet though. After
watching a few interviews with Bill Hill at Microsoft on ClearView it galls
me that my FT2 fonts look so dodgy. I contemplated the possibility of a
fragment program based subpixel antialiaser, but don't know enough about how
TrueType works (to account correctly for hinting for example) to proceed at
the moment.

Another hassle I had was what to do if FSAA is forced (as in a driver
control panel).

Sorry if that's not much use to you Brian, a quick search turned up there
was an OpenGL renderer for PyGame (I think?) but wasn't sure if it was an
exclusive or standard thing.

As an aside you can check what your font smoothing mode in windows in
Display Properties->Appearance->Effects and there's a powertoy from MS to
tweak ClearType to your display which is handy.

On 1/2/06, Brian Hook <[email protected]> wrote:
>
> Thread necromancy!
>
> I've started using FT2 via PyGame, and the font rendering...sucks.
> I'm sticking with Courier New on the Windows platform and generating
> glyphs, anti-aliased, into
>
> At least two problems have surfaced.  The first is that the fonts just
> don't look that good compared to the built-in Windows renderer, which
> presumably uses ClearType or something similar (using zoomin the
> difference is fairly obvious).
>
> The second problem, which is not FT2 specific, is that it seems that
> where I need to index my texels differs from driver to driver.  On
> some drivers I need to go from 0,0 to glyph.width,glyph.height, and on
> other drivers I need to offset those values by 0.5 texels.  Anyone
> else seen this?
>
> Brian
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
> _______________________________________________
> Gamedevlists-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gamedevlists-general
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_idU7
>