gbranden pushed a commit to branch master
in repository groff.
commit 73872d9d1f30ed6e561adb57e3adac43c343081c
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Apr 13 09:34:26 2026 -0500
[libgroff]: Trivially refactor.
* src/libs/libgroff/font.cpp (font::load_font, font::load): Rename
`load_header_only` parameter to `validate_only` for clarity.
---
ChangeLog | 6 ++++++
src/include/font.h | 4 ++--
src/libs/libgroff/font.cpp | 16 ++++++++--------
src/roff/troff/node.cpp | 2 +-
4 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9a0a5eb4d..806eae22a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2026-04-13 G. Branden Robinson <[email protected]>
+
+ * src/libs/libgroff/font.cpp (font::load_font, font::load):
+ Trivially refactor. Rename `load_header_only` parameter to
+ `validate_only` for clarity.
+
2026-04-13 G. Branden Robinson <[email protected]>
* src/roff/troff/node.cpp: Trivially refactor. Relocate
diff --git a/src/include/font.h b/src/include/font.h
index 55293987f..275aa9e67 100644
--- a/src/include/font.h
+++ b/src/include/font.h
@@ -211,8 +211,8 @@ public:
// and return a pointer to a 'font' object. If
// arg2 is true, only the part of the font
// description file before the 'charset' and
- // 'kernpairs' sections is loaded. Return null
- // pointer in case of failure.
+ // 'kernpairs' sections is checked for validity.
+ // Return null pointer in case of failure.
static void command_line_font_dir(const char *); // Prepend given
// path (arg1) to the list of directories in which
// to look up fonts.
diff --git a/src/libs/libgroff/font.cpp b/src/libs/libgroff/font.cpp
index 9f823917f..3ac6878d6 100644
--- a/src/libs/libgroff/font.cpp
+++ b/src/libs/libgroff/font.cpp
@@ -818,10 +818,10 @@ void font::copy_entry(glyph *new_glyph, glyph *old_glyph)
ch_index[new_index] = ch_index[old_index];
}
-font *font::load_font(const char *fn, bool load_header_only)
+font *font::load_font(const char *fn, bool validate_only)
{
font *f = new font(fn);
- if (!f->load(load_header_only)) {
+ if (!f->load(validate_only)) {
delete f;
return 0 /* nullptr */;
}
@@ -895,18 +895,18 @@ again:
return false;
}
-bool font::load(bool load_header_only)
+bool font::load(bool validate_only)
{
char *path;
FILE *fp = open_file(filename, &path);
if (0 /* nullptr */ == fp) {
- if (!load_header_only)
+ if (!validate_only)
error("cannot open font description file '%1': %2", filename,
strerror(errno));
return false;
}
text_file t(fp, path);
- t.silent = load_header_only;
+ t.silent = validate_only;
char *p = 0 /* nullptr */;
bool saw_name_directive = false;
while (t.next_line()) {
@@ -1006,7 +1006,7 @@ bool font::load(bool load_header_only)
t.recognize_comments = false;
while (directive) {
if (strcmp(directive, "kernpairs") == 0) {
- if (load_header_only)
+ if (validate_only)
return true;
for (;;) {
if (!t.next_line()) {
@@ -1040,7 +1040,7 @@ bool font::load(bool load_header_only)
}
// TODO: Rename this directive to "ranged-charset".
else if (strcmp(directive, "charset-range") == 0) {
- if (load_header_only)
+ if (validate_only)
return true;
saw_charset_directive = true;
bool had_range = false;
@@ -1117,7 +1117,7 @@ bool font::load(bool load_header_only)
}
}
else if (strcmp(directive, "charset") == 0) {
- if (load_header_only)
+ if (validate_only)
return true;
saw_charset_directive = true;
glyph *last_glyph = 0 /* nullptr */;
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index fe04eea41..f505e6fd9 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -6755,7 +6755,7 @@ bool is_font_available(symbol fam, symbol name)
if (is_abstract_style(name))
name = concat(fam, name);
return assign_font_and_file_name_to_mounting_position(name,
- name /* ignored */, 0 /* ignored */, true /* check_only */);
+ name /* ignored */, 0 /* ignored */, true /* validate_only */);
}
bool mount_style(int n, symbol name)
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit