From cc4d2beb72015d54455d9f99f40d76f308248e16 Mon Sep 17 00:00:00 2001 From: FredKiefer Date: Tue, 1 May 2001 21:19:33 +0000 Subject: [PATCH] Added some methods for font size and one function for glyphs from the MacOS X specification. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@9753 72102866-910b-0410-8b05-ffd578937521 --- Headers/gnustep/gui/NSFont.h | 21 +++++++++++----- Source/NSFont.m | 46 ++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/Headers/gnustep/gui/NSFont.h b/Headers/gnustep/gui/NSFont.h index 8e1838515..a43bf77f7 100644 --- a/Headers/gnustep/gui/NSFont.h +++ b/Headers/gnustep/gui/NSFont.h @@ -86,6 +86,14 @@ extern const float *NSFontIdentityMatrix; + (NSFont *)paletteFontOfSize:(float)fontSize; + (NSFont *)toolTipsFontOfSize:(float)fontSize; + (NSFont *)controlContentFontOfSize:(float)fontSize; ++ (NSFont *)labelFontOfSize:(float)fontSize; + +// +// Font Sizes +// ++ (float) labelFontSize; ++ (float) smallSystemFontSize; ++ (float) systemFontSize; // // Preferred Fonts @@ -160,14 +168,15 @@ extern const float *NSFontIdentityMatrix; - (NSStringEncoding)mostCompatibleStringEncoding; -// -// NSCoding protocol -// -- (void)encodeWithCoder:aCoder; -- initWithCoder:aDecoder; - @end +#ifndef STRICT_OPENSTEP +int NSConvertGlyphsToPackedGlyphs(NSGlyph *glBuf, + int count, + NSMultibyteGlyphPacking packing, + char *packedGlyphs); +#endif + extern NSString *NSAFMAscender; extern NSString *NSAFMCapHeight; extern NSString *NSAFMCharacterSet; diff --git a/Source/NSFont.m b/Source/NSFont.m index fc12b99aa..5a37542fd 100644 --- a/Source/NSFont.m +++ b/Source/NSFont.m @@ -237,6 +237,25 @@ setNSFont(NSString* key, NSFont* font) } } ++ (NSFont*) labelFontOfSize: (float)fontSize +{ + static NSFont *font = nil; + + if (fontSize != 0) + { + return getNSFont (@"NSLabelFont", @"Helvetica", fontSize); + } + else + { + if ((font == nil) || (userCacheNeedsRecomputing == YES)) + { + ASSIGN (font, getNSFont (@"NSLabelFont", @"Helvetica", 0)); + userCacheNeedsRecomputing = NO; + } + return font; + } +} + + (NSFont*) menuFontOfSize: (float)fontSize { static NSFont *font = nil; @@ -334,6 +353,24 @@ setNSFont(NSString* key, NSFont* font) } } +// +// Font Sizes +// ++ (float) labelFontSize +{ + return 12.0; +} + ++ (float) smallSystemFontSize +{ + return 9.0; +} + ++ (float) systemFontSize +{ + return 12.0; +} + - (id) initWithName: (NSString*)name matrix: (const float*)fontMatrix { fontName = [name copy]; @@ -613,3 +650,12 @@ setNSFont(NSString* key, NSFont* font) } @end /* NSFont */ + +int NSConvertGlyphsToPackedGlyphs(NSGlyph *glBuf, + int count, + NSMultibyteGlyphPacking packing, + char *packedGlyphs) +{ +// TODO + return 0; +}