From: Ben Pfaff Date: Thu, 22 Nov 2018 05:25:13 +0000 (-0800) Subject: output: Implement styling for footnotes. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=f278ec924a1f795d06a497ca44866aac4cde5c9f output: Implement styling for footnotes. --- diff --git a/src/output/render.c b/src/output/render.c index c3a59a6c42..f73137f0e3 100644 --- a/src/output/render.c +++ b/src/output/render.c @@ -1425,6 +1425,11 @@ add_footnote_page (struct render_pager *p, const struct table_item *item) { tab_text_format (t, 0, i, TAB_LEFT, "%s.", f[i]->marker); tab_text (t, 1, i, TAB_LEFT, f[i]->content); + if (f[i]->style) + { + tab_add_style (t, 0, i, f[i]->style); + tab_add_style (t, 1, i, f[i]->style); + } } render_pager_add_table (p, &t->table); diff --git a/src/output/tab.c b/src/output/tab.c index db8488d854..435fa609ce 100644 --- a/src/output/tab.c +++ b/src/output/tab.c @@ -621,12 +621,13 @@ tab_joint_text_format (struct tab_table *table, int x1, int y1, int x2, struct footnote * tab_create_footnote (struct tab_table *table, size_t idx, const char *content, - const char *marker) + const char *marker, struct cell_style *style) { struct footnote *f = pool_alloc (table->container, sizeof *f); f->idx = idx; f->content = pool_strdup (table->container, content); f->marker = pool_strdup (table->container, marker); + f->style = style; return f; } diff --git a/src/output/tab.h b/src/output/tab.h index f45e1f6055..40f871b12d 100644 --- a/src/output/tab.h +++ b/src/output/tab.h @@ -155,7 +155,8 @@ void tab_joint_text_format (struct tab_table *, int x1, int y1, int x2, int y2, PRINTF_FORMAT (7, 8); struct footnote *tab_create_footnote (struct tab_table *, size_t idx, - const char *content, const char *marker); + const char *content, const char *marker, + struct cell_style *); void tab_add_footnote (struct tab_table *, int x, int y, const struct footnote *); diff --git a/src/output/table-provider.h b/src/output/table-provider.h index d875462c9c..2a3a17c9da 100644 --- a/src/output/table-provider.h +++ b/src/output/table-provider.h @@ -27,6 +27,7 @@ struct footnote size_t idx; char *content; char *marker; + struct cell_style *style; }; /* An item of contents within a table cell. */ diff --git a/tests/output/render-test.c b/tests/output/render-test.c index 42b8795336..e5eea91d94 100644 --- a/tests/output/render-test.c +++ b/tests/output/render-test.c @@ -475,7 +475,7 @@ read_table (FILE *stream) { char marker[2] = { 'a' + n_footnotes, '\0' }; struct footnote *f = tab_create_footnote ( - tab, n_footnotes, content, marker); + tab, n_footnotes, content, marker, NULL); tab_add_footnote (tab, c, r, f); n_footnotes++; }