PepperFlashRendererHost to use SkFontStyle.

https://chromium-review.googlesource.com/c/chromium/src/+/602469
This commit is contained in:
deepak1556 2018-04-13 15:06:42 +05:30 committed by Samuel Attard
parent 43ca4d5bfd
commit 844ef4291c

View file

@ -27,6 +27,7 @@
#include "ppapi/thunk/ppb_image_data_api.h" #include "ppapi/thunk/ppb_image_data_api.h"
#include "skia/ext/platform_canvas.h" #include "skia/ext/platform_canvas.h"
#include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkFontStyle.h"
#include "third_party/skia/include/core/SkMatrix.h" #include "third_party/skia/include/core/SkMatrix.h"
#include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPoint.h" #include "third_party/skia/include/core/SkPoint.h"
@ -197,14 +198,13 @@ int32_t PepperFlashRendererHost::OnDrawGlyphs(
return PP_ERROR_FAILED; return PP_ERROR_FAILED;
// Set up the typeface. // Set up the typeface.
int style = SkTypeface::kNormal; int weight = (params.font_desc.weight + 1) * 100;
if (static_cast<PP_BrowserFont_Trusted_Weight>(params.font_desc.weight) >= SkFontStyle::Slant slant = SkFontStyle::kUpright_Slant;
PP_BROWSERFONT_TRUSTED_WEIGHT_BOLD)
style |= SkTypeface::kBold;
if (params.font_desc.italic) if (params.font_desc.italic)
style |= SkTypeface::kItalic; slant = SkFontStyle::kItalic_Slant;
sk_sp<SkTypeface> typeface(SkTypeface::MakeFromName( SkFontStyle style(weight, SkFontStyle::kNormal_Width, slant);
params.font_desc.face.c_str(), SkFontStyle::FromOldStyle(style))); sk_sp<SkTypeface> typeface(
SkTypeface::MakeFromName(params.font_desc.face.c_str(), style));
if (!typeface) if (!typeface)
return PP_ERROR_FAILED; return PP_ERROR_FAILED;