From c057abce3508b0cd31b631b31bc41d2ecf5c37b0 Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Wed, 5 Apr 2017 14:07:28 -0400 Subject: use freetype if windows font decode fails If windows is unable to resolve the font stream, use the custom empty handler instead, which maps to freetype. R=dsinclair@chromium.org,bungeman@google.com Bug:chrome:705580 Change-Id: Ib1732f29f462fc5d5e42329088c80c83abe3ea25 Reviewed-on: https://pdfium-review.googlesource.com/3771 Reviewed-by: dsinclair Commit-Queue: Cary Clark --- core/fxge/ge/cfx_facecache.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'core') diff --git a/core/fxge/ge/cfx_facecache.cpp b/core/fxge/ge/cfx_facecache.cpp index 69be8a1535..2a8e71acf5 100644 --- a/core/fxge/ge/cfx_facecache.cpp +++ b/core/fxge/ge/cfx_facecache.cpp @@ -21,6 +21,11 @@ #if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_ #include "third_party/skia/include/core/SkStream.h" #include "third_party/skia/include/core/SkTypeface.h" + +#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +#include "third_party/skia/include/ports/SkFontMgr.h" +#include "third_party/skia/include/ports/SkFontMgr_empty.h" +#endif #endif namespace { @@ -359,6 +364,13 @@ CFX_TypeFace* CFX_FaceCache::GetDeviceCache(const CFX_Font* pFont) { new SkMemoryStream(pFont->GetFontData(), pFont->GetSize())) .release(); } +#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ + if (!m_pTypeface) { + sk_sp customMgr(SkFontMgr_New_Custom_Empty()); + m_pTypeface = customMgr->createFromStream( + new SkMemoryStream(pFont->GetFontData(), pFont->GetSize())); + } +#endif return m_pTypeface; } #endif -- cgit v1.2.3