ftp.nice.ch/pub/next/connectivity/news/Alexandra.0.82.s.tar.gz#/alex8/NiceStuff.subproj/MiscAppFontDefaults.m

This is MiscAppFontDefaults.m in view mode; [Download] [Up]

#import "MiscAppFontDefaults.h"

//--------------------------------------------------------------------------------------
	@implementation Application(MiscAppFontDefaults)
//--------------------------------------------------------------------------------------
	
	/*" Extension of the methods of the #MiscAppDefaults category. Allows for saving
		font information in the defaults database. N.B.: The name of the font must
		not be longer than 300 characters. "*/

//--------------------------------------------------------------------------------------
	- (Font *)defaultFont:(const char *)defName;
//--------------------------------------------------------------------------------------
	
	/*" Returns the font stored in the defaults database with the name #defName 
		"*/

	{
	const char	*defValue;
	char		fontName[300];
	float		fontSize;
	
	defValue=[NXApp defaultValue:defName];
	if(!defValue)
		return nil;
	sscanf(defValue,"%s %f",fontName,&fontSize);
	return [Font newFont:fontName size:fontSize];
	}


//--------------------------------------------------------------------------------------
	- setDefault:(const char *)defName toFont:(Font *)font;
//--------------------------------------------------------------------------------------

	/*" Stores the font in the default database. "*/

	{
	char	defValue[300];
	
	sprintf(defValue,"%s %fpt",[font name],[font pointSize]);
	[NXApp setDefault:defName to:defValue];	
	return self;
	}
	
//--------------------------------------------------------------------------------------
	@end
//--------------------------------------------------------------------------------------

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.