URL:
<https://savannah.gnu.org/bugs/?64966>
Summary: [troff]: make the underline font
environment-specific
Group: GNU roff
Submitter: gbranden
Submitted: Sat 02 Dec 2023 09:18:03 PM UTC
Category: Core
Severity: 1 - Wish
Item Group: Feature change
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Sat 02 Dec 2023 09:18:03 PM UTC By: G. Branden Robinson <gbranden>
While a little-used feature, it doesn't seem to be necessary for the
"underline font" to be global.
Also, its value is not introspectable. Add a read-only register `.uf` for
it.
This simple patch doesn't work because `get_underline_fontno` isn't in scope.
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 5d844ed20..e12b9f34c 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -3539,6 +3539,7 @@ void init_env_requests()
init_string_env_reg(".sty", get_style_name_string);
init_string_env_reg(".tabs", get_tabs);
init_int_env_reg(".u", get_fill);
+ init_int_env_reg(".uf", get_underline_fontno);
init_vunits_env_reg(".v", get_vertical_spacing);
init_hunits_env_reg(".w", get_prev_char_width);
init_int_env_reg(".zoom", get_zoom);
Fixing this means moving some machinery from node.cpp to env.cpp.
We can see that this probably should have been the case all along.
src/roff/troff/env.cpp: if (fontno == get_underline_fontno())
src/roff/troff/env.cpp: if (prev_fontno == get_underline_fontno())
src/roff/troff/env.cpp: curenv->fontno = curenv->pre_underline_fontno;
src/roff/troff/env.cpp: curenv->pre_underline_fontno = curenv->fontno;
src/roff/troff/env.cpp: curenv->fontno = get_underline_fontno();
src/roff/troff/env.cpp: fontno = pre_underline_fontno;
src/roff/troff/env.cpp: errprint(" font number before underlining: %1\n",
pre_underline_fontno);
src/roff/troff/env.cpp: init_int_env_reg(".uf", get_underline_fontno);
src/roff/troff/env.h: int pre_underline_fontno;
src/roff/troff/node.cpp:static int underline_fontno = 2;
src/roff/troff/node.cpp: underline_fontno = finfo.position;
src/roff/troff/node.cpp:int get_underline_fontno()
src/roff/troff/node.cpp: return underline_fontno;
src/roff/troff/node.h:extern int get_underline_fontno();
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?64966>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/