Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. --- a/ui/gfx/render_text_harfbuzz.cc
  2. +++ b/ui/gfx/render_text_harfbuzz.cc
  3. @@ -796,11 +796,33 @@ bool TextRunHarfBuzz::FontParams::SetRenderParamsRematchFont(
  4. // scenarios, as the fallback font may be of a different weight and style than
  5. // the run's own, so this can lead to a failure of instantiating the correct
  6. // fallback font.
  7. +
  8. + sk_sp<SkTypeface> before_rematch;
  9. + PlatformFont* platform_font = new_font.platform_font();
  10. + if (platform_font) {
  11. + before_rematch = platform_font->GetNativeSkTypefaceIfAvailable();
  12. + }
  13. +
  14. sk_sp<SkTypeface> new_skia_face(
  15. internal::CreateSkiaTypeface(new_font, italic, weight));
  16. if (!new_skia_face)
  17. return false;
  18.  
  19. + if (before_rematch->fontStyle().weight() != new_skia_face->fontStyle().weight() ||
  20. + before_rematch->fontStyle().slant() != new_skia_face->fontStyle().slant()) {
  21. + SkString family_before;
  22. + SkString family_after;
  23. + before_rematch->getFamilyName(&family_before);
  24. + new_skia_face->getFamilyName(&family_after);
  25. + VLOG(4) << "rematching lead to new font style: fam before: "
  26. + << family_before.c_str()
  27. + << " fam after: " << family_after.c_str()
  28. + << " weights: " << before_rematch->fontStyle().weight() << ":"
  29. + << new_skia_face->fontStyle().weight()
  30. + << " slants: " << before_rematch->fontStyle().slant() << ":"
  31. + << new_skia_face->fontStyle().slant();
  32. + }
  33. +
  34. skia_face = new_skia_face;
  35. font = new_font;
  36. render_params = new_render_params;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement