File 0003-truncate-foundry-if-there-is-no-known-abbreviation.patch of Package fonttosfnt.20912

From 857441ef97e9b93ff7560f18ade5bd6383cd8bba Mon Sep 17 00:00:00 2001
From: Christopher Zimmermann <madroach@gmerlin.de>
Date: Mon, 15 Jun 2020 14:08:49 +0200
Subject: [PATCH 03/14] truncate foundry if there is no known abbreviation.

Honestly I have no idea why the foundry needs to fit in four bytes.
But anyway truncation might indeed be better then "UNKN" ?

Anyone more knowledgeable than me out there?
---
 util.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/util.c b/util.c
index 4482c9a..594302a 100644
--- a/util.c
+++ b/util.c
@@ -280,8 +280,15 @@ faceFoundry(FT_Face face)
             return makeName("URW ");
         else if(strcasecmp(prop.u.atom, "y&y") == 0)
             return makeName("Y&Y ");
-        else
-            return makeName("UNKN");
+        else {
+	    char buf[4];
+	    int i = sizeof(buf);
+	    while(i--) buf[i] = ' ';
+	    i = strlen(prop.u.atom);
+	    i = i > sizeof(buf) ? sizeof(buf) : i;
+	    while (i--) buf[i] = prop.u.atom[i];
+            return makeName(buf);
+	}
     }
     /* For now */
     return makeName("UNKN");
-- 
2.28.0

openSUSE Build Service is sponsored by