From 3ddd8411394a693a48dfdd454297261021a11f65 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen <allan.jensen@digia.com> Date: Mon, 22 Sep 2014 10:57:18 +0200 Subject: [PATCH] <third_party/WebKit> Fix webfonts with wrong hinting on Linux This patch makes webfonts to read the fontconfig defaults for their size and font style. Change-Id: I80ffd8e2ff27d438c60457ca2b1836999e528783 Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com> --- .../Source/platform/exported/linux/WebFontInfo.cpp | 9 ++++++--- .../fonts/linux/FontPlatformDataLinuxHarfBuzz.cpp | 6 ++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/chromium/third_party/WebKit/Source/platform/exported/linux/WebFontInfo.cpp b/chromium/third_party/WebKit/Source/platform/exported/linux/WebFontInfo.cpp index 74cf27e777f..6a89398f4d5 100644 --- a/chromium/third_party/WebKit/Source/platform/exported/linux/WebFontInfo.cpp +++ b/chromium/third_party/WebKit/Source/platform/exported/linux/WebFontInfo.cpp @@ -141,9 +141,12 @@ void WebFontInfo::renderStyleForStrike(const char* family, int sizeAndStyle, Web FcPattern* pattern = FcPatternCreate(); FcValue fcvalue; - fcvalue.type = FcTypeString; - fcvalue.u.s = reinterpret_cast<const FcChar8 *>(family); - FcPatternAdd(pattern, FC_FAMILY, fcvalue, FcFalse); + // A WebFont might not have family name yet, but we still want to pick up defaults for the size and style. + if (family && *family) { + fcvalue.type = FcTypeString; + fcvalue.u.s = reinterpret_cast<const FcChar8 *>(family); + FcPatternAdd(pattern, FC_FAMILY, fcvalue, FcFalse); + } fcvalue.type = FcTypeInteger; fcvalue.u.i = isBold ? FC_WEIGHT_BOLD : FC_WEIGHT_NORMAL; diff --git a/chromium/third_party/WebKit/Source/platform/fonts/linux/FontPlatformDataLinuxHarfBuzz.cpp b/chromium/third_party/WebKit/Source/platform/fonts/linux/FontPlatformDataLinuxHarfBuzz.cpp index 430f6b756ef..2f4922da40e 100644 --- a/chromium/third_party/WebKit/Source/platform/fonts/linux/FontPlatformDataLinuxHarfBuzz.cpp +++ b/chromium/third_party/WebKit/Source/platform/fonts/linux/FontPlatformDataLinuxHarfBuzz.cpp @@ -104,8 +104,10 @@ static inline void getRenderStyleForStrike(FontRenderStyle& fontRenderStyle, con #if OS(ANDROID) style.setDefaults(); #else - if (!font || !*font) - style.setDefaults(); // It's probably a webfont. Take the system defaults. + if (!font || !*font) { + // This is probably a webfont. + blink::WebFontInfo::renderStyleForStrike(font, sizeAndStyle, &style); + } else if (blink::Platform::current()->sandboxSupport()) blink::Platform::current()->sandboxSupport()->getRenderStyleForStrike(font, sizeAndStyle, &style); else -- GitLab