Commit 591e1f86 authored by Jonathan's avatar Jonathan Committed by Commit Bot

Have PlatformFontLinux Fallback to default

It is possible to font loading to fail. Such as when the peer closes during a
synchronous mojo call to load a font.

Currently this is treated as a fatal error, which leads to flaky tests.

This change updates PlatformFontLinux to instead fallback to providing the
default font in these cases. While logging the error.

TEST=mash_browser_tests

Bug: 738441
Change-Id: I2717a0fdf561be82e6d393863a0cfd13b19ae480
Reviewed-on: https://chromium-review.googlesource.com/568789Reviewed-by: default avatarDan Erat <derat@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Jonathan Ross <jonross@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486533}
parent e657379d
......@@ -171,8 +171,11 @@ Font PlatformFontLinux::DeriveFont(int size_delta,
(weight == weight_ && style == style_)
? typeface_
: CreateSkTypeface(style, weight, &new_family, &success);
CHECK(success) << "Could not find any font: " << new_family << ", "
<< kFallbackFontFamilyName;
if (!success) {
LOG(ERROR) << "Could not find any font: " << new_family << ", "
<< kFallbackFontFamilyName << ". Falling back to the default";
return Font(new PlatformFontLinux);
}
FontRenderParamsQuery query;
query.families.push_back(new_family);
......@@ -269,8 +272,14 @@ void PlatformFontLinux::InitFromDetails(
typeface_ = typeface ? std::move(typeface)
: CreateSkTypeface(style & Font::ITALIC, weight,
&font_family_, &success);
CHECK(success) << "Could not find any font: " << font_family_ << ", "
<< kFallbackFontFamilyName;
if (!success) {
LOG(ERROR) << "Could not find any font: " << font_family << ", "
<< kFallbackFontFamilyName << ". Falling back to the default";
InitFromPlatformFont(g_default_font.Get().get());
return;
}
font_size_pixels_ = font_size_pixels;
style_ = style;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment