diff options
author | Cary Clark <caryclark@google.com> | 2017-04-05 14:07:28 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-05 20:11:51 +0000 |
commit | c057abce3508b0cd31b631b31bc41d2ecf5c37b0 (patch) | |
tree | b8d29d22aca7863916f01d6d48791d0404be89bb /core/fxge/ge/cfx_facecache.cpp | |
parent | 62bd019a37ae0753e8153aa530eac3b291b008c4 (diff) | |
download | pdfium-c057abce3508b0cd31b631b31bc41d2ecf5c37b0.tar.xz |
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 <dsinclair@chromium.org>
Commit-Queue: Cary Clark <caryclark@google.com>
Diffstat (limited to 'core/fxge/ge/cfx_facecache.cpp')
-rw-r--r-- | core/fxge/ge/cfx_facecache.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
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<SkFontMgr> customMgr(SkFontMgr_New_Custom_Empty()); + m_pTypeface = customMgr->createFromStream( + new SkMemoryStream(pFont->GetFontData(), pFont->GetSize())); + } +#endif return m_pTypeface; } #endif |