[GRASS-dev] font size in d.legend
Paulo van Breugel
p.vanbreugel at gmail.com
Thu Jun 30 01:42:41 PDT 2016
On 30-06-16 04:25, Glynn Clements wrote:
> Paulo van Breugel wrote:
>> I am creating some maps (png format) using the GRASS_RENDER_IMMEDIATE=cairo
>> and d.* calls. I am setting width and height based on a final desired
>> 300dpi for the output image (i.e., pixels = # inch x 300).
>> However, the font size as can be set in e.g., d.legend is, I assume, based
>> on the assumption that the output image has a DPI of 72. Is there any way
>> to set the DPI of the output image?
> For the cairo driver, I believe that the font size is the size of 1-em
> in pixels (the cairo documentation says "user space units"; in the
> absence of any additional transformations, I believe that this means
The em is a relative measure, and depends on the font size. What this
thus tells is that the cairo driver uses the screen resolution (dpi) to
determine the font size / pixel ratio. The screen resolution of computer
screens nowadays is commonly 96 dpi (my screen is 1920x1080 pixels at
20.05 x 11.28 inch, so indeed 96 dpi). The font size of the legend text
created with d.legend is thus based on the assumption that the output
map as a dpi of 96 dpi. To determine the font size of a map that is to
be printed at 300 dpi, the font size in d.legend should be set at 300 /
96 x 12 = 37.5 (I tried this out and in my case this is indeed correct).
In ps.map one can define the required font size and dpi, and the
calculation above is done automatically (I assume it can get the screen
dpi from somewhere?). My question was basically if there is an option to
tell d.legend (and other d.* functions) the intended resolution (dpi) of
the output map, but I guess the answer is no. This may be logical given
the focus of ps.map on print and the d.* family on on-screen-display.
But in the light of the GSoC cartography suite project, it might be
something to consider adding an option to set the output dpi for the map?
CSS requires that |1px| must be exactly 1/96th of an inch in all printed
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the grass-dev