It's really a mystery why a 9-point font doesn't appear 9 points tall
in PDF (etc.) output, but it doesn't. I guess we're doing something
wrong somewhere. But until we figure out the underlying issue, we need
to scale down font sizes for PDF and not for on-screen use.
This is a slightly better fix for font sizes than the previous commit
3c15b41c036 (pivot-table: Kluge dropping default 9-point font to make
output readable.)
/* Internal state. */
struct render_params *params;
/* Internal state. */
struct render_params *params;
int char_width, char_height;
char *command_name;
char *title;
int char_width, char_height;
char *command_name;
char *title;
}
static struct xr_driver *
}
static struct xr_driver *
-xr_allocate (const char *name, int device_type, struct string_map *o)
+xr_allocate (const char *name, int device_type, struct string_map *o,
+ double font_scale)
{
struct xr_driver *xr = xzalloc (sizeof *xr);
struct output_driver *d = &xr->driver;
{
struct xr_driver *xr = xzalloc (sizeof *xr);
struct output_driver *d = &xr->driver;
string_map_init (&xr->heading_vars);
string_map_init (&xr->heading_vars);
+ /* This is a nasty kluge for an issue that does not make sense. On any
+ surface other than a screen (e.g. for output to PDF or PS or SVG), the
+ fonts are way too big by default. A "9-point" font seems to appear about
+ 16 points tall. We use a scale factor for these surfaces to help, but the
+ underlying issue is a mystery. */
+ xr->font_scale = font_scale;
+
apply_options (xr, o);
return xr;
apply_options (xr, o);
return xr;
cairo_status_t status;
double width_pt, length_pt;
cairo_status_t status;
double width_pt, length_pt;
- xr = xr_allocate (file_name, device_type, o);
+ xr = xr_allocate (file_name, device_type, o, 72.0 / 128.0);
width_pt = xr_to_pt (xr->width + xr->left_margin + xr->right_margin);
length_pt = xr_to_pt (xr->length + xr->top_margin + xr->bottom_margin);
width_pt = xr_to_pt (xr->width + xr->left_margin + xr->right_margin);
length_pt = xr_to_pt (xr->length + xr->top_margin + xr->bottom_margin);
{
PangoFontDescription *desc = parse_font (
font_style->typeface,
{
PangoFontDescription *desc = parse_font (
font_style->typeface,
- font_style->size ? font_style->size * 1000 * 72 / 128 : 10000,
+ font_style->size ? font_style->size * 1000 * xr->font_scale : 10000,
font_style->bold, font_style->italic);
if (desc)
{
font_style->bold, font_style->italic);
if (desc)
{
struct xr_driver *
xr_driver_create (cairo_t *cairo, struct string_map *options)
{
struct xr_driver *
xr_driver_create (cairo_t *cairo, struct string_map *options)
{
- struct xr_driver *xr = xr_allocate ("cairo", 0, options);
+ struct xr_driver *xr = xr_allocate ("cairo", 0, options, 1.0);
xr_set_cairo (xr, cairo);
return xr;
}
xr_set_cairo (xr, cairo);
return xr;
}
.bold = BOLD, \
.fg = { [0] = CELL_COLOR_BLACK, [1] = CELL_COLOR_BLACK}, \
.bg = { [0] = CELL_COLOR_WHITE, [1] = CELL_COLOR_WHITE}, \
.bold = BOLD, \
.fg = { [0] = CELL_COLOR_BLACK, [1] = CELL_COLOR_BLACK}, \
.bg = { [0] = CELL_COLOR_WHITE, [1] = CELL_COLOR_WHITE}, \
.typeface = (char *) "Sans Serif", \
}, \
}
.typeface = (char *) "Sans Serif", \
}, \
}