branch: externals/show-font
commit b17dc63e66659e56622d386cb5e0150d9dd78866
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Tweak how we check that show-font-character-sample is a string
    
    We want it to not be blank, otherwise there is no point in propertising 
anything.
---
 show-font.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/show-font.el b/show-font.el
index 1534eb4e4a..a7dce2ba82 100644
--- a/show-font.el
+++ b/show-font.el
@@ -302,6 +302,10 @@ FILE must be of type TTF or OTF and must not already be 
installed (per
           (show-font--install f)))
       (user-error "`%s' is not a known font file (TTF or OTF); aborting" f))))
 
+(defun show-font--string-p (string)
+  "Return non-nil if STRING is a string that is not empty."
+  (and (stringp string) (not (string-blank-p string))))
+
 (defun show-font--prepare-text (&optional family)
   "Prepare pangram text at varying font heights for the current font file.
 With optional FAMILY, prepare a preview for the given font family
@@ -319,7 +323,7 @@ instead of that of the file."
           (pangram (show-font--get-pangram))
           (name (or family (show-font--get-attribute-from-file "fullname")))
           (family (or family (show-font--get-attribute-from-file "family")))
-          (propertize-sample-p (stringp show-font-character-sample)))
+          (propertize-sample-p (show-font--string-p 
show-font-character-sample)))
       (dolist (face faces)
         (push (propertize pangram 'face (list face :family family)) 
list-of-lines)
         (push (propertize pangram 'face (list face :family family :slant 
'italic)) list-of-lines)

Reply via email to