From: Ben Pfaff Date: Sat, 24 Jun 2023 17:04:48 +0000 (-0700) Subject: html: Include generic font-family name "sans-serif" as a fallback. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e32bec11e6dadde05e1316f489454091ab2a5b8c;p=pspp html: Include generic font-family name "sans-serif" as a fallback. https://developer.mozilla.org/en-US/docs/Web/CSS/font-family recommends that a font-family specification should always include one of the generic font-family names to serve as a fallback. For PSPP, sans-serif is a reasonable fixed fallback. This addresses bug #63020, which asks for "Sans Serif" to mean sans-serif. It obviously doesn't generalize to other font name translations, but it does address the case that the bug filer complained about. If we need a more general mechanism, we can invent it later. Thanks to Frans Houweling for reporting this issue. --- diff --git a/src/output/html.c b/src/output/html.c index 5b798302d6..076a9589ae 100644 --- a/src/output/html.c +++ b/src/output/html.c @@ -542,7 +542,9 @@ html_put_table_cell (struct html_driver *html, const struct pivot_table *pt, { put_style (&style, "font-family", "\""); escape_string (html->file, fs->typeface, " ", "\n"); - putc ('"', html->file); + + /* Always include a generic font family name as a fallback. */ + fputs ("\", sans-serif", html->file); } if (fs->bold) put_style (&style, "font-weight", "bold");