From 02c2f23a15c9d7b47d17eaf6aeda216120da5374 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 15 Apr 2011 22:26:43 -0700 Subject: [PATCH] render: Fix rendering of TAL_GAP rules. A rule that is set to TAL_GAP is supposed to have the same width or height as a rule of type TAL_1, but without drawing the line. That is, it is supposed to be a small blank space between rows or columns. Unfortunately, TAL_GAP was not implemented properly in the rendering code. It was treated just like TAL_0, which meant that it was ignored and no gap appeared. This commit implements TAL_GAP, fixing the problem. --- src/output/render.c | 13 +++++++------ tests/output/render.at | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/output/render.c b/src/output/render.c index 6722a13d..a4fe9e24 100644 --- a/src/output/render.c +++ b/src/output/render.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2011 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 @@ -455,7 +455,7 @@ measure_rule (const struct render_params *params, const struct table *table, enum table_axis b = !a; unsigned int rules; int d[TABLE_N_AXES]; - int width, i; + int width; /* Determine all types of rules that are present, as a bitmap in 'rules' where rule type 't' is present if bit 2**t is set. */ @@ -466,10 +466,11 @@ measure_rule (const struct render_params *params, const struct table *table, /* Calculate maximum width of the rules that are present. */ width = 0; - for (i = 0; i < N_LINES; i++) - if (rules & (1u << i)) - width = MAX (width, params->line_widths[a][rule_to_render_type (i)]); - + if (rules & (1u << TAL_1) + || (z > 0 && z < table->n[a] && rules & (1u << TAL_GAP))) + width = params->line_widths[a][RENDER_LINE_SINGLE]; + if (rules & (1u << TAL_2)) + width = MAX (width, params->line_widths[a][RENDER_LINE_DOUBLE]); return width; } diff --git a/tests/output/render.at b/tests/output/render.at index a39f688d..250da4f2 100644 --- a/tests/output/render.at +++ b/tests/output/render.at @@ -301,9 +301,9 @@ AT_DATA([input], [2 2 2*1 hij\nklm\nnop ]) AT_CHECK([render-test input], [0], [dnl -abhij -cdklm -efnop +ab hij +cd klm +ef nop ]) AT_CLEANUP -- 2.30.2