mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 07:21:02 +00:00
* Undo the previous change and try a different approach..
just cache the character set in CairoFaceInfo, but load them as needed as we were doing before. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@32987 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f61d9ee591
commit
09c3361700
4 changed files with 33 additions and 10 deletions
|
@ -1,3 +1,9 @@
|
|||
2011-05-05 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Undo the previous change and try a different approach..
|
||||
just cache the character set in CairoFaceInfo, but load them
|
||||
as needed as we were doing before.
|
||||
|
||||
2011-05-05 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/cairo/CairoFontEnumerator.m:
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
FcPattern *_pattern;
|
||||
|
||||
NSString *_familyName;
|
||||
NSCharacterSet *_characterSet;
|
||||
BOOL _hasNoCharacterSet;
|
||||
}
|
||||
|
||||
- (id) initWithfamilyName: (NSString *)familyName
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
}
|
||||
FcPatternDestroy(_pattern);
|
||||
RELEASE(_familyName);
|
||||
|
||||
RELEASE(_characterSet);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -125,15 +125,30 @@
|
|||
|
||||
- (NSCharacterSet*)characterSet
|
||||
{
|
||||
FcCharSet *fcCharset;
|
||||
NSCharacterSet *characterSet = nil;
|
||||
|
||||
if (FcResultMatch == FcPatternGetCharSet(_pattern, FC_CHARSET, 0, &fcCharset))
|
||||
if (_characterSet == nil && !_hasNoCharacterSet)
|
||||
{
|
||||
characterSet = [[[FontconfigCharacterSet alloc] initWithFontconfigCharSet: fcCharset] autorelease];
|
||||
}
|
||||
|
||||
return characterSet;
|
||||
FcResult result;
|
||||
FcPattern *resolved;
|
||||
FcCharSet *charset;
|
||||
|
||||
FcConfigSubstitute(NULL, _pattern, FcMatchPattern);
|
||||
FcDefaultSubstitute(_pattern);
|
||||
resolved = FcFontMatch(NULL, _pattern, &result);
|
||||
|
||||
if (FcResultMatch == FcPatternGetCharSet(resolved, FC_CHARSET, 0, &charset))
|
||||
{
|
||||
_characterSet = [[FontconfigCharacterSet alloc] initWithFontconfigCharSet: charset];
|
||||
}
|
||||
|
||||
/* Only try to get the character set once because FcFontMatch is expensive */
|
||||
if (_characterSet == nil)
|
||||
{
|
||||
_hasNoCharacterSet = YES;
|
||||
}
|
||||
|
||||
FcPatternDestroy(resolved);
|
||||
}
|
||||
return _characterSet;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -152,7 +152,7 @@ static NSArray *faFromFc(FcPattern *pat)
|
|||
|
||||
FcPattern *pat = FcPatternCreate();
|
||||
FcObjectSet *os = FcObjectSetBuild(FC_FAMILY, FC_SLANT, FC_WEIGHT,
|
||||
FC_SPACING, FC_CHARSET, NULL);
|
||||
FC_SPACING, NULL);
|
||||
FcFontSet *fs = FcFontList(NULL, pat, os);
|
||||
|
||||
FcPatternDestroy(pat);
|
||||
|
|
Loading…
Reference in a new issue