groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 03/10: [libgroff]: Make `spacewidth` mandatory.


From: G. Branden Robinson
Subject: [groff] 03/10: [libgroff]: Make `spacewidth` mandatory.
Date: Sat, 25 Sep 2021 10:36:05 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit bf7f6862c384f9cff80737cccf6b8fafd4197e1c
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Sep 24 17:48:26 2021 +1000

    [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.
---
 ChangeLog                  | 10 ++++++++++
 src/libs/libgroff/font.cpp |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 9006ad9..b55f6e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2021-09-24  G. Branden Robinson <g.branden.robinson@gmail.com>
 
+       * 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>.
+
+2021-09-24  G. Branden Robinson <g.branden.robinson@gmail.com>
+
        * Makefile.am: Mark `$(TEST_SUITE_LOG)` as `.PRECIOUS`.  This
        prevents the test suite log from being deleted if there are any
        failures.
diff --git a/src/libs/libgroff/font.cpp b/src/libs/libgroff/font.cpp
index b774fe7..9f57847 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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]