mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1321031
pt 3 - Preserve variations settings when creating a new CTFont in SkFontHost_mac. r=lsalzman
This commit is contained in:
parent
3adad63030
commit
4c288caa59
@ -800,6 +800,25 @@ static CTFontRef ctfont_create_exact_copy(CTFontRef baseFont, CGFloat textSize,
|
||||
// Because we cannot setup the CTFont descriptor to match, the same restriction applies here
|
||||
// as other uses of CTFontCreateWithGraphicsFont which is that such CTFonts should not escape
|
||||
// the scaler context, since they aren't 'normal'.
|
||||
|
||||
// Not AutoCFRelease<> because CGFontCopyVariations can return null!
|
||||
CFDictionaryRef variations = CGFontCopyVariations(baseCGFont);
|
||||
if (variations) {
|
||||
AutoCFRelease<CFDictionaryRef>
|
||||
varAttr(CFDictionaryCreate(nullptr,
|
||||
(const void**)&kCTFontVariationAttribute,
|
||||
(const void**)&variations,
|
||||
1,
|
||||
&kCFTypeDictionaryKeyCallBacks,
|
||||
&kCFTypeDictionaryValueCallBacks));
|
||||
CFRelease(variations);
|
||||
|
||||
AutoCFRelease<CTFontDescriptorRef>
|
||||
varDesc(CTFontDescriptorCreateWithAttributes(varAttr));
|
||||
|
||||
return CTFontCreateWithGraphicsFont(baseCGFont, textSize, transform, varDesc);
|
||||
}
|
||||
|
||||
return CTFontCreateWithGraphicsFont(baseCGFont, textSize, transform, nullptr);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user