2017-10-13 14:02:58 +02:00
|
|
|
From: Jan Steffens <heftig@archlinux.org>
|
|
|
|
Date: 2017-09-19 23:30:08 -0700
|
|
|
|
Subject: This is required for QtWebEngine to show the patent-free LCD rendering. Without this patch, only grayscale rendering is used.
|
|
|
|
References: boo#1061344
|
|
|
|
Upstream: submitted
|
2019-06-28 16:32:13 +02:00
|
|
|
Index: qtwebengine-everywhere-src-5.13.0-beta2/src/3rdparty/chromium/third_party/skia/src/ports/SkFontHost_FreeType.cpp
|
2017-12-23 12:14:44 +01:00
|
|
|
===================================================================
|
2019-06-28 16:32:13 +02:00
|
|
|
--- qtwebengine-everywhere-src-5.13.0-beta2.orig/src/3rdparty/chromium/third_party/skia/src/ports/SkFontHost_FreeType.cpp
|
|
|
|
+++ qtwebengine-everywhere-src-5.13.0-beta2/src/3rdparty/chromium/third_party/skia/src/ports/SkFontHost_FreeType.cpp
|
|
|
|
@@ -122,8 +122,6 @@ public:
|
2017-12-23 12:14:44 +01:00
|
|
|
: fGetVarDesignCoordinates(nullptr)
|
2018-12-14 20:52:36 +01:00
|
|
|
, fGetVarAxisFlags(nullptr)
|
2017-12-23 12:14:44 +01:00
|
|
|
, fLibrary(nullptr)
|
|
|
|
- , fIsLCDSupported(false)
|
|
|
|
- , fLCDExtra(0)
|
|
|
|
{
|
2017-10-13 14:02:58 +02:00
|
|
|
if (FT_New_Library(&gFTMemory, &fLibrary)) {
|
|
|
|
return;
|
2019-06-28 16:32:13 +02:00
|
|
|
@@ -186,8 +184,6 @@ public:
|
2017-12-23 12:14:44 +01:00
|
|
|
// Setup LCD filtering. This reduces color fringes for LCD smoothed glyphs.
|
|
|
|
// The default has changed over time, so this doesn't mean the same thing to all users.
|
2017-10-13 14:02:58 +02:00
|
|
|
if (FT_Library_SetLcdFilter(fLibrary, FT_LCD_FILTER_DEFAULT) == 0) {
|
|
|
|
- fIsLCDSupported = true;
|
|
|
|
- fLCDExtra = 2; //Using a filter adds one full pixel to each side.
|
2017-12-23 12:14:44 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
~FreeTypeLibrary() {
|
2019-06-28 16:32:13 +02:00
|
|
|
@@ -197,8 +193,6 @@ public:
|
2017-10-13 14:02:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
FT_Library library() { return fLibrary; }
|
|
|
|
- bool isLCDSupported() { return fIsLCDSupported; }
|
|
|
|
- int lcdExtra() { return fLCDExtra; }
|
|
|
|
|
2017-12-23 12:14:44 +01:00
|
|
|
// FT_Get_{MM,Var}_{Blend,Design}_Coordinates were added in FreeType 2.7.1.
|
|
|
|
// Prior to this there was no way to get the coordinates out of the FT_Face.
|
2019-06-28 16:32:13 +02:00
|
|
|
@@ -215,8 +209,6 @@ public:
|
2017-12-23 12:14:44 +01:00
|
|
|
|
2017-10-13 14:02:58 +02:00
|
|
|
private:
|
|
|
|
FT_Library fLibrary;
|
|
|
|
- bool fIsLCDSupported;
|
|
|
|
- int fLCDExtra;
|
|
|
|
|
|
|
|
// FT_Library_SetLcdFilterWeights was introduced in FreeType 2.4.0.
|
|
|
|
// The following platforms provide FreeType of at least 2.4.0.
|
2019-06-28 16:32:13 +02:00
|
|
|
@@ -713,17 +705,6 @@ void SkTypeface_FreeType::onFilterRec(Sk
|
2017-10-13 14:02:58 +02:00
|
|
|
rec->fTextSize = SkIntToScalar(1 << 14);
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (isLCD(*rec)) {
|
|
|
|
- // TODO: re-work so that FreeType is set-up and selected by the SkFontMgr.
|
|
|
|
- SkAutoMutexAcquire ama(gFTMutex);
|
|
|
|
- ref_ft_library();
|
|
|
|
- if (!gFTLibrary->isLCDSupported()) {
|
|
|
|
- // If the runtime Freetype library doesn't support LCD, disable it here.
|
|
|
|
- rec->fMaskFormat = SkMask::kA8_Format;
|
|
|
|
- }
|
|
|
|
- unref_ft_library();
|
|
|
|
- }
|
|
|
|
-
|
2019-06-28 16:32:13 +02:00
|
|
|
SkFontHinting h = rec->getHinting();
|
|
|
|
if (kFull_SkFontHinting == h && !isLCD(*rec)) {
|
2017-10-13 14:02:58 +02:00
|
|
|
// collapse full->normal hinting if we're not doing LCD
|
2019-06-28 16:32:13 +02:00
|
|
|
@@ -1121,11 +1102,11 @@ bool SkScalerContext_FreeType::getCBoxFo
|
2017-10-13 14:02:58 +02:00
|
|
|
void SkScalerContext_FreeType::updateGlyphIfLCD(SkGlyph* glyph) {
|
2019-06-28 16:32:13 +02:00
|
|
|
if (glyph->fMaskFormat == SkMask::kLCD16_Format) {
|
2017-10-13 14:02:58 +02:00
|
|
|
if (fLCDIsVert) {
|
|
|
|
- glyph->fHeight += gFTLibrary->lcdExtra();
|
|
|
|
- glyph->fTop -= gFTLibrary->lcdExtra() >> 1;
|
|
|
|
+ glyph->fHeight += 2;
|
|
|
|
+ glyph->fTop -= 1;
|
|
|
|
} else {
|
|
|
|
- glyph->fWidth += gFTLibrary->lcdExtra();
|
|
|
|
- glyph->fLeft -= gFTLibrary->lcdExtra() >> 1;
|
|
|
|
+ glyph->fWidth += 2;
|
|
|
|
+ glyph->fLeft -= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|