Subject: [alpine-aports] [PATCH] Fix fonts on 32-bit firefox-esr (bug #4248)

From: Jeff Pohlmeyer <[email-masked]>
Date: Mon, 4 Jul 2016 03:06:00 -0500

This patch should fix the problem described at
https://bugs.alpinelinux.org/issues/4248
diff --git a/community/firefox-esr/APKBUILD b/community/firefox-esr/APKBUILD
index c2cbc24..de2f282 100644
--- a/community/firefox-esr/APKBUILD
+++ b/community/firefox-esr/APKBUILD
@@ -4,7 +4,7 @@ pkgname=firefox-esr
 pkgver=45.2.0
 _pkgver=$pkgver
 _xulver=$pkgver
-pkgrel=0
+pkgrel=1
 pkgdesc="Firefox web browser"
 url="https://www.mozilla.org/en-US/firefox/organizations/faq/"
 arch="all"
@@ -70,6 +70,7 @@ source="http://ftp.mozilla.org/pub/firefox/releases/${pkgver}esr/source/firefox-
 	allow-utf8-fallback.patch
 	libavutil.patch
 	mallinfo.patch
+	fix-x86_32-round-dpi.patch
 
 	firefox.desktop
 	firefox-safe.desktop"
@@ -186,6 +187,7 @@ f29e0036edc7b3a4158a82fa97bde500  fix-fortify-inline.patch
 1feef5ea2fd5acc2a71a29350754d006  allow-utf8-fallback.patch
 b8b2a3cdb38f402e4eb4885908233811  libavutil.patch
 0db0cce8350d59a91ae2c4f0400f7146  mallinfo.patch
+dac48ab99956461b1890e23b11beae97  fix-x86_32-round-dpi.patch
 ba96924ece1d77453e462429037a2ce5  firefox.desktop
 6f38a5899034b7786cb1f75ad42032b8  firefox-safe.desktop"
 sha256sums="1a729774034231c919dc5a556e17d3342792d5347c755d8d0a4f67a07374804b  firefox-45.2.0esr.source.tar.xz
@@ -205,6 +207,7 @@ cd19195cb4c316ad9f7d377cd8581218c888863b1bc4d112c97f48a4425fb946  fix-fortify-sy
 a1ba79ec0c50c19edcfb24bb2686a718a77b02035e412989b9208b9b818abe14  allow-utf8-fallback.patch
 83113f1fbc0389602b3623e8a5428d41837c4ec9557615c37ca05619526a7404  libavutil.patch
 2f564fa5f347f3c7f20d589ef273f000ca9c9aeca2c6ad0fb5b15bfc715d8b81  mallinfo.patch
+382e2bdfc1880eeb787052912dc8a50bfeccd9baf6b663e8482f2735b76c7c05  fix-x86_32-round-dpi.patch
 b571c4a49884a3c98806246c9cc3e60c73d5a8f4aeb7f96217db0be1d6210eda  firefox.desktop
 4b6de45753856a890f4482055666e77f9b01bdfb7e0df08bafaa3a4d9937eed3  firefox-safe.desktop"
 sha512sums="fd67353cff9400080a311af92562b1ed26d20ca2229e32e8c8289b364ebe27fd501eed78c72b614e0501c3841ae9b17f2102158fbeef5083bee8c12d952660e6  firefox-45.2.0esr.source.tar.xz
@@ -224,5 +227,6 @@ c69cdb2d6c66180d6a67c386b862a5ed953aab4db434b054c9e1e6702bcc56ba219a4cb22747d9c8
 ebbc2b1336197c289e9b7c073d196fb5734e1dad0109fe70538f8089b1873e4b55305cd39cefcf95cd4eb36715be6dff298856c496616e935ff5579452e62b09  allow-utf8-fallback.patch
 2213dbd7eb36f954add09977c0bb979aea79376164bc98d7e8957ecf584776bc11cc88b6d8235f9e04ac69d5975a47c2f52fd9aff9076326f15997657af8c9f3  libavutil.patch
 bdcd1b402d2ec94957ba5d08cbad7b1a7f59c251c311be9095208491a05abb05a956c79f27908e1f26b54a3679387b2f33a51e945b650671ad85c0a2d59a5a29  mallinfo.patch
+d1ebe57a21f5cb517525abe0e5eabcf09ead141c7b0884b8ee70ac5af02a284fbf7eb26c2e43547ec25c909449dea8299b9a86026289cf306f83ae74b1211186  fix-x86_32-round-dpi.patch
 f3b7c3e804ce04731012a46cb9e9a6b0769e3772aef9c0a4a8c7520b030fdf6cd703d5e9ff49275f14b7d738fe82a0a4fde3bc3219dff7225d5db0e274987454  firefox.desktop
 5dcb6288d0444a8a471d669bbaf61cdb1433663eff38b72ee5e980843f5fc07d0d60c91627a2c1159215d0ad77ae3f115dcc5fdfe87e64ca704b641aceaa44ed  firefox-safe.desktop"
diff --git a/community/firefox-esr/fix-x86_32-round-dpi.patch b/community/firefox-esr/fix-x86_32-round-dpi.patch
new file mode 100644
index 0000000..3020500
--- /dev/null
+++ b/community/firefox-esr/fix-x86_32-round-dpi.patch
@@ -0,0 +1,19 @@
+Newer version of musl's round() function causes fonts 
+to disappear on x86 32-bit due to bad DPI value. 
+So use nearbyint() here instead.
+See https://bugs.alpinelinux.org/issues/4248
+
+--- ./gfx/thebes/gfxPlatformGtk.cpp.orig
++++ ./gfx/thebes/gfxPlatformGtk.cpp
+@@ -328,7 +328,11 @@
+         // Make sure init is run so we have a resolution
+         GdkScreen *screen = gdk_screen_get_default();
+         gtk_settings_get_for_screen(screen);
++#if defined(i386)
++        sDPI = int32_t(nearbyint(gdk_screen_get_resolution(screen)));
++#else
+         sDPI = int32_t(round(gdk_screen_get_resolution(screen)));
++#endif
+         if (sDPI <= 0) {
+             // Fall back to something sane
+             sDPI = 96;

---

From: Natanael Copa <[email-masked]>
Date: Tue, 5 Jul 2016 13:59:31 +0200

On Mon, 4 Jul 2016 03:06:00 -0500

> https://bugs.alpinelinux.org/issues/4248

The problem is deeper. Once the precision is changed any call to libc
math function result in undefined behaviour. It may or may not work and
as you notice, it does not solves all problems.

-nc

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---