[GRASS-dev] psdriver docs drafted

Glynn Clements glynn at gclements.plus.com
Fri Jun 1 00:43:06 EDT 2007


Markus Neteler wrote:

> ... at display/drivers/PS/description.html
> Please update. I have collected stuff from various
> places.
> 
> I still wonder how to define the resolution (DPI).
> Example: for the GRASS book I would like to generate
> screenshots and such as PDFs at reasonable resolution.

PostScript itself doesn't have a resolution; the resolution is
determined by the device on which the PostScript is rendered.

Currently, R_* coordinates are interpreted as points, so all
coordinates end up getting snapped to a one-point grid.

If you want greater precision, you can choose a larger "screen" size
via GRASS_PAPER or GRASS_{WIDTH,HEIGHT} and scale down. However, some
modules (e.g. d.barscale) create graphics whose size (in coordinates)
is hard-coded, so this will result in smaller graphics relative to the
size of the "screen".

If desired, reading the grid size from an environment variable would
be trivial.

Rasters are output as-is, with no scaling other than that performed by
G_get_raster_row() etc.

One outstanding issue is text. FreeType fonts will be pre-rendered at
one-point resolution (i.e. 72 DPI) and output as bitmaps. I can modify
text handling to allow the PS driver to use PostScript fonts, but it
would be limited to ISO-8859-1, and R_get_text_box() would have to be
an approximation.

Alternatively, it would be possible to get the glyph outlines from
FreeType and send those to the printer instead of bitmaps. This isn't
trivial, but it isn't a vast amount of work either.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list