bug-gnustep
[Top][All Lists]
Advanced

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

fontWithName: size: mishandles size 0.0


From: Alexander Malmberg
Subject: fontWithName: size: mishandles size 0.0
Date: 2002年2月26日 12:28:23 +0100

Hi,
According to the docs I have, [NSFont +fontWithName: size:] is supposed
to default to NSUserFontSize if it's called with size==0.0, but
currently it returns a font with size 0. I've attached a patch that
makes it use NSUserFontSize if it is available and otherwise fall back
to size 12.
- Alexander Malmberg
Index: NSFont.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSFont.m,v
retrieving revision 1.42
diff -u -r1.42 NSFont.m
--- NSFont.m 17 Dec 2001 16:51:50 -0000 1.42
+++ NSFont.m 26 Feb 2002 11:16:13 -0000
@@ -384,7 +384,15 @@
 size: (float)fontSize
 {
 NSFont*font;
- float fontMatrix[6] = { fontSize, 0, 0, fontSize, 0, 0 };
+ float fontMatrix[6] = { 0, 0, 0, 0, 0, 0 };
+
+ if (fontSize == 0)
+ {
+ fontSize = [defaults floatForKey: @"NSUserFontSize"];
+ if (fontSize == 0)
+ fontSize = 12;
+ }
+ fontMatrix[0] = fontMatrix[3] = fontSize;
 
 font = [self fontWithName: name matrix: fontMatrix];
 font->matrixExplicitlySet = NO;

reply via email to

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

AltStyle によって変換されたページ (->オリジナル) /