Minor tidyups ... nothing functional

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14587 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-09-27 08:26:13 +00:00
parent d685ab0ffd
commit b566120f38
2 changed files with 64 additions and 25 deletions

View file

@ -174,7 +174,11 @@ setNSFont(NSString* key, NSFont* font)
/* Getting the preferred user fonts. */
// This is deprecated in MacOSX
/**
* Return the default bold font for use in menus and heading in standard
* gui components.<br />
* This is deprecated in MacOSX
*/
+ (NSFont*) boldSystemFontOfSize: (float)fontSize
{
static NSFont *font = nil;
@ -194,7 +198,11 @@ setNSFont(NSString* key, NSFont* font)
}
}
// This is deprecated in MacOSX
/**
* Return the default font for use in menus and heading in standard
* gui components.<br />
* This is deprecated in MacOSX
*/
+ (NSFont*) systemFontOfSize: (float)fontSize
{
static NSFont *font = nil;
@ -214,6 +222,10 @@ setNSFont(NSString* key, NSFont* font)
}
}
/**
* Return the default fixed pitch font for use in locations other
* than standard gui components.
*/
+ (NSFont*) userFixedPitchFontOfSize: (float)fontSize
{
static NSFont *font = nil;
@ -233,6 +245,10 @@ setNSFont(NSString* key, NSFont* font)
}
}
/**
* Return the default font for use in locations other
* than standard gui components.
*/
+ (NSFont*) userFontOfSize: (float)fontSize
{
static NSFont *font = nil;
@ -252,7 +268,10 @@ setNSFont(NSString* key, NSFont* font)
}
}
+ (NSArray *)preferredFontNames
/**
* Return an array of the names of preferred fonts.
*/
+ (NSArray*) preferredFontNames
{
return _preferredFonts;
}
@ -269,7 +288,7 @@ setNSFont(NSString* key, NSFont* font)
setNSFont (@"NSUserFont", aFont);
}
+ (void)setPreferredFontNames:(NSArray *)fontNames
+ (void) setPreferredFontNames: (NSArray*)fontNames
{
ASSIGN(_preferredFonts, fontNames);
}
@ -582,7 +601,9 @@ setNSFont(NSString* key, NSFont* font)
{
NSFont*new_font;
if (NSShouldRetainWithZone(self, zone))
new_font = RETAIN(self);
{
new_font = RETAIN(self);
}
else
{
new_font = (NSFont*)NSCopyObject(self, 0, zone);
@ -788,9 +809,12 @@ setNSFont(NSString* key, NSFont* font)
float fontMatrix[6];
name = [aDecoder decodeObject];
[aDecoder decodeArrayOfObjCType: @encode(float) count: 6 at: fontMatrix];
[aDecoder decodeArrayOfObjCType: @encode(float)
count: 6
at: fontMatrix];
self = [self initWithName: name matrix: fontMatrix];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &matrixExplicitlySet];
[aDecoder decodeValueOfObjCType: @encode(BOOL)
at: &matrixExplicitlySet];
}
else
{
@ -798,7 +822,9 @@ setNSFont(NSString* key, NSFont* font)
float fontMatrix[6];
name = [aDecoder decodeObject];
[aDecoder decodeArrayOfObjCType: @encode(float) count: 6 at: fontMatrix];
[aDecoder decodeArrayOfObjCType: @encode(float)
count: 6
at: fontMatrix];
self = [self initWithName: name matrix: fontMatrix];
if (fontMatrix[0] == fontMatrix[3]
&& fontMatrix[1] == 0.0

View file

@ -138,7 +138,9 @@ static Class fontPanelClass = Nil;
NSString *name = [fontsList objectAtIndex: i];
if ([self _includeFont: name])
[fontNames addObject: name];
{
[fontNames addObject: name];
}
}
return fontNames;
@ -159,7 +161,7 @@ static Class fontPanelClass = Nil;
for (i = 0; i < [fontFamilies count]; i++)
{
NSArray *fontDefs = [self availableMembersOfFontFamily:
[fontFamilies objectAtIndex: i]];
[fontFamilies objectAtIndex: i]];
for (j = 0; j < [fontDefs count]; j++)
{
@ -193,7 +195,9 @@ static Class fontPanelClass = Nil;
NSString *name = [fontDef objectAtIndex: 0];
if ([self _includeFont: name])
[fonts addObject: fontDef];
{
[fonts addObject: fontDef];
}
}
return fonts;
@ -220,7 +224,9 @@ static Class fontPanelClass = Nil;
_multiple = flag;
// The panel should also know if multiple changed
if (fontPanel != nil)
[fontPanel setPanelFont: fontObject isMultiple: flag];
{
[fontPanel setPanelFont: fontObject isMultiple: flag];
}
}
return;
}
@ -229,7 +235,9 @@ static Class fontPanelClass = Nil;
ASSIGN(_selectedFont, fontObject);
if (fontPanel != nil)
[fontPanel setPanelFont: fontObject isMultiple: flag];
{
[fontPanel setPanelFont: fontObject isMultiple: flag];
}
if (_fontMenu != nil)
{
@ -495,12 +503,12 @@ static Class fontPanelClass = Nil;
else if (trait == NSUnboldFontMask)
{
return [self convertFont: fontObject
toNotHaveTrait: NSBoldFontMask];
toNotHaveTrait: NSBoldFontMask];
}
else if (trait == NSUnitalicFontMask)
{
return [self convertFont: fontObject
toNotHaveTrait: NSItalicFontMask];
toNotHaveTrait: NSItalicFontMask];
}
else
{
@ -535,10 +543,13 @@ static Class fontPanelClass = Nil;
// This is a bit strange but is stated in the specification
if (trait & NSUnboldFontMask)
{
trait = (trait | NSBoldFontMask) & ~NSUnboldFontMask;
}
if (trait & NSUnitalicFontMask)
{
trait = (trait | NSItalicFontMask) & ~NSUnitalicFontMask;
}
if (!(t & trait))
{
// If already do not have that trait then just return it
@ -555,8 +566,9 @@ static Class fontPanelClass = Nil;
// We cannot reuse the weight in an unbold
if (trait & NSBoldFontMask)
weight = 5;
{
weight = 5;
}
t &= ~trait;
newFont = [self fontWithFamily: family
traits: t
@ -653,8 +665,8 @@ static Class fontPanelClass = Nil;
NSArray *fontDef = [fontDefs objectAtIndex: i];
int w1 = [[fontDef objectAtIndex: 2] intValue];
if (w1 < w && w1 > next_w &&
[[fontDef objectAtIndex: 3] unsignedIntValue] == trait)
if (w1 < w && w1 > next_w
&& [[fontDef objectAtIndex: 3] unsignedIntValue] == trait)
{
next_w = w1;
fontName = [fontDef objectAtIndex: 0];
@ -671,8 +683,8 @@ static Class fontPanelClass = Nil;
NSArray *fontDef = [fontDefs objectAtIndex: i];
int w1 = [[fontDef objectAtIndex: 2] intValue];
if (w1 < w && w1 > next_w &&
[[fontDef objectAtIndex: 3] unsignedIntValue] == trait)
if (w1 < w && w1 > next_w
&& [[fontDef objectAtIndex: 3] unsignedIntValue] == trait)
{
next_w = w1;
fontName = [fontDef objectAtIndex: 0];
@ -682,9 +694,10 @@ static Class fontPanelClass = Nil;
}
if (fontName != nil)
newFont = [NSFont fontWithName: fontName
size: size];
{
newFont = [NSFont fontWithName: fontName
size: size];
}
if (newFont == nil)
return fontObject;
else