[GRASS-dev] Re: [bug #4905] (grass) gis.m: d.text.freetype does not allow spaces in text

Huidae Cho grass4u at gmail.com
Wed Aug 30 13:48:56 EDT 2006


On Wed, Aug 30, 2006 at 02:28:53PM +0100, Glynn Clements wrote:
> 
> Michael Barton wrote:
> 
> > As I understand it, d.font.freetype + d.text works; d.text.freetype does
> > not.
> 
> The former uses ft_render_mode_normal, the latter ft_render_mode_mono.
> 
> Is there anything (useful) which the latter does but the former
> doesn't? Or can we kill d.text.freetype?

Unlike d.text, d.text.freetype is able to locate text more precisely on
the screen (mouse, relative position, geographic coordinates, alignment)
and supports line spacing and different colors in the same line (no
linefeed).

Huidae Cho

> 
> Hmm. Immediate rendering doesn't work with FreeType fonts at present.
> You can't use d.font/d.font.freetype as each d.* command is self
> contained. The default font for immediate rendering is set with
> GRASS_FONT, but that currently only supports the stroke fonts. I'll
> fix this today.
> 
> Using the driver's built-in FreeType handling has the advantage that
> we can implement anti-aliased text when using the PNG driver
> (including immediate rendering) in true-colour mode.
> 
> The FreeType text rendering uses the driver's draw_bitmap operation,
> which isn't directly exposed (i.e. there is no R_draw_bitmap() or
> similar). d.text.freetype uses R_raster_char().
> 
> The draw_bitmap operation could easily be extended to support
> anti-aliasing. Currently, the bitmap is one byte per pixel, with zero
> indicating transparent and non-zero indicating opaque. Changing it to
> an alpha channel would involve removing the "... > 128 ? 1:0" from
> lib/driver/text3.c:272 and having the driver's draw_bitmap operation
> either perform the check itself (for XDRIVER or for the PNG driver
> using indexed colour) or using anti-aliasing (for the PNG driver using
> true colour).
> 
> Actually, we could just make the draw_bitmap operation available
> through an R_draw_bitmap() function for d.text.freetype to use.
> 
> Finally, there should probably be an option to select the rendering
> mode (ft_render_mode_{normal,mono}); if you aren't using
> anti-aliasing, ft_render_mode_mono will typically produce better
> results (assuming that ft_render_mode_mono actually works).
> 
> -- Glynn Clements <glynn at gclements.plus.com>
> 
> _______________________________________________ grass-dev mailing list
> grass-dev at grass.itc.it http://grass.itc.it/mailman/listinfo/grass-dev




More information about the grass-dev mailing list