bug-gnustep
[Top][All Lists]
Advanced

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

Re: Fix: RTFConsumer, -currentFont


From: Nicola Pero
Subject: Re: Fix: RTFConsumer, -currentFont
Date: Wed, 4 Sep 2002 11:31:27 +0100 (BST)

> Hi Nicola,
> 
> > What about taking a completely different approach in the method, and
> > instead doing a
> >
> > [NSFont fontWithName: fontName  size: fontSize];
> 
> Well, this brought up a problem with [NSFont fontWithName:size:]:
> If the desired font is not available, the method returns a default font  
> instead of nil (OpenStep 4.2 returns nil in this case).
> 
> Consequently, further up the chain, [NSFontManager convertFont:toFace:]  
> returns the default font too. This should return the unmodified font, if the  
> face is not avalable (and it indeed would, if the above method would return  
> nil).
> 
> If I modify [NSFont fontWithName:size:] to return nil, all the places show up 
>  
> (seg fault), which can't handle the nil font. Quite some places...
> Anyway, I feel this should to be fixed, before further optimizing the font  
> handling in the RTFConsumer.
> 
> What do you think ?
> 

Definitely fixing NSFont before proceeding! :-)

Looks like [NSFont -initWithName:matrix:] is our own extension, and likely
it should return nil if the font can't be found (it now returns the
default font if I understand correctly).

In that case I suppose we need to change GSFontInfo to return nil (rather
than a font info for a default font) if the font is not found.

NSFont -initWithName:matrix: will then check the created font info, and if
it's nil, it will destroy self and return (nil) as well.

We then need to update all callers for the new semantics ... which
hopefully should not be too many.

Let me know if that makes sense to you - I think it is exactly what you
were proposing.





reply via email to

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