mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 00:00:47 +00:00
Cache used fonts in context
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@11430 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bef0fa9983
commit
db7b620c03
6 changed files with 45 additions and 28 deletions
|
@ -45,9 +45,6 @@ static BOOL boldSystemCacheNeedsRecomputing = NO;
|
|||
static BOOL userCacheNeedsRecomputing = NO;
|
||||
static BOOL userFixedCacheNeedsRecomputing = NO;
|
||||
|
||||
/* Set used to keep track of fonts we are using */
|
||||
static NSMutableSet *usedFonts = nil;
|
||||
|
||||
@interface NSFont (Private)
|
||||
- (id) initWithName: (NSString*)name
|
||||
matrix: (const float*)fontMatrix;
|
||||
|
@ -397,21 +394,7 @@ setNSFont(NSString* key, NSFont* font)
|
|||
|
||||
+ (void) useFont: (NSString*)name
|
||||
{
|
||||
if (usedFonts == nil)
|
||||
usedFonts = RETAIN([NSMutableSet setWithCapacity: 2]);
|
||||
|
||||
[usedFonts addObject: name];
|
||||
}
|
||||
|
||||
+ (void) resetUsedFonts
|
||||
{
|
||||
if (usedFonts)
|
||||
[usedFonts removeAllObjects];
|
||||
}
|
||||
|
||||
+ (NSSet *) usedFonts
|
||||
{
|
||||
return usedFonts;
|
||||
[GSCurrentContext() useFont: name];
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -512,7 +495,7 @@ setNSFont(NSString* key, NSFont* font)
|
|||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
|
||||
[ctxt setFont: self];
|
||||
[NSFont useFont: fontName];
|
||||
[ctxt useFont: fontName];
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue