☠☠ backed out by b95ae0e1e9e0 ☠ ☠ | |
author | Jonathan Kew <jkew@mozilla.com> |
Tue, 17 Apr 2018 21:45:29 +0100 | |
changeset 414542 | 072dc1504ce6cd2a9a2a1e13bf29bb574e9d9c62 |
parent 414541 | 3692b02e7ca290d1098b42757e48d055458ba906 |
child 414543 | b673e87d613411b38707fecd3ab6ae7b527d5e65 |
push id | 33871 |
push user | csabou@mozilla.com |
push date | Thu, 19 Apr 2018 22:30:08 +0000 |
treeherder | mozilla-central@5d73549d363f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1454598 |
milestone | 61.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
gfx/thebes/gfxFcPlatformFontList.cpp | file | annotate | diff | comparison | revisions | |
gfx/thebes/gfxPlatform.cpp | file | annotate | diff | comparison | revisions |
--- a/gfx/thebes/gfxFcPlatformFontList.cpp +++ b/gfx/thebes/gfxFcPlatformFontList.cpp @@ -2173,37 +2173,36 @@ gfxFcPlatformFontList::GetFTLibrary() // has been called on each FT_Face, at least until this bug is fixed: // https://bugs.freedesktop.org/show_bug.cgi?id=18857 // // Cairo keeps it's own FT_Library object for creating FT_Face // instances, so use that. There's no simple API for accessing this // so use the hacky method below of making a font and extracting // the library pointer from that. - bool needsBold; - gfxFontStyle style; - gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList(); - gfxFontFamily* family = pfl->GetDefaultFont(&style); - NS_ASSERTION(family, "couldn't find a default font family"); - gfxFontEntry* fe = family->FindFontForStyle(style, needsBold, true); - if (!fe) { - return nullptr; - } - RefPtr<gfxFont> font = fe->FindOrMakeFont(&style, false); - if (!font) { - return nullptr; - } + FcPattern* pat = + FcPatternBuild(0, FC_FAMILY, FcTypeString, "serif", (char*)0); + cairo_font_face_t* face = + cairo_ft_font_face_create_for_pattern(pat, nullptr, 0); + FcPatternDestroy(pat); - gfxFT2FontBase* ft2Font = reinterpret_cast<gfxFT2FontBase*>(font.get()); - gfxFT2LockedFace face(ft2Font); - if (!face.get()) { - return nullptr; - } + cairo_matrix_t identity; + cairo_matrix_init_identity(&identity); + cairo_font_options_t* options = cairo_font_options_create(); + cairo_scaled_font_t* sf = + cairo_scaled_font_create(face, &identity, &identity, options); + cairo_font_options_destroy(options); + cairo_font_face_destroy(face); - sCairoFTLibrary = face.get()->glyph->library; + FT_Face ft = cairo_ft_scaled_font_lock_face(sf); + + sCairoFTLibrary = ft->glyph->library; + + cairo_ft_scaled_font_unlock_face(sf); + cairo_scaled_font_destroy(sf); } return sCairoFTLibrary; } gfxPlatformFontList::PrefFontList* gfxFcPlatformFontList::FindGenericFamilies(const nsAString& aGeneric, nsAtom* aLanguage)
--- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -770,16 +770,20 @@ gfxPlatform::Init() # endif #endif InitLayersIPC(); gPlatform->PopulateScreenInfo(); gPlatform->ComputeTileSize(); +#ifdef MOZ_ENABLE_FREETYPE + Factory::SetFTLibrary(gPlatform->GetFTLibrary()); +#endif + nsresult rv; rv = gfxPlatformFontList::Init(); if (NS_FAILED(rv)) { MOZ_CRASH("Could not initialize gfxPlatformFontList"); } gPlatform->mScreenReferenceSurface = gPlatform->CreateOffscreenSurface(IntSize(1, 1), @@ -801,20 +805,16 @@ gfxPlatform::Init() } } rv = gfxFontCache::Init(); if (NS_FAILED(rv)) { MOZ_CRASH("Could not initialize gfxFontCache"); } -#ifdef MOZ_ENABLE_FREETYPE - Factory::SetFTLibrary(gPlatform->GetFTLibrary()); -#endif - /* Create and register our CMS Override observer. */ gPlatform->mSRGBOverrideObserver = new SRGBOverrideObserver(); Preferences::AddWeakObserver(gPlatform->mSRGBOverrideObserver, GFX_PREF_CMS_FORCE_SRGB); gPlatform->mFontPrefsObserver = new FontPrefsObserver(); Preferences::AddStrongObservers(gPlatform->mFontPrefsObserver, kObservedPrefs); GLContext::PlatformStartup();