From a4caf05179dc7e1f983ef706eb651c763359b8e9 Mon Sep 17 00:00:00 2001
From: Huw D M Davies <h.davies1@physics.ox.ac.uk>
Date: Thu, 9 Mar 2000 18:44:38 +0000
Subject: [PATCH] Add Black as a valid font weight. Cope with afm files that do
 not contain {Family|Full}Name entries.

---
 graphics/psdrv/afm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/graphics/psdrv/afm.c b/graphics/psdrv/afm.c
index dcd136b2154..25b6ed539b7 100644
--- a/graphics/psdrv/afm.c
+++ b/graphics/psdrv/afm.c
@@ -181,6 +181,8 @@ static AFM *PSDRV_AFMParse(char const *file)
 	        afm->Weight = FW_BOLD;
 	    else if(!strncmp("Light", value, 5))
 	        afm->Weight = FW_LIGHT;
+	    else if(!strncmp("Black", value, 5))
+	        afm->Weight = FW_BLACK;
 	    else {
   	        FIXME("Unkown AFM Weight '%s'\n", value);
 	        afm->Weight = FW_NORMAL;
@@ -252,12 +254,20 @@ static AFM *PSDRV_AFMParse(char const *file)
     }
     fclose(fp);
 
+    if(afm->FontName == NULL)
+        WARN("%s contains no FontName.\n", file);
+    if(afm->FullName == NULL)
+        afm->FullName = HEAP_strdupA(PSDRV_Heap, 0, afm->FontName);
+    if(afm->FamilyName == NULL)
+        afm->FamilyName = HEAP_strdupA(PSDRV_Heap, 0, afm->FontName);      
     if(afm->Ascender == 0.0)
         afm->Ascender = afm->FontBBox.ury;
     if(afm->Descender == 0.0)
         afm->Descender = afm->FontBBox.lly;
     if(afm->FullAscender == 0.0)
         afm->FullAscender = afm->Ascender;
+    if(afm->Weight == 0)
+        afm->Weight = FW_NORMAL;
 
     return afm;
 }
-- 
GitLab