[self-follow-up] Hi Deri,
At 2024-10-10T18:50:47-0500, G. Branden Robinson wrote: > At 2024-10-11T00:06:10+0100, Deri wrote: > > On Wednesday, 9 October 2024 16:33:21 BST G. Branden Robinson wrote: > > > > If the warning was about the AT&T fontnames being deprecated but > > > > no change to the font used (i.e. continue to use CR), even > > > > though there would be 1000+ warnings, it would achieve your > > > > desire to drop support for the ancient font names but in a way > > > > which did not affect rendering of the document in the interim. > > > > > > What do you suggest instead? > > > > I tnought something like this:- [...] > Yeah. A slightly simpler approach might be to revert the thicket of > `ftr` removals from "ps.tmac", simplify `ATnTfonts` into a list, and > do the lookup dynamically. That way we'd (1) still get the benefit of > the traditional remappings without recapitulating them in GNU troff > source, and (2) not override the preferences of people who remapped > the old names to something else themselves. > > Someone who hated Bookman, for example, might have done this in a > document (or "troffrc-end"). > > .ftr KR PR > .ftr KI PI > .ftr KB PB > .ftp KX PBI > > We still want to warn them about their use of obsolete font names (and > we would), but also would not harsh their Palatino mellow. Their > document's rendering would not change. > > That doesn't get us away from hard-coding the deprecation list in GNU > troff for a release cycle. I don't see any way around that without a > far more disruptive change, likely not worth the effort. > > So. One static list for One Bell System, coming up? I proceeded with the foregoing. Expect the following in my next push. commit 11a77c563b406623b3156bcd47db1b35c32579cb Author: G. Branden Robinson <g.branden.robin...@gmail.com> Date: Mon Oct 28 18:16:40 2024 -0500 Slow our roll on withdrawal of AT&T font support. Deprecate rather than withdrawing support for AT&T font names, on "pdf" and "ps" devices only. * tmac/ps.tmac: Restore font translations to groff font names. * src/roff/troff/env.cpp: New global vector `deprecated_font_identifiers` stores deprecated AT&T font names. (warn_if_font_name_deprecated): New function searches vector for given symbol `nm` (a font name); if found, throws a warning in category "font" and deletes the name from the vector. (environment::set_font): Call `warn_if_font_name_deprecated()`. (init_env_requests): Populate new vector. * NEWS: Revise item. Thanks to Deri James for the discussion; see <https://lists.gnu.org/archive/html/groff/2024-10/msg00066.html> and follow-ups. diff --git a/ChangeLog b/ChangeLog index 86789e6eb..6bd1b9693 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2024-10-28 G. Branden Robinson <g.branden.robin...@gmail.com> + + Deprecate rather than withdrawing support for AT&T font names, + on "pdf" and "ps" devices only. + + * tmac/ps.tmac: Restore font translations to groff font names. + + * src/roff/troff/env.cpp: New global vector + `deprecated_font_identifiers` stores deprecated AT&T font names. + (warn_if_font_name_deprecated): New function searches vector for + given symbol `nm` (a font name); if found, throws a warning in + category "font" and deletes the name from the vector. + (environment::set_font): Call `warn_if_font_name_deprecated()`. + (init_env_requests): Populate new vector. + + * NEWS: Revise item. + + Thanks to Deri James for the discussion; see + <https://lists.gnu.org/archive/html/groff/2024-10/msg00066.html> + and follow-ups. + 2024-10-23 G. Branden Robinson <g.branden.robin...@gmail.com> * src/roff/troff/env.cpp (environment::print_env): Rearrange diff --git a/NEWS b/NEWS index 59a70a7f7..8f16e6239 100644 --- a/NEWS +++ b/NEWS @@ -185,22 +185,31 @@ Macro packages multi-line headings. Thanks to Peter Schaffter. * The device-specific macro files loaded by "troffrc" automatically on - startup, such as "ps.tmac" and "html.tmac", no longer perform font - translations for font names used by varieties of AT&T troff ('C', - 'Hb', 'HX', and many others). These names are not portable: in AT&T - troff, the font repertoire, like the special character repertoire, - was device-dependent. Since groff 1.23.0, GNU troff diagnoses - attempts to use nonexistent font names. We recommend addressing such - portability issues wherever suits you: (1) in a document, perhaps by - using `ie` and `el` requests and the `.g` register to test whether - the formatter claims support for groff extensions, then `ie` and `el` - again with the `F` groff conditional expression operator to check for - font availability, and performing font remappings with the groff - `ftr` request as desired; (2) doing so in your "troffrc" file; or (3) - by modifying these macro files similarly. Users of the "dvi" and - "lbp" output devices should be aware that these devices don't supply - full families of monospaced fonts (and never have). See grodvi(1) - and grolbp(1). + startup, such as "html.tmac", no longer perform font translations for + font names used by varieties of AT&T troff ('C', 'Hb', 'HX', and + several others). + + These names are not portable: in AT&T troff, the font repertoire, + like the special character repertoire, was device-dependent. Since + groff 1.23.0, GNU troff diagnoses attempts to use nonexistent font + names. We recommend addressing such portability issues wherever + suits you: (1) in a document, perhaps by using `ie` and `el` requests + and the `.g` register to test whether the formatter claims support + for groff extensions, then `ie` and `el` again with the `F` groff + conditional expression operator to check for font availability, and + performing font remappings with the groff `ftr` request as desired; + (2) doing so in your "troffrc" file; or (3) by modifying these macro + files similarly. Users of the "dvi" and "lbp" output devices should + be aware that these devices don't supply full families of monospaced + fonts (and never have). See grodvi(1) and grolbp(1) for lists of + font names supported by each device. + + The legacy names are retained for the "pdf" and "ps" devices for this + release; however, use of them prompts one warning in the "font" + category from the formatter per deprecated name. We expect to + withdraw support for the names completely in the next groff release. + See gropdf(1) and grops(1) for lists of font names supported by each + device. * Hyperlink support is now enabled by default on PDF and terminal devices for an (man) and doc (mdoc) documents. Instructions and diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp index c3c341e21..cf1e5df38 100644 --- a/src/roff/troff/env.cpp +++ b/src/roff/troff/env.cpp @@ -39,6 +39,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <errno.h> // errno #include <math.h> // ceil() +#include <vector> +#include <algorithm> // find() + symbol default_family("T"); enum { ADJUST_LEFT = 0, @@ -556,12 +559,29 @@ static node *configure_space_underlining(bool b) return new device_extension_node(m, 1); } +// TODO: Kill this off in groff 1.25. +std::vector<string> deprecated_font_identifiers; + +static void warn_if_font_name_deprecated(symbol nm) +{ + const char *name = nm.contents(); + std::vector<string>::iterator it + = find(deprecated_font_identifiers.begin(), + deprecated_font_identifiers.end(), name); + if (it != deprecated_font_identifiers.end()) { + warning(WARN_FONT, "font name '%1' is deprecated", name); + // Warn only once for each name. + deprecated_font_identifiers.erase(it); + } +} + bool environment::set_font(symbol nm) { if (line_interrupted) { warning(WARN_FONT, "ignoring font selection on interrupted line"); return true; // "no operation" is successful } + warn_if_font_name_deprecated(nm); // TODO: Kill off in groff 1.25. if (nm == symbol("P") || nm.is_empty()) { if (family->make_definite(prev_fontno) < 0) return false; @@ -4302,6 +4322,27 @@ void init_env_requests() register_dictionary.define("skw", new variable_reg(&skw_reg_contents)); register_dictionary.define("ssc", new variable_reg(&ssc_reg_contents)); register_dictionary.define("st", new variable_reg(&st_reg_contents)); + // TODO: Kill the following off in groff 1.25. + deprecated_font_identifiers.push_back("AX"); + deprecated_font_identifiers.push_back("KR"); + deprecated_font_identifiers.push_back("KI"); + deprecated_font_identifiers.push_back("KB"); + deprecated_font_identifiers.push_back("KX"); + deprecated_font_identifiers.push_back("CW"); + deprecated_font_identifiers.push_back("C"); + deprecated_font_identifiers.push_back("CO"); + deprecated_font_identifiers.push_back("CX"); + deprecated_font_identifiers.push_back("H"); + deprecated_font_identifiers.push_back("HO"); + deprecated_font_identifiers.push_back("HX"); + deprecated_font_identifiers.push_back("Hr"); + deprecated_font_identifiers.push_back("Hi"); + deprecated_font_identifiers.push_back("Hb"); + deprecated_font_identifiers.push_back("Hx"); + deprecated_font_identifiers.push_back("PA"); + deprecated_font_identifiers.push_back("PX"); + deprecated_font_identifiers.push_back("NX"); + deprecated_font_identifiers.push_back("ZI"); } // Appendix H of _The TeXbook_ is useful background for the following. diff --git a/tmac/ps.tmac b/tmac/ps.tmac index 5ddc45aca..f77a827ff 100644 --- a/tmac/ps.tmac +++ b/tmac/ps.tmac @@ -3,6 +3,28 @@ .do nr *groff_ps_tmac_C \n[.cp] .cp 0 . +.\" These font translations will be withdrawn in groff 1.25. +.ftr AX ABI +.ftr KR BMR +.ftr KI BMI +.ftr KB BMB +.ftr KX BMBI +.ftr CW CR +.ftr CO CI +.ftr CX CBI +.ftr H HR +.ftr HO HI +.ftr HX HBI +.ftr Hr HNR +.ftr Hi HNI +.ftr Hb HNB +.ftr Hx HNBI +.ftr NX NBI +.ftr PA PR +.ftr PX PBI +.ftr ZI ZCMI +.ftr C CR +. .cflags 8 \[an] . .char \[radicalex] \h'-\w'\[sr]'u'\[radicalex]\h'\w'\[sr]'u' Regards, Branden
signature.asc
Description: PGP signature