From: Ben Pfaff Date: Thu, 31 Dec 2020 03:27:10 +0000 (-0800) Subject: output: Remove superscript support. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61b107f4f5e3ee7a468c91bc7fa269e268c5bc84;p=pspp output: Remove superscript support. The previous commit df5005061c03 ("pivot-output: Implement superscript.") finished this support, but on further inspection, there's nothing in the non-legacy .spv format that can set a superscript. The legacy .spv format appears to be able to do it; I'll worry about that if it gets implemented later. --- diff --git a/src/output/ascii.c b/src/output/ascii.c index f019fda4e1..29cc73b811 100644 --- a/src/output/ascii.c +++ b/src/output/ascii.c @@ -706,7 +706,7 @@ ascii_measure_cell_width (void *a_, const struct table_cell *cell, ascii_layout_cell (a, cell, bb, clip, max_width, &h); if (cell->n_footnotes || strchr (cell->text, ' ') - || cell->n_subscripts || cell->superscript) + || cell->n_subscripts) { bb[H][1] = 1; ascii_layout_cell (a, cell, bb, clip, min_width, &h); @@ -907,8 +907,6 @@ add_markers (const char *text, const struct table_cell *cell) ds_put_cstr (&s, text); for (size_t i = 0; i < cell->n_subscripts; i++) ds_put_format (&s, "%c%s", i ? ',' : '_', cell->subscripts[i]); - if (cell->superscript) - ds_put_format (&s, "^%s", cell->superscript); for (size_t i = 0; i < cell->n_footnotes; i++) ds_put_format (&s, "[%s]", cell->footnotes[i]->marker); return ds_steal_cstr (&s); @@ -927,9 +925,9 @@ ascii_layout_cell (struct ascii_driver *a, const struct table_cell *cell, ? output_get_text_from_markup (cell->text) : cell->text); - /* Append footnotes, subscripts, superscript if any. */ + /* Append footnotes, subscripts if any. */ const char *text; - if (cell->n_footnotes || cell->n_subscripts || cell->superscript) + if (cell->n_footnotes || cell->n_subscripts) { text = add_markers (plain_text, cell); if (plain_text != cell->text) diff --git a/src/output/cairo-fsm.c b/src/output/cairo-fsm.c index 16cf47dec4..39f1cf02e9 100644 --- a/src/output/cairo-fsm.c +++ b/src/output/cairo-fsm.c @@ -725,7 +725,7 @@ xr_layout_cell_text (struct xr_fsm *xr, const struct table_cell *cell, PANGO_UNDERLINE_SINGLE)); } - if (cell->n_footnotes || cell->n_subscripts || cell->superscript) + if (cell->n_footnotes || cell->n_subscripts) { /* If we haven't already put TEXT into tmp, do it now. */ if (ds_is_empty (&tmp)) @@ -742,10 +742,6 @@ xr_layout_cell_text (struct xr_fsm *xr, const struct table_cell *cell, ds_put_cstr (&tmp, cell->subscripts[i]); } - size_t superscript_ofs = ds_length (&tmp); - if (cell->superscript) - ds_put_cstr (&tmp, cell->superscript); - size_t footnote_ofs = ds_length (&tmp); for (size_t i = 0; i < cell->n_footnotes; i++) { @@ -793,9 +789,9 @@ xr_layout_cell_text (struct xr_fsm *xr, const struct table_cell *cell, subscript_ofs, PANGO_ATTR_INDEX_TO_TEXT_END); if (cell->n_subscripts) add_attr (attrs, pango_attr_rise_new (-3000), subscript_ofs, - superscript_ofs - subscript_ofs); - if (cell->superscript || cell->n_footnotes) - add_attr (attrs, pango_attr_rise_new (3000), superscript_ofs, + footnote_ofs - subscript_ofs); + if (cell->n_footnotes) + add_attr (attrs, pango_attr_rise_new (3000), footnote_ofs, PANGO_ATTR_INDEX_TO_TEXT_END); } diff --git a/src/output/csv.c b/src/output/csv.c index 0493922241..e5b47a06ef 100644 --- a/src/output/csv.c +++ b/src/output/csv.c @@ -229,7 +229,7 @@ csv_submit (struct output_driver *driver, if (x != cell.d[TABLE_HORZ][0] || y != cell.d[TABLE_VERT][0]) csv_output_field (csv, ""); else if (!(cell.options & TAB_MARKUP) && !cell.n_footnotes - && !cell.n_subscripts && !cell.superscript) + && !cell.n_subscripts) csv_output_field (csv, cell.text); else { @@ -248,8 +248,6 @@ csv_submit (struct output_driver *driver, for (size_t i = 0; i < cell.n_subscripts; i++) ds_put_format (&s, "%c%s", i ? ',' : '_', cell.subscripts[i]); - if (cell.superscript) - ds_put_format (&s, "^%s", cell.superscript); csv_format_footnotes (cell.footnotes, cell.n_footnotes, &s); csv_output_field (csv, ds_cstr (&s)); ds_destroy (&s); diff --git a/src/output/html.c b/src/output/html.c index df7003a4a9..64db78dc8e 100644 --- a/src/output/html.c +++ b/src/output/html.c @@ -532,8 +532,6 @@ html_put_table_cell_text (struct html_driver *html, } fputs ("", html->file); } - if (cell->superscript) - escape_tag (html->file, "sup", cell->superscript, " ", "
"); html_put_footnote_markers (html, cell->footnotes, cell->n_footnotes); } diff --git a/src/output/pivot-output.c b/src/output/pivot-output.c index 12e1efafdb..44a044b8b0 100644 --- a/src/output/pivot-output.c +++ b/src/output/pivot-output.c @@ -135,9 +135,6 @@ fill_cell (struct table *t, int x1, int y1, int x2, int y2, if (value->n_subscripts) table_add_subscripts (t, x1, y1, value->subscripts, value->n_subscripts); - - if (value->superscript) - table_add_superscript (t, x1, y1, value->superscript); } } diff --git a/src/output/pivot-table.c b/src/output/pivot-table.c index adebd84ffa..5c64671473 100644 --- a/src/output/pivot-table.c +++ b/src/output/pivot-table.c @@ -2007,7 +2007,7 @@ pivot_value_format_body (const struct pivot_value *value, /* Appends a text representation of VALUE to OUT. SHOW_VALUES and SHOW_VARIABLES control whether variable and value labels are included. - Subscripts and superscripts and footnotes are included. */ + Subscripts and footnotes are included. */ void pivot_value_format (const struct pivot_value *value, enum settings_value_show show_values, @@ -2022,9 +2022,6 @@ pivot_value_format (const struct pivot_value *value, ds_put_format (out, "%c%s", i ? ',' : '_', value->subscripts[i]); } - if (value->superscript) - ds_put_format (out, "^%s", value->superscript); - for (size_t i = 0; i < value->n_footnotes; i++) { ds_put_byte (out, '^'); @@ -2062,8 +2059,6 @@ pivot_value_destroy (struct pivot_value *value) free (value->subscripts[i]); free (value->subscripts); - free (value->superscript); - switch (value->type) { case PIVOT_VALUE_NUMERIC: diff --git a/src/output/pivot-table.h b/src/output/pivot-table.h index 6769b600ba..be82d0685e 100644 --- a/src/output/pivot-table.h +++ b/src/output/pivot-table.h @@ -639,8 +639,6 @@ struct pivot_value char **subscripts; size_t n_subscripts; - char *superscript; - const struct pivot_footnote **footnotes; size_t n_footnotes; diff --git a/src/output/table-provider.h b/src/output/table-provider.h index be45912d92..8cac97a6d9 100644 --- a/src/output/table-provider.h +++ b/src/output/table-provider.h @@ -57,7 +57,6 @@ struct table_cell char *text; /* A paragraph of text. */ char **subscripts; size_t n_subscripts; - char *superscript; const struct footnote **footnotes; size_t n_footnotes; const struct table_area_style *style; diff --git a/src/output/table.c b/src/output/table.c index ace6c3cb59..5087441224 100644 --- a/src/output/table.c +++ b/src/output/table.c @@ -638,15 +638,6 @@ table_add_subscripts (struct table *table, int x, int y, cell->subscripts[i] = pool_strdup (table->container, subscripts[i]); } -/* Sets the superscript for column X, row Y in TABLE. */ -void -table_add_superscript (struct table *table, int x, int y, - const char *superscript) -{ - get_joined_cell (table, x, y)->superscript - = pool_strdup (table->container, superscript); -} - /* Create a footnote in TABLE with MARKER (e.g. "a") as its marker and CONTENT as its content. The footnote will be styled as STYLE, which is mandatory. IDX must uniquely identify the footnote within TABLE. diff --git a/src/output/table.h b/src/output/table.h index edd617e8e1..07c88874c8 100644 --- a/src/output/table.h +++ b/src/output/table.h @@ -266,8 +266,6 @@ void table_joint_text (struct table *, int x1, int y1, int x2, int y2, void table_add_subscripts (struct table *, int x, int y, char **subscripts, size_t n_subscripts); -void table_add_superscript (struct table *, int x, int y, - const char *superscript); /* Footnotes.