/* PSPP - a program for statistical analysis.
- Copyright (C) 2009 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
xr_create (const char *name, enum output_device_type device_type,
struct string_map *o)
{
- enum { MIN_LENGTH = 3 };
+ enum { MIN_WIDTH = 3, MIN_LENGTH = 3 };
struct output_driver *d;
struct xr_driver *xr;
cairo_surface_t *surface;
if (!xr_set_cairo (xr, xr->cairo))
goto error;
+ if (xr->width / (xr->font_height / 2) < MIN_WIDTH)
+ {
+ error (0, 0, _("The defined page is not wide enough to hold at least %d "
+ "characters in the default font. In fact, there's only "
+ "room for %d characters."),
+ MIN_WIDTH,
+ xr->width / (xr->font_height / 2));
+ goto error;
+ }
+
if (xr->length / xr->font_height < MIN_LENGTH)
{
error (0, 0, _("The defined page is not long "
{
struct table_item *item;
- item = table_item_create (table_from_string (0, text), NULL);
+ item = table_item_create (table_from_string (TAB_LEFT, text),
+ NULL);
xr_submit (&xr->driver, &item->output_item);
table_item_unref (item);
}
if (font->desc != NULL)
pango_font_description_free (font->desc);
pango_font_metrics_unref (font->metrics);
- g_object_unref (font->layout);
+ if (font->layout != NULL)
+ g_object_unref (font->layout);
}
/* Cairo driver class. */
const char *text = text_item_get_text (text_item);
struct table_item *table_item;
- table_item = table_item_create (table_from_string (0, text), NULL);
+ table_item = table_item_create (table_from_string (TAB_LEFT, text),
+ NULL);
r = xr_rendering_create (xr, &table_item->output_item, cr);
table_item_unref (table_item);
}