[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 06/44: [troff]: Ignore bd, fam requests in nroff mode.
From: |
G. Branden Robinson |
Subject: |
[groff] 06/44: [troff]: Ignore bd, fam requests in nroff mode. |
Date: |
Tue, 3 Sep 2024 08:05:39 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit c4056b6d113e0448984c13204ba55dc1d8b575d5
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Sep 1 17:36:11 2024 -0500
[troff]: Ignore bd, fam requests in nroff mode.
* src/roff/troff/env.cpp (family_change): Ignore `fam` request if in
nroff mode.
* src/roff/troff/node.cpp (embolden_font): Ignore `bd` request if in
nroff mode.
Also dedent the logic of the normative path through `embolden_font()`
since we now return early if given no argument.
---
ChangeLog | 7 ++++++
src/roff/troff/env.cpp | 4 ++++
src/roff/troff/node.cpp | 64 ++++++++++++++++++++++++++-----------------------
3 files changed, 45 insertions(+), 30 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 353480dd7..d2372d660 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-09-01 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/roff/troff/env.cpp (family_change): Ignore `fam` request
+ if in nroff mode.
+ * src/roff/troff/node.cpp (embolden_font): Ignore `bd` request
+ if in nroff mode.
+
2024-09-01 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/input.cpp (asciify_macro, unformat_macro):
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 94daff478..75df196f4 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -1299,6 +1299,10 @@ static void select_font()
void family_change()
{
+ if (in_nroff_mode) {
+ skip_line();
+ return;
+ }
symbol s = get_name();
curenv->set_family(s);
skip_line();
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 8ba72554f..96d7ad728 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -6624,45 +6624,49 @@ hunits env_narrow_space_width(environment *env)
static void embolden_font()
{
+ if (!(has_arg())) {
+ warning(WARN_MISSING, "emboldening request expects arguments");
+ skip_line();
+ return;
+ }
if (in_nroff_mode) {
skip_line();
return;
}
font_lookup_info finfo;
- if (!(has_arg()))
- warning(WARN_MISSING, "font name or position expected in"
- " emboldening request");
- else if (!has_font(&finfo))
+ if (!has_font(&finfo)) {
font_lookup_error(finfo, "for emboldening");
- else {
- int n = finfo.position;
- if (has_arg()) {
- if (tok.is_usable_as_delimiter()) {
- font_lookup_info finfo2;
- if (!has_font(&finfo2))
- font_lookup_error(finfo2, "for conditional emboldening");
- else {
- int f = finfo2.position;
- units offset;
- if (has_arg()
- && read_measurement(&offset, 'u') && offset >= 1)
- font_table[f]->set_conditional_bold(n, hunits(offset - 1));
- else
- font_table[f]->conditional_unbold(n);
- }
- }
- else {
- // A numeric second argument must be an emboldening amount.
- units offset;
- if (read_measurement(&offset, 'u') && offset >= 1)
- font_table[n]->set_bold(hunits(offset - 1));
- else
- font_table[n]->unbold();
+ skip_line();
+ return;
+ }
+ int n = finfo.position;
+ if (has_arg()) {
+ if (tok.is_usable_as_delimiter()) {
+ font_lookup_info finfo2;
+ if (!has_font(&finfo2)) {
+ font_lookup_error(finfo2, "for conditional emboldening");
+ skip_line();
+ return;
}
+ int f = finfo2.position;
+ units offset;
+ if (has_arg()
+ && read_measurement(&offset, 'u') && offset >= 1)
+ font_table[f]->set_conditional_bold(n, hunits(offset - 1));
+ else
+ font_table[f]->conditional_unbold(n);
+ }
+ else {
+ // A numeric second argument must be an emboldening amount.
+ units offset;
+ if (read_measurement(&offset, 'u') && offset >= 1)
+ font_table[n]->set_bold(hunits(offset - 1));
+ else
+ font_table[n]->unbold();
}
- else
- font_table[n]->unbold();
}
+ else
+ font_table[n]->unbold();
skip_line();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 06/44: [troff]: Ignore bd, fam requests in nroff mode.,
G. Branden Robinson <=