gbranden pushed a commit to branch master
in repository groff.
commit 9698d3dea2f5d14cb071b818014638201493cb3b
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun May 4 06:09:48 2025 -0500
[troff]: Implement new `pftr` request.
* src/roff/troff/node.cpp (dump_font_translations): Add.
(init_none_requests): Wire up `pftr` request name to
`dump_font_translations()`.
* doc/groff.texi (Selecting Fonts, Debugging):
* man/groff.7.man (Request short reference, Debugging):
* man/groff_diff.7.man (New requests, Debugging):
* NEWS: Document it.
Illustration:
$ echo .pftr | ./build/test-groff -T ps
Hr HNR
KI BMI
Hi HNI
KB BMB
Hb HNB
KX BMBI
Hx HNBI
C CR
CW CR
CO CI
NX NBI
CX CBI
PA PR
H HR
PX PBI
HO HI
AX ABI
ZI ZCMI
HX HBI
KR BMR
---
ChangeLog | 13 +++++++++++++
NEWS | 3 +++
doc/groff.texi.in | 17 +++++++++++++++++
man/groff.7.man | 8 ++++++++
man/groff_diff.7.man | 16 ++++++++++++++++
src/roff/troff/node.cpp | 12 ++++++++++++
6 files changed, 69 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index d8f4bacee..7ced61c14 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2025-05-04 G. Branden Robinson <[email protected]>
+
+ [troff]: Implement new `pftr` request.
+
+ * src/roff/troff/node.cpp (dump_font_translations): Add.
+ (init_none_requests): Wire up `pftr` request name to
+ `dump_font_translations()`.
+
+ * doc/groff.texi (Selecting Fonts, Debugging):
+ * man/groff.7.man (Request short reference, Debugging):
+ * man/groff_diff.7.man (New requests, Debugging):
+ * NEWS: Document it.
+
2025-05-02 G. Branden Robinson <[email protected]>
* tmac/mdoc/doc-syms (Lb): Stop throwing warning if no
diff --git a/NEWS b/NEWS
index 4b95e005d..4d0836ff6 100644
--- a/NEWS
+++ b/NEWS
@@ -198,6 +198,9 @@ troff
* A new request, `pcomposite`, reports to the standard error stream the
list of defined composite character mappings.
+* A new request, `pftr`, reports to the standard error stream the
+ list of configured font translations.
+
* A new request, `phw`, reports to the standard error stream the
list of hyphenation exceptions associated with the current
hyphenation language.
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index dbda92e25..b06066cd9 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -10807,6 +10807,10 @@ the @code{ft}, @code{ul}, @code{bd}, @code{cs},
@code{tkf},
to@tie{}@var{f}, GNU @command{troff} uses @var{g} instead. Omit @var{g}
or repeat @var{f} as@tie{}@var{g} to untranslate @var{f}. @var{f} and
@var{g} need not be mounted fonts.
+
+You can obtain a report of font translations defined by @code{ftr} on
+the standard error stream with the @code{pftr} request.
+@xref{Debugging}.
@endDefreq
@DefreqList {fzoom, font [@Var{zoom}]}
@@ -17885,6 +17889,7 @@ Examine the state of the formatter with requests that
write lists of
defined names---macros, strings, and diversions---colors,
composite character mappings,
environments,
+font translations,
automatic hyphenation codes
and exceptions,
registers,
@@ -18057,6 +18062,18 @@ Report the state of the current environment followed
by that of all
other environments to the standard error stream.
@endDefreq
+@Defreq {pftr, }
+@cindex dumping font translations (@code{pftr})
+@cindex font translations, dumping (@code{pftr})
+@cindex translations, font, dumping (@code{pftr})
+Report,
+to the standard error stream,
+the list of font translations.
+Recall the @code{ftr} request description in @ref{Selecting Fonts}.
+The ``from'' font identifier is listed first,
+followed by its ``to'' translation.
+@endDefreq
+
@Defreq {phw, }
@cindex dumping hyphenation exceptions (@code{phw})
@cindex hyphenation exceptions, dumping (@code{phw})
diff --git a/man/groff.7.man b/man/groff.7.man
index fd1cd0e9a..3696f8d66 100644
--- a/man/groff.7.man
+++ b/man/groff.7.man
@@ -4188,6 +4188,12 @@ Report the state of the current environment followed by
that of all
other environments to the standard error stream.
.
.TPx
+.REQ .pftr
+Report,
+to the standard error stream,
+the list of font translations.
+.
+.TPx
.REQ .phw
Report,
to the standard error stream,
@@ -8930,6 +8936,8 @@ composite character mappings
.RB ( pcomposite );
environments
.RB ( pev );
+font translations
+.RB ( pftr );
automatic hyphenation codes
.RB ( pchar )
and exceptions
diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man
index 0af06b236..2fcfae235 100644
--- a/man/groff_diff.7.man
+++ b/man/groff_diff.7.man
@@ -3474,6 +3474,20 @@ other environments to the standard error stream.
.
.
.TP
+.B .pftr
+Report,
+to the standard error stream,
+the list of font translations.
+.
+See the
+.RB \[lq] pftr \[rq]
+request in section \[lq]New requests\[rq] above.
+.
+The \[lq]from\[rq] font identifier is listed first,
+followed by its \[lq]to\[rq] translation.
+.
+.
+.TP
.B .phw
Report,
to the standard error stream,
@@ -5856,6 +5870,8 @@ composite characters
.RB ( pcomposite ),
environments
.RB ( pev ),
+font translations
+.RB ( pftr ),
automatic hyphenation codes
.RB ( pchar )
and exceptions
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index f6ab84298..25bf52635 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -6567,6 +6567,17 @@ static void translate_font()
skip_line();
}
+static void dump_font_translations()
+{
+ dictionary_iterator iter(font_translation_dictionary);
+ symbol from, to;
+ while (iter.get(&from, reinterpret_cast<void **>(&to)))
+ errprint("%1\t%2\n", from.contents(), to.contents());
+ fflush(stderr);
+ skip_line();
+ return;
+}
+
static void mount_font_at_position()
{
if (!has_arg()) {
@@ -7304,6 +7315,7 @@ void init_node_requests()
init_request("ftr", translate_font);
init_request("kern", set_kerning_mode);
init_request("lg", set_ligature_mode);
+ init_request("pftr", dump_font_translations);
init_request("rfschar", remove_font_specific_character);
init_request("shc", set_soft_hyphen_character);
init_request("special", set_special_fonts);
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit