🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.epoch.misc
Article #1782

Bug in font loading with get-font

#1782
From: Ken Wood
Date: Mon, 02 Sep 1991 16:16
53 lines
2214 bytes
[Apologies if you've seen this before - I tried to post it but it
didn't appear to get out.]

There seems to be a bug in get-font. From the way it's written I
assume it's supposed to return nil if you give it an invalid font
name. In reality it always returns an allocated font structure. A
patch is attached below. Could someone official please bless this
patch or else tell be where I've gone wrong? Thanks. We're using epoch
3.2 patch 2 .

Ken


*** ../../epoch-3.2.2/src/xutil.c	Fri Jul 19 09:36:33 1991
--- xutil.c	Fri Aug 23 16:31:07 1991
***************
*** 566,571 ****
--- 566,573 ----
  {
    Font font;
    BLOCK_INPUT_DECLARE();
+   char **tempfontlist;
+   int tempfontcount;
  
    if (XRESOURCEP(name) && XXRESOURCE(name)->type == XA_FONT) return name;
  
***************
*** 572,578 ****
    CHECK_STRING(name,0);
  
    BLOCK_INPUT();
!   font = XLoadFont(XD_display,XSTRING(name)->data);
    UNBLOCK_INPUT();
  
    return font ? make_Xresource(XD_display,XD_plane,font,XA_FONT) : Qnil;
--- 574,585 ----
    CHECK_STRING(name,0);
  
    BLOCK_INPUT();
!   tempfontlist = XListFonts(XD_display,XSTRING(name)->data,1,&tempfontcount);
!   if (tempfontcount)
!       font = XLoadFont(XD_display,XSTRING(name)->data);
!   else
!       font = 0;
!   XFreeFontNames(tempfontlist);
    UNBLOCK_INPUT();
  
    return font ? make_Xresource(XD_display,XD_plane,font,XA_FONT) : Qnil;



Ken Wood, Austek Microsystems, Technology Park, Adelaide, SA 5095, Australia
INTERNET:  kwood@austek.oz.au  UUCP: uunet.uu.net!munnari!austek.oz.au!kwood
Technical Details
Message-ID: <9109020046.AA01891@angels.adl.austek>
Path: arc1-ca.pugleaf.net!gmdzi!unido!math.fu-berlin.de!iraun1.ira.uka.de!yale.edu!qt.cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!adl.AUstek.oz.AU!kwood

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc7ee,9bd66d9b7c960e02,start
X-Google-Attributes: gidfc7ee,public
X-Google-ArrivalTime: 1991-09-01 20:34:20 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!math.fu-berlin.de!iraun1.ira.uka.de!yale.edu!qt.cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!adl.AUstek.oz.AU!kwood
From: kwood@adl.AUstek.oz.AU (Ken Wood)
Newsgroups: gnu.epoch.misc
Subject: Bug in font loading with get-font
Message-ID: <9109020046.AA01891@angels.adl.austek>
Date: 2 Sep 91 16:16:00 GMT
Sender: daemon@cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 53