summaryrefslogtreecommitdiff
path: root/src/libs
diff options
context:
space:
mode:
authorG. Branden Robinson <g.branden.robinson@gmail.com>2021-09-24 17:48:26 +1000
committerG. Branden Robinson <g.branden.robinson@gmail.com>2021-09-25 22:53:13 +1000
commitbf7f6862c384f9cff80737cccf6b8fafd4197e1c (patch)
tree053600824d43965952a182c8678c9cd341c66ef2 /src/libs
parent5fb1da945eba27b5145009d2ce70bfeb075394ec (diff)
downloadgroff-git-bf7f6862c384f9cff80737cccf6b8fafd4197e1c.tar.gz
[libgroff]: Make `spacewidth` mandatory.
* src/libs/libgroff/font.cpp (font::load): Throw error if a font description file is missing a `spacewidth` directive, since it is now re-documented as mandatory. Atypically, we don't return false in this scenario; instead we proceed with the existing logic to compute a space width for the font based on typical practices for Western alphabetic fonts (see, e.g., <https://type.today/en/journal/spaces>. Thanks to Deri James for the discussion.
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/libgroff/font.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libs/libgroff/font.cpp b/src/libs/libgroff/font.cpp
index b774fe7a1..9f578478e 100644
--- a/src/libs/libgroff/font.cpp
+++ b/src/libs/libgroff/font.cpp
@@ -1018,6 +1018,8 @@ bool font::load(bool load_header_only)
return false;
}
if (space_width == 0) {
+ t.error("font description 'spacewidth' directive missing");
+ // _Don't_ return false; compute a typical one for Western glyphs.
if (zoom)
space_width = scale_round(unitwidth, res, 72 * 3 * sizescale,
zoom);