bug-gnustep
[Top][All Lists]
Advanced

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

Re: Fix, NSFont, XGFont (was RTFConsumer)


From: Georg Fleischmann
Subject: Re: Fix, NSFont, XGFont (was RTFConsumer)
Date: Thu, 10 Oct 2002 15:43:03 GMT

> Most of this patch looks fine for me. What is missing is the special
> handling now needed for the getNSFont() function. Here we should make
> sure, that we always return a usefull font. As the only font we can be
> sure about is the user font in the default size we should return this,
> if any font is missing here. Not returning any font here will screw up
> the system as we always expect the font attribute to be set to usable value.

Well, I added a line to getNSFont() to load the defaultFont with default size.  
Please take a look at the attached patch, because I'm not sure, if this is  
exactly what you meant. Thanks.

Georg



*** gui/Source/NSFont.m.old     Wed Oct  9 22:05:57 2002
--- gui/Source/NSFont.m Thu Oct 10 17:21:15 2002
***************
*** 144,149 ****
--- 144,150 ----
  getNSFont(NSString* key, NSString* defaultFontName, float fontSize)
  {
    NSString* fontName;
+   NSFont* font;

    fontName = [defaults objectForKey: key];
    if (fontName == nil)
***************
*** 155,161 ****
        [NSString stringWithFormat: @"%@Size", key]];
      }

!   return [NSFontClass fontWithName: fontName size: fontSize];
  }

  void
--- 156,169 ----
        [NSString stringWithFormat: @"%@Size", key]];
      }

!   font = [NSFontClass fontWithName: fontName size: fontSize];
!   if (!font)
!     {
!       fontSize = [defaults floatForKey:
!       [NSString stringWithFormat: @"%@Size", key]];
!       font = [NSFontClass fontWithName: defaultFontName size: fontSize];
!     }
!   return font;
  }

  void




reply via email to

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