Created
September 26, 2019 10:15
-
-
Save drott/9617ed06ebd812fb889de40b3ebbc85c to your computer and use it in GitHub Desktop.
Triggering logging on rematched typeface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/ui/gfx/render_text_harfbuzz.cc | |
+++ b/ui/gfx/render_text_harfbuzz.cc | |
@@ -796,11 +796,33 @@ bool TextRunHarfBuzz::FontParams::SetRenderParamsRematchFont( | |
// scenarios, as the fallback font may be of a different weight and style than | |
// the run's own, so this can lead to a failure of instantiating the correct | |
// fallback font. | |
+ | |
+ sk_sp<SkTypeface> before_rematch; | |
+ PlatformFont* platform_font = new_font.platform_font(); | |
+ if (platform_font) { | |
+ before_rematch = platform_font->GetNativeSkTypefaceIfAvailable(); | |
+ } | |
+ | |
sk_sp<SkTypeface> new_skia_face( | |
internal::CreateSkiaTypeface(new_font, italic, weight)); | |
if (!new_skia_face) | |
return false; | |
+ if (before_rematch->fontStyle().weight() != new_skia_face->fontStyle().weight() || | |
+ before_rematch->fontStyle().slant() != new_skia_face->fontStyle().slant()) { | |
+ SkString family_before; | |
+ SkString family_after; | |
+ before_rematch->getFamilyName(&family_before); | |
+ new_skia_face->getFamilyName(&family_after); | |
+ VLOG(4) << "rematching lead to new font style: fam before: " | |
+ << family_before.c_str() | |
+ << " fam after: " << family_after.c_str() | |
+ << " weights: " << before_rematch->fontStyle().weight() << ":" | |
+ << new_skia_face->fontStyle().weight() | |
+ << " slants: " << before_rematch->fontStyle().slant() << ":" | |
+ << new_skia_face->fontStyle().slant(); | |
+ } | |
+ | |
skia_face = new_skia_face; | |
font = new_font; | |
render_params = new_render_params; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment