gbranden pushed a commit to branch master
in repository groff.
commit 604361951c9ddad621b3e0786ca7a2946e212842
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri May 3 00:00:59 2024 -0500
Revert "[troff]: Validate a font family before using it."
This reverts commit 39ffa368dc6a1de4c11cf3f4f5b8594d3c974173.
There were a few problems with this approach; possibly the biggest is
that styles can be dynamically constructed, for which this validation
process was no help, and could be a misleading hindrance.
Thanks to Dave Kemper, Deri James, and Peter Schaffter for the
discussion.
<https://savannah.gnu.org/bugs/?64155> is already reopened.
---
ChangeLog | 16 ----------------
src/roff/troff/env.cpp | 23 -----------------------
src/roff/troff/env.h | 1 -
src/roff/troff/input.cpp | 3 ---
4 files changed, 43 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 571441318..f89b424c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5081,22 +5081,6 @@
it's lexical. Which, sadly, probably won't help any but
CS/SWeng people...
-2023-05-25 G. Branden Robinson <[email protected]>
-
- [troff]: Validate a font family before trying to use it.
-
- * src/roff/troff/env.cpp (is_family_valid): New function checks
- for all text styles (R, I, B, BI) and returns true only if the
- given family supports them all.
- (family_change): Call `is_family_valid()` on given argument.
- If invalid, throw diagnostic and ignore `fam` request.
- * src/roff/troff/env.h (is_family_valid): Declare; make visible.
- * src/roff/troff/input.cpp (main): Call `is_family_valid()` on
- `-f` option argument. Its invalidity is a fatal error.
-
- Fixes <https://savannah.gnu.org/bugs/?64155>. Thanks to Dave
- Kemper for the report.
-
2023-05-25 G. Branden Robinson <[email protected]>
* src/roff/troff/env.h (read_hyphen_file): Drop relic prototype
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 5b19ce4ec..d3177941e 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -1293,32 +1293,9 @@ static void select_font()
skip_line();
}
-bool is_family_valid(const char *fam)
-{
-#if 0 // C++11, some day
- std::vector<const char *> styles{"R", "I", "B", "BI"}; // C++11
- for (auto style : styles) // C++11
-#else
- const size_t nstyles = 4;
- const char *st[nstyles] = { "R", "I", "B", "BI" };
- std::vector<const char *> styles(st, (st + nstyles));
- std::vector<const char *>::iterator style;
- for (style = styles.begin(); style != styles.end(); style++)
-#endif
- if (!is_font_name(fam, *style))
- return false;
- return true;
-}
-
void family_change()
{
symbol s = get_name();
- if (s != 0 /* nullptr */)
- if (!is_family_valid(s.contents())) {
- error("'%1' is not a valid font family", s.contents());
- skip_line();
- return;
- }
curenv->set_family(s);
skip_line();
}
diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h
index a8be68781..19f81d2c5 100644
--- a/src/roff/troff/env.h
+++ b/src/roff/troff/env.h
@@ -419,7 +419,6 @@ extern void pop_env();
extern void push_env(int);
void init_environments();
-bool is_family_valid(const char *);
extern double spread_limit;
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index a10bc2112..7631fee39 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -8404,9 +8404,6 @@ int main(int argc, char **argv)
warning(WARN_FONT, "cannot mount font '%1' directed by 'DESC'"
" file for device '%2'", font::font_name_table[i],
device);
- if (fflag && !(is_family_valid(default_family.contents())))
- fatal("'%1' is not a valid font family",
- default_family.contents());
curdiv = topdiv = new top_level_diversion;
if (nflag)
topdiv->set_next_page_number(next_page_number);
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit