summaryrefslogtreecommitdiff
path: root/libre/icecat
diff options
context:
space:
mode:
authorAndreas Grapentin <andreas@grapentin.org>2017-10-16 07:25:08 +0200
committerAndreas Grapentin <andreas@grapentin.org>2017-10-16 07:27:01 +0200
commitc071024eb91404cf9b17305176b949799aa51fa0 (patch)
treee8348dacbeaf015df455e2cb0233dcaee5348172 /libre/icecat
parent71c95ae8b61a81514b5e7cbdc2b7a3ee52f86fa0 (diff)
downloadabslibre-c071024eb91404cf9b17305176b949799aa51fa0.tar.gz
abslibre-c071024eb91404cf9b17305176b949799aa51fa0.tar.bz2
abslibre-c071024eb91404cf9b17305176b949799aa51fa0.zip
libre/icecat: fixed glyph rendering issues
Diffstat (limited to 'libre/icecat')
-rw-r--r--libre/icecat/PKGBUILD10
-rw-r--r--libre/icecat/mozilla-8904705.patch147
-rw-r--r--libre/icecat/mozilla-8909448.patch43
3 files changed, 199 insertions, 1 deletions
diff --git a/libre/icecat/PKGBUILD b/libre/icecat/PKGBUILD
index b7726a30c..03922bf89 100644
--- a/libre/icecat/PKGBUILD
+++ b/libre/icecat/PKGBUILD
@@ -16,7 +16,7 @@ _pgo=false
pkgname=icecat
_pkgver=52.3.0-gnu1
pkgver=${_pkgver//-/_}
-pkgrel=1
+pkgrel=2
pkgdesc="GNU IceCat, the standalone web browser based on Mozilla Firefox."
arch=(i686 x86_64 armv7h)
@@ -41,6 +41,8 @@ source=(http://ftp.gnu.org/gnu/gnuzilla/${_pkgver%-*}/$pkgname-$_pkgver.tar.bz2{
$pkgname-install-dir.patch
vendor.js
$pkgname-fixed-loading-icon.png
+ mozilla-8904705.patch
+ mozilla-8909448.patch
disable-crypto-hardening-settings.patch
disable-spoofSource-referer.patch
no-crmf.patch
@@ -54,6 +56,8 @@ sha256sums=('699ab2b41d4428ef5e360f3f33d98bc52723315cedac20bb03619846ca895302'
'5bdab2de5520fb4d3dbc453d9f73d20e0e077bf652bc780fc17184ba6c718a47'
'977aa49b940f1da049cefa2878a63ac6669a78e63e9d55bb11db7b8f8fb64c33'
'68e3a5b47c6d175cc95b98b069a15205f027cab83af9e075818d38610feb6213'
+ 'dc4feddbf22ea11ae2513c68b7f3fc9047850d055a7f30d31a7ee94d7d5de12a'
+ '8ed42e75b577d57e4b07f1d70137cb8e82f757abb616f1cfea694a041ad5679e'
'bb1fc90d117c4a7810e202d23ff44a2dac11b675336533054b5a70dd8606df38'
'c50043266e69f5844e6dce9ea7193af79587dcaa66806932d7867281a176f03e'
'cf224d69e89f37f92202061669014b99fbf7b1fec38fd8ba9f957711fa095729'
@@ -102,6 +106,10 @@ prepare() {
rm -rv browser/locales/searchplugins
cp -av /usr/lib/mozilla/searchplugins browser/locales
+ # fix broken glyphs
+ patch -Np1 -i "$srcdir/mozilla-8904705.patch"
+ patch -Np1 -i "$srcdir/mozilla-8909448.patch"
+
# Disable crypto hardening settings for now
# https://lists.parabola.nu/pipermail/assist/2015-October/000534.html
# https://labs.parabola.nu/issues/842
diff --git a/libre/icecat/mozilla-8904705.patch b/libre/icecat/mozilla-8904705.patch
new file mode 100644
index 000000000..deecd1251
--- /dev/null
+++ b/libre/icecat/mozilla-8904705.patch
@@ -0,0 +1,147 @@
+# HG changeset patch
+# User Lee Salzman <lsalzman@mozilla.com>
+# Date 1504640559 14400
+# Tue Sep 05 15:42:39 2017 -0400
+# Node ID 923246286b9858fb103e100f886c03714b97b5ec
+# Parent 3fff2b174212af40a7b7ba75a047db431f81c780
+clip FreeType glyph bitmap to mask in Skia (52 ESR)
+
+diff --git a/gfx/skia/skia/src/ports/SkFontHost_FreeType_common.cpp b/gfx/skia/skia/src/ports/SkFontHost_FreeType_common.cpp
+--- a/gfx/skia/skia/src/ports/SkFontHost_FreeType_common.cpp
++++ b/gfx/skia/skia/src/ports/SkFontHost_FreeType_common.cpp
+@@ -350,58 +350,118 @@ void SkScalerContext_FreeType_Base::gene
+ const SkMatrix& bitmapTransform)
+ {
+ const bool doBGR = SkToBool(fRec.fFlags & SkScalerContext::kLCD_BGROrder_Flag);
+ const bool doVert = SkToBool(fRec.fFlags & SkScalerContext::kLCD_Vertical_Flag);
+
+ switch ( face->glyph->format ) {
+ case FT_GLYPH_FORMAT_OUTLINE: {
+ FT_Outline* outline = &face->glyph->outline;
+- FT_BBox bbox;
+- FT_Bitmap target;
+
+ int dx = 0, dy = 0;
+ if (fRec.fFlags & SkScalerContext::kSubpixelPositioning_Flag) {
+ dx = SkFixedToFDot6(glyph.getSubXFixed());
+ dy = SkFixedToFDot6(glyph.getSubYFixed());
+ // negate dy since freetype-y-goes-up and skia-y-goes-down
+ dy = -dy;
+ }
+- FT_Outline_Get_CBox(outline, &bbox);
+- /*
+- what we really want to do for subpixel is
+- offset(dx, dy)
+- compute_bounds
+- offset(bbox & !63)
+- but that is two calls to offset, so we do the following, which
+- achieves the same thing with only one offset call.
+- */
+- FT_Outline_Translate(outline, dx - ((bbox.xMin + dx) & ~63),
+- dy - ((bbox.yMin + dy) & ~63));
++ memset(glyph.fImage, 0, glyph.rowBytes() * glyph.fHeight);
+
+ if (SkMask::kLCD16_Format == glyph.fMaskFormat) {
+- FT_Render_Glyph(face->glyph, doVert ? FT_RENDER_MODE_LCD_V : FT_RENDER_MODE_LCD);
++ FT_Outline_Translate(outline, dx, dy);
++ FT_Error err = FT_Render_Glyph(face->glyph, doVert ? FT_RENDER_MODE_LCD_V : FT_RENDER_MODE_LCD);
++ if (err) {
++ return;
++ }
++
+ SkMask mask;
+ glyph.toMask(&mask);
++
++ FT_GlyphSlotRec& ftGlyph = *face->glyph;
++
++ if (!SkIRect::Intersects(mask.fBounds,
++ SkIRect::MakeXYWH( ftGlyph.bitmap_left,
++ -ftGlyph.bitmap_top,
++ ftGlyph.bitmap.width,
++ ftGlyph.bitmap.rows)))
++ {
++ return;
++ }
++
++ // If the FT_Bitmap extent is larger, discard bits of the bitmap outside the mask.
++ // If the SkMask extent is larger, shrink mask to fit bitmap (clearing discarded).
++ unsigned char* origBuffer = ftGlyph.bitmap.buffer;
++ // First align the top left (origin).
++ if (-ftGlyph.bitmap_top < mask.fBounds.fTop) {
++ int32_t topDiff = mask.fBounds.fTop - (-ftGlyph.bitmap_top);
++ ftGlyph.bitmap.buffer += ftGlyph.bitmap.pitch * topDiff;
++ ftGlyph.bitmap.rows -= topDiff;
++ ftGlyph.bitmap_top = -mask.fBounds.fTop;
++ }
++ if (ftGlyph.bitmap_left < mask.fBounds.fLeft) {
++ int32_t leftDiff = mask.fBounds.fLeft - ftGlyph.bitmap_left;
++ ftGlyph.bitmap.buffer += leftDiff;
++ ftGlyph.bitmap.width -= leftDiff;
++ ftGlyph.bitmap_left = mask.fBounds.fLeft;
++ }
++ if (mask.fBounds.fTop < -ftGlyph.bitmap_top) {
++ mask.fImage += mask.fRowBytes * (-ftGlyph.bitmap_top - mask.fBounds.fTop);
++ mask.fBounds.fTop = -ftGlyph.bitmap_top;
++ }
++ if (mask.fBounds.fLeft < ftGlyph.bitmap_left) {
++ mask.fImage += sizeof(uint16_t) * (ftGlyph.bitmap_left - mask.fBounds.fLeft);
++ mask.fBounds.fLeft = ftGlyph.bitmap_left;
++ }
++ // Origins aligned, clean up the width and height.
++ int ftVertScale = (doVert ? 3 : 1);
++ int ftHoriScale = (doVert ? 1 : 3);
++ if (mask.fBounds.height() * ftVertScale < SkToInt(ftGlyph.bitmap.rows)) {
++ ftGlyph.bitmap.rows = mask.fBounds.height() * ftVertScale;
++ }
++ if (mask.fBounds.width() * ftHoriScale < SkToInt(ftGlyph.bitmap.width)) {
++ ftGlyph.bitmap.width = mask.fBounds.width() * ftHoriScale;
++ }
++ if (SkToInt(ftGlyph.bitmap.rows) < mask.fBounds.height() * ftVertScale) {
++ mask.fBounds.fBottom = mask.fBounds.fTop + ftGlyph.bitmap.rows / ftVertScale;
++ }
++ if (SkToInt(ftGlyph.bitmap.width) < mask.fBounds.width() * ftHoriScale) {
++ mask.fBounds.fRight = mask.fBounds.fLeft + ftGlyph.bitmap.width / ftHoriScale;
++ }
++
+ if (fPreBlend.isApplicable()) {
+- copyFT2LCD16<true>(face->glyph->bitmap, mask, doBGR,
++ copyFT2LCD16<true>(ftGlyph.bitmap, mask, doBGR,
+ fPreBlend.fR, fPreBlend.fG, fPreBlend.fB);
+ } else {
+- copyFT2LCD16<false>(face->glyph->bitmap, mask, doBGR,
++ copyFT2LCD16<false>(ftGlyph.bitmap, mask, doBGR,
+ fPreBlend.fR, fPreBlend.fG, fPreBlend.fB);
+ }
++ // Restore the buffer pointer so FreeType can properly free it.
++ ftGlyph.bitmap.buffer = origBuffer;
+ } else {
++ FT_BBox bbox;
++ FT_Bitmap target;
++ FT_Outline_Get_CBox(outline, &bbox);
++ /*
++ what we really want to do for subpixel is
++ offset(dx, dy)
++ compute_bounds
++ offset(bbox & !63)
++ but that is two calls to offset, so we do the following, which
++ achieves the same thing with only one offset call.
++ */
++ FT_Outline_Translate(outline, dx - ((bbox.xMin + dx) & ~63),
++ dy - ((bbox.yMin + dy) & ~63));
++
+ target.width = glyph.fWidth;
+ target.rows = glyph.fHeight;
+ target.pitch = glyph.rowBytes();
+ target.buffer = reinterpret_cast<uint8_t*>(glyph.fImage);
+ target.pixel_mode = compute_pixel_mode( (SkMask::Format)fRec.fMaskFormat);
+ target.num_grays = 256;
+
+- memset(glyph.fImage, 0, glyph.rowBytes() * glyph.fHeight);
+ FT_Outline_Get_Bitmap(face->glyph->library, outline, &target);
+ }
+ } break;
+
+ case FT_GLYPH_FORMAT_BITMAP: {
+ FT_Pixel_Mode pixel_mode = static_cast<FT_Pixel_Mode>(face->glyph->bitmap.pixel_mode);
+ SkMask::Format maskFormat = static_cast<SkMask::Format>(glyph.fMaskFormat);
+
diff --git a/libre/icecat/mozilla-8909448.patch b/libre/icecat/mozilla-8909448.patch
new file mode 100644
index 000000000..22f2e17af
--- /dev/null
+++ b/libre/icecat/mozilla-8909448.patch
@@ -0,0 +1,43 @@
+# HG changeset patch
+# User Lee Salzman <lsalzman@mozilla.com>
+# Date 1505762237 14400
+# Mon Sep 18 15:17:17 2017 -0400
+# Node ID b48346dc7742fbbc8284a907983098856503a4f1
+# Parent 60baec2de6577d8a109e417545ad1b6542481068
+fix Skia's glyph LCD filter padding for FreeType 2.8.1
+
+MozReview-Commit-ID: JFvnANsTS0r
+
+diff --git a/gfx/skia/skia/src/ports/SkFontHost_cairo.cpp b/gfx/skia/skia/src/ports/SkFontHost_cairo.cpp
+--- a/gfx/skia/skia/src/ports/SkFontHost_cairo.cpp
++++ b/gfx/skia/skia/src/ports/SkFontHost_cairo.cpp
+@@ -661,20 +661,25 @@ void SkScalerContext_CairoFT::generateMe
+ bbox.yMin &= ~63;
+ bbox.xMax = (bbox.xMax + 63) & ~63;
+ bbox.yMax = (bbox.yMax + 63) & ~63;
+ glyph->fWidth = SkToU16(SkFDot6Floor(bbox.xMax - bbox.xMin));
+ glyph->fHeight = SkToU16(SkFDot6Floor(bbox.yMax - bbox.yMin));
+ glyph->fTop = -SkToS16(SkFDot6Floor(bbox.yMax));
+ glyph->fLeft = SkToS16(SkFDot6Floor(bbox.xMin));
+
+- if (isLCD(fRec) &&
+- gSetLcdFilter &&
+- (fLcdFilter == FT_LCD_FILTER_DEFAULT ||
+- fLcdFilter == FT_LCD_FILTER_LIGHT)) {
++ if (isLCD(fRec)) {
++ // In FreeType < 2.8.1, LCD filtering, if explicitly used, may
++ // add padding to the glyph. When not used, there is no padding.
++ // As of 2.8.1, LCD filtering is now always supported and may
++ // add padding even if an LCD filter is not explicitly set.
++ // Regardless, if no LCD filtering is used, or if LCD filtering
++ // doesn't add padding, it is safe to modify the glyph's bounds
++ // here. generateGlyphImage will detect if the mask is smaller
++ // than the bounds and clip things appropriately.
+ if (fRec.fFlags & kLCD_Vertical_Flag) {
+ glyph->fTop -= 1;
+ glyph->fHeight += 2;
+ } else {
+ glyph->fLeft -= 1;
+ glyph->fWidth += 2;
+ }
+ }