mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-24 11:27:49 +00:00
Bug 1511131 - init UnscaledFontFreeType's face from file when creating scaled fonts. r=jnicol
Differential Revision: https://phabricator.services.mozilla.com/D27126 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
e0060de75c
commit
4140aef08f
@ -75,6 +75,23 @@ bool ScaledFontFreeType::GetWRFontInstanceOptions(
|
||||
return true;
|
||||
}
|
||||
|
||||
FT_Face UnscaledFontFreeType::InitFace() {
|
||||
if (mFace) {
|
||||
return mFace;
|
||||
}
|
||||
if (mFile.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
FT_Face face = Factory::NewFTFace(nullptr, mFile.c_str(), mIndex);
|
||||
if (!face) {
|
||||
gfxWarning() << "Failed initializing FreeType face from filename";
|
||||
return nullptr;
|
||||
}
|
||||
mOwnsFace = true;
|
||||
mFace = face;
|
||||
return mFace;
|
||||
}
|
||||
|
||||
static cairo_user_data_key_t sNativeFontResourceKey;
|
||||
|
||||
static void ReleaseNativeFontResource(void* aData) {
|
||||
@ -91,7 +108,7 @@ already_AddRefed<ScaledFont> UnscaledFontFreeType::CreateScaledFont(
|
||||
Float aGlyphSize, const uint8_t* aInstanceData,
|
||||
uint32_t aInstanceDataLength, const FontVariation* aVariations,
|
||||
uint32_t aNumVariations) {
|
||||
FT_Face face = GetFace();
|
||||
FT_Face face = InitFace();
|
||||
if (!face) {
|
||||
gfxWarning() << "Attempted to deserialize FreeType scaled font without "
|
||||
"FreeType face";
|
||||
|
@ -56,6 +56,8 @@ class UnscaledFontFreeType : public UnscaledFont {
|
||||
bool GetWRFontDescriptor(WRFontDescriptorOutput aCb, void* aBaton) override;
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
FT_Face InitFace();
|
||||
|
||||
already_AddRefed<ScaledFont> CreateScaledFont(
|
||||
Float aGlyphSize, const uint8_t* aInstanceData,
|
||||
uint32_t aInstanceDataLength, const FontVariation* aVariations,
|
||||
|
Loading…
x
Reference in New Issue
Block a user