/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2007, 2009, 2010, 2011, 2012, 2013 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
#include "output/table-item.h"
#include "output/text-item.h"
-#include "gl/error.h"
#include "gl/minmax.h"
#include "gl/xalloc.h"
static inline int
make_box_index (int left, int right, int top, int bottom)
{
- return ((right * 3 + bottom) * 3 + left) * 3 + top;
+ return ((right * RENDER_N_LINES + bottom) * RENDER_N_LINES + left) * RENDER_N_LINES + top;
}
/* How to emphasize text. */
if (dim >= 1 && errno != ERANGE && *tail == '\0')
dim = value;
else
- error (0, 0, _("%s: %s must be positive integer or `auto'"),
+ msg (MW, _("%s: %s must be positive integer or `auto'"),
option->driver_name, option->name);
}
}
if (a->width < MIN_WIDTH || a->length < MIN_LENGTH)
{
if (issue_error)
- error (0, 0,
+ msg (ME,
_("ascii: page excluding margins and headers "
"must be at least %d characters wide by %d lines long, but "
"as configured is only %d characters by %d lines"),
ascii_close_page (a);
if (fn_close (a->file_name, a->file) != 0)
- error (0, errno, _("ascii: closing output file `%s'"),
+ msg_error (ME, errno, _("ascii: closing output file `%s'"),
a->file_name);
a->file = NULL;
}
size_t last_break_ofs = 0;
int last_break_width = 0;
int width = 0;
+ size_t graph_ofs;
size_t ofs;
for (ofs = 0; ofs < n; )
}
ofs += mblen;
}
- if (b[ofs] != UC_BREAK_MANDATORY)
- {
- while (ofs > 0 && isspace (line[ofs - 1]))
- {
- ofs--;
- width--;
- }
- }
- if (width > *widthp)
- *widthp = width;
+
+ /* Trim any trailing spaces off the end of the text to be drawn. */
+ for (graph_ofs = ofs; graph_ofs > 0; graph_ofs--)
+ if (!isspace (line[graph_ofs - 1]))
+ break;
+ width -= ofs - graph_ofs;
/* Draw text. */
- text_draw (a, cell->options, bb, clip, y, line, ofs, width);
+ text_draw (a, cell->options, bb, clip, y, line, graph_ofs, width);
- /* Next line. */
- pos += ofs;
- if (ofs < n && isspace (line[ofs]))
- pos++;
+ /* If a new-line ended the line, just skip the new-line. Otherwise, skip
+ past any spaces past the end of the line (but not past a new-line). */
+ if (b[ofs] == UC_BREAK_MANDATORY)
+ ofs++;
+ else
+ while (ofs < n && isspace (line[ofs]) && b[ofs] != UC_BREAK_MANDATORY)
+ ofs++;
+ if (width > *widthp)
+ *widthp = width;
+ pos += ofs;
}
*heightp = y - bb[V][0];
}
else
{
- error (0, errno, _("ascii: opening output file `%s'"),
+ msg_error (errno, _("ascii: opening output file `%s'"),
a->file_name);
a->error = true;
return false;