зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1708797 - Try to make font fallback code more robust against DWrite failures. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D114225
This commit is contained in:
Родитель
8958ae3c7c
Коммит
5347f125e1
|
@ -2109,6 +2109,9 @@ gfxFontEntry* gfxDWriteFontList::PlatformGlobalFontFallback(
|
|||
if (!mFallbackRenderer) {
|
||||
mFallbackRenderer = new DWriteFontFallbackRenderer(dwFactory);
|
||||
}
|
||||
if (!mFallbackRenderer->IsValid()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// initialize text format
|
||||
if (!mFallbackFormat) {
|
||||
|
@ -2147,8 +2150,14 @@ gfxFontEntry* gfxDWriteFontList::PlatformGlobalFontFallback(
|
|||
|
||||
// call the draw method to invoke the DirectWrite layout functions
|
||||
// which determine the fallback font
|
||||
hr = fallbackLayout->Draw(nullptr, mFallbackRenderer, 50.0f, 50.0f);
|
||||
if (FAILED(hr)) {
|
||||
MOZ_SEH_TRY {
|
||||
hr = fallbackLayout->Draw(nullptr, mFallbackRenderer, 50.0f, 50.0f);
|
||||
if (FAILED(hr)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
MOZ_SEH_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
|
||||
gfxCriticalNote << "Exception occurred during DWrite font fallback";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -274,6 +274,9 @@ class DWriteFontFallbackRenderer final : public IDWriteTextRenderer {
|
|||
|
||||
~DWriteFontFallbackRenderer() {}
|
||||
|
||||
// If we don't have an mSystemFonts pointer, this renderer is unusable.
|
||||
bool IsValid() const { return mSystemFonts; }
|
||||
|
||||
// IDWriteTextRenderer methods
|
||||
IFACEMETHOD(DrawGlyphRun)
|
||||
(void* clientDrawingContext, FLOAT baselineOriginX, FLOAT baselineOriginY,
|
||||
|
|
Загрузка…
Ссылка в новой задаче