gbranden pushed a commit to branch master
in repository groff.
commit 09ba70691747e65ae76bed727837245dc55c4b5c
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Apr 20 21:17:40 2025 -0500
[troff]: Fix Savannah #67038 (`.b` register).
* src/roff/troff/node.h: Declare `get_bold_fontno` as taking a new first
argument, a pointer to an `environment`.
* src/roff/troff/node.cpp (get_bold_font): Likewise with definition, and
resolve the environment's currently selected font so that we report
the correct emboldening amount even if an abstract style is the
current font selection. Use a temporary variable to avoid yard-long
expression, like `env_get_zoom()`.
Fixes <https://savannah.gnu.org/bugs/?67038>.
---
ChangeLog | 14 ++++++++++++++
src/roff/troff/env.cpp | 2 +-
src/roff/troff/node.cpp | 5 +++--
src/roff/troff/node.h | 2 +-
4 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 209dc357b..8a97859fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2025-04-20 G. Branden Robinson <[email protected]>
+
+ [troff]: Fix Savannah #67038.
+
+ * src/roff/troff/node.h: Declare `get_bold_fontno` as taking a
+ new first argument, a pointer to an `environment`.
+ * src/roff/troff/node.cpp (get_bold_font): Likewise with
+ definition, and resolve the environment's currently selected
+ font so that we report the correct emboldening amount even if an
+ abstract style is the current font selection. Use a temporary
+ variable to avoid yard-long expression, like `env_get_zoom()`.
+
+ Fixes <https://savannah.gnu.org/bugs/?67038>.
+
2025-04-20 G. Branden Robinson <[email protected]>
[groff]: Regression-test Savannah #67038 (behavior of `.b`
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 61c55a1bc..c1c525053 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -1080,7 +1080,7 @@ vunits environment::total_post_vertical_spacing()
int environment::get_bold()
{
- return get_bold_fontno(fontno);
+ return get_bold_fontno(this, fontno);
}
hunits environment::get_digit_width()
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 9d1ba7ad6..aaca807a9 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -6963,11 +6963,12 @@ int symbol_fontno(symbol s)
}
// XXX: This does _not_ return a font "number" (mounting position)!
-int get_bold_fontno(int n)
+int get_bold_fontno(environment *env, int n)
{
if (is_valid_font_mounting_position(n)) {
hunits offset;
- if (font_table[n]->get_bold(&offset))
+ int fontno = env->get_family()->resolve(env->get_font());
+ if (font_table[fontno]->get_bold(&offset))
return offset.to_units() + 1;
else
return 0;
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index 2b312b577..265e84203 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -676,7 +676,7 @@ node *reverse_node_list(node *);
void delete_node_list(node *);
node *copy_node_list(node *);
-int get_bold_fontno(int);
+int get_bold_fontno(environment *, int);
inline hyphen_list::hyphen_list(unsigned char code, hyphen_list *p)
: is_hyphen(false), is_breakable(false), hyphenation_code(code), next(p)
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit