gbranden pushed a commit to branch master
in repository groff.
commit d0c5ac61f687fcf6870fe2d0e7ed78e13394f6a1
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue May 13 10:59:27 2025 -0500
[troff]: Slighty refactor (boolify, rename) [3/3].
* src/roff/troff/node.cpp (glyph_node::tprint)
(glyph_node::zero_width_tprint, composite_node::tprint): Rename `bold`
and `cs` local variables to `is_emboldened` and `is_constantly_spaced`
to express logical predication.
(glyph_node::zero_width_tprint, composite_node::tprint): Demote same
local variables from `int` to `bool`.
---
ChangeLog | 11 +++++++++++
src/roff/troff/node.cpp | 34 +++++++++++++++++-----------------
2 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0a7d4e683..bdb010270 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2025-05-13 G. Branden Robinson <[email protected]>
+
+ [troff]: Slighty refactor (boolify, rename).
+
+ * src/roff/troff/node.cpp (glyph_node::tprint)
+ (glyph_node::zero_width_tprint, composite_node::tprint): Rename
+ `bold` and `cs` local variables to `is_emboldened` and
+ `is_constantly_spaced` to express logical predication.
+ (glyph_node::zero_width_tprint, composite_node::tprint): Demote
+ same local variables from `int` to `bool`.
+
2025-05-13 G. Branden Robinson <[email protected]>
[troff]: Slighty refactor (boolify, rename).
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 9f6fff31e..2f1de0654 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -5011,14 +5011,14 @@ void glyph_node::tprint(troff_output_file *out)
out->put_char_width(ci, ptf, gcol, fcol, width(), H0);
else {
hunits offset;
- bool bold = tf->is_emboldened(&offset);
+ bool is_emboldened = tf->is_emboldened(&offset);
hunits w = ptf->get_width(ci);
hunits k = H0;
hunits x;
- bool cs = tf->is_constantly_spaced(&x);
- if (cs) {
+ bool is_constantly_spaced = tf->is_constantly_spaced(&x);
+ if (is_constantly_spaced) {
x -= w;
- if (bold)
+ if (is_emboldened)
x -= offset;
hunits x2 = (x / 2);
out->right(x2);
@@ -5026,7 +5026,7 @@ void glyph_node::tprint(troff_output_file *out)
}
else
k = tf->get_track_kern();
- if (bold) {
+ if (is_emboldened) {
out->put_char(ci, ptf, gcol, fcol);
out->right(offset);
}
@@ -5038,23 +5038,23 @@ void glyph_node::zero_width_tprint(troff_output_file
*out)
{
tfont *ptf = tf->get_plain();
hunits offset;
- int bold = tf->is_emboldened(&offset);
+ bool is_emboldened = tf->is_emboldened(&offset);
hunits x;
- int cs = tf->is_constantly_spaced(&x);
- if (cs) {
+ bool is_constantly_spaced = tf->is_constantly_spaced(&x);
+ if (is_constantly_spaced) {
x -= ptf->get_width(ci);
- if (bold)
+ if (is_emboldened)
x -= offset;
x = (x / 2);
out->right(x);
}
out->put_char(ci, ptf, gcol, fcol);
- if (bold) {
+ if (is_emboldened) {
out->right(offset);
out->put_char(ci, ptf, gcol, fcol);
out->right(-offset);
}
- if (cs)
+ if (is_constantly_spaced)
out->right(-x);
}
@@ -5285,22 +5285,22 @@ void dbreak_node::tprint(troff_output_file *out)
void composite_node::tprint(troff_output_file *out)
{
hunits bold_offset;
- int is_bold = tf->is_emboldened(&bold_offset);
+ bool is_emboldened = tf->is_emboldened(&bold_offset);
hunits track_kern = tf->get_track_kern();
hunits constant_space;
- int is_constant_spaced = tf->is_constantly_spaced(&constant_space);
+ bool is_constantly_spaced = tf->is_constantly_spaced(&constant_space);
hunits x = H0;
- if (is_constant_spaced) {
+ if (is_constantly_spaced) {
x = constant_space;
for (node *tem = nodes; tem; tem = tem->next)
x -= tem->width();
- if (is_bold)
+ if (is_emboldened)
x -= bold_offset;
hunits x2 = x / 2;
out->right(x2);
x -= x2;
}
- if (is_bold) {
+ if (is_emboldened) {
int hpos = out->get_hpos();
int vpos = out->get_vpos();
tprint_reverse_node_list(out, nodes);
@@ -5308,7 +5308,7 @@ void composite_node::tprint(troff_output_file *out)
out->right(bold_offset);
}
tprint_reverse_node_list(out, nodes);
- if (is_constant_spaced)
+ if (is_constantly_spaced)
out->right(x);
else
out->right(track_kern);
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit