Hi,
I'm trying to fix monospace bitmap font support for gvim (gtk-2 flavor),
which has been broken since pango 1.44.
It requires several changes:
1. fix metrics rounding in vim https://github.com/vim/vim/pull/6168,
already included in our vim port.
2. fix fonttosfnt in our xenocara or rely on something like fontforge
for the same job.
(https://gitlab.freedesktop.org/xorg/app/fonttosfnt/-/merge_requests/7)
3. fix pango, so it does not accidentally use unsupported pcf fonts when
supported OpenType fonts are present:
https://gitlab.gnome.org/GNOME/pango/-/issues/484
4. ship bitmap fonts in an OpenType container, too.
Attached is a diff to update pango to the latest release and backport
above mentioned fix.
I have only very little knowledge on shared library versioning, so
please check that I've got that part right.
I had to rebuild and reinstall gtk and vim to make vim actually use the
patched pango.
This patch is needed so we can start shipping bitmap fonts in OpenType
containers (.otb).
Still waiting for matthieu@ regarding the fonttosfnt patch.
OK for below diff? May this update break dependent ports? So far I
tested only gvim.
Christopher
Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/pango/Makefile,v
retrieving revision 1.129
diff -u -p -r1.129 Makefile
--- Makefile 21 Dec 2019 14:38:47 -0000 1.129
+++ Makefile 27 Jun 2020 14:12:35 -0000
@@ -2,14 +2,13 @@
COMMENT= library for layout and rendering of text
-GNOME_VERSION= 1.44.7
-REVISION= 0
+GNOME_VERSION= 1.45.3
GNOME_PROJECT= pango
-SHARED_LIBS += pango-1.0 3801.0 # 0.4400.7
-SHARED_LIBS += pangoft2-1.0 3801.0 # 0.4400.7
-SHARED_LIBS += pangoxft-1.0 3801.0 # 0.4400.7
-SHARED_LIBS += pangocairo-1.0 3801.0 # 0.4400.7
+SHARED_LIBS += pango-1.0 3802.0 # 0.4400.7
+SHARED_LIBS += pangoft2-1.0 3802.0 # 0.4400.7
+SHARED_LIBS += pangoxft-1.0 3802.0 # 0.4400.7
+SHARED_LIBS += pangocairo-1.0 3802.0 # 0.4400.7
CATEGORIES= devel x11
@@ -21,7 +20,7 @@ MAINTAINER= Antoine Jacoutot <ajacoutot
PERMIT_PACKAGE= Yes
WANTLIB += X11 Xft Xrender c cairo fontconfig freetype fribidi
-WANTLIB += glib-2.0 gobject-2.0 harfbuzz m
+WANTLIB += gio-2.0 glib-2.0 gobject-2.0 harfbuzz m
COMPILER= base-clang ports-gcc
MODULES= devel/meson \
Index: distinfo
===================================================================
RCS file: /cvs/ports/devel/pango/distinfo,v
retrieving revision 1.71
diff -u -p -r1.71 distinfo
--- distinfo 16 Dec 2019 15:49:03 -0000 1.71
+++ distinfo 27 Jun 2020 14:12:35 -0000
@@ -1,2 +1,2 @@
-SHA256 (pango-1.44.7.tar.xz) = ZqW2zBPbc+/tZ7jpM1hFCfjdt7EKikDDhQykqYXqGx8=
-SIZE (pango-1.44.7.tar.xz) = 521384
+SHA256 (pango-1.45.3.tar.xz) = H3XB66s9KYuwwY9CBEC1B6lc5LmJBSdPSvgIMf9+5n0=
+SIZE (pango-1.45.3.tar.xz) = 531716
Index: patches/patch-pango_pangofc-fontmap_c
===================================================================
RCS file: patches/patch-pango_pangofc-fontmap_c
diff -N patches/patch-pango_pangofc-fontmap_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-pango_pangofc-fontmap_c 27 Jun 2020 14:12:35 -0000
@@ -0,0 +1,102 @@
+$OpenBSD$
+
+Backport
+https://gitlab.gnome.org/GNOME/pango/-/commit/9aaef112566c121d2660445ee9d06d13846d68f6
+
+this finally prevents pango from using pcf or bdf fonts, which are not
+supported and would render to garbage.
+
+Index: pango/pangofc-fontmap.c
+--- pango/pangofc-fontmap.c.orig
++++ pango/pangofc-fontmap.c
+@@ -817,8 +817,15 @@ pango_fc_patterns_get_pattern (PangoFcPatterns *pats)
+ }
+
+ static gboolean
+-pango_fc_is_supported_font_format (const char *fontformat)
++pango_fc_is_supported_font_format (FcPattern* pattern)
+ {
++ FcResult res;
++ const char *fontformat;
++
++ res = FcPatternGetString (pattern, FC_FONTFORMAT, 0, (FcChar8 **)(void*)&fontformat);
++ if (res != FcResultMatch)
++ return FALSE;
++
+ /* harfbuzz supports only SFNT fonts. */
+ /* FIXME: "CFF" is used for both CFF in OpenType and bare CFF files, but
+ * HarfBuzz does not support the later and FontConfig does not seem
+@@ -840,11 +847,7 @@ filter_fontset_by_format (FcFontSet *fontset)
+
+ for (i = 0; i < fontset->nfont; i++)
+ {
+- FcResult res;
+- const char *s;
+-
+- res = FcPatternGetString (fontset->fonts[i], FC_FONTFORMAT, 0, (FcChar8 **)(void*)&s);
+- if (res == FcResultMatch && pango_fc_is_supported_font_format (s))
++ if (pango_fc_is_supported_font_format (fontset->fonts[i]))
+ FcFontSetAdd (result, FcPatternDuplicate (fontset->fonts[i]));
+ }
+
+@@ -860,34 +863,32 @@ pango_fc_patterns_get_font_pattern (PangoFcPatterns *p
+ if (!pats->match && !pats->fontset)
+ pats->match = FcFontMatch (pats->fontmap->priv->config, pats->pattern, &result);
+
+- if (pats->match)
++ if (pats->match && pango_fc_is_supported_font_format (pats->match))
+ {
+ *prepare = FALSE;
+ return pats->match;
+ }
+ }
+- else
++
++ if (!pats->fontset)
+ {
+- if (!pats->fontset)
+- {
+- FcResult result;
+- FcFontSet *fontset;
+- FcFontSet *filtered;
++ FcResult result;
++ FcFontSet *fontset;
++ FcFontSet *filtered;
+
+- fontset = FcFontSort (pats->fontmap->priv->config, pats->pattern, FcFalse, NULL, &result);
+- filtered = filter_fontset_by_format (fontset);
+- FcFontSetDestroy (fontset);
++ fontset = FcFontSort (pats->fontmap->priv->config, pats->pattern, FcFalse, NULL, &result);
++ filtered = filter_fontset_by_format (fontset);
++ FcFontSetDestroy (fontset);
+
+- pats->fontset = FcFontSetSort (pats->fontmap->priv->config, &filtered, 1, pats->pattern, FcTrue, NULL, &result);
++ pats->fontset = FcFontSetSort (pats->fontmap->priv->config, &filtered, 1, pats->pattern, FcTrue, NULL, &result);
+
+- FcFontSetDestroy (filtered);
++ FcFontSetDestroy (filtered);
+
+- if (pats->match)
+- {
+- FcPatternDestroy (pats->match);
+- pats->match = NULL;
+- }
+- }
++ if (pats->match)
++ {
++ FcPatternDestroy (pats->match);
++ pats->match = NULL;
++ }
+ }
+
+ *prepare = TRUE;
+@@ -1444,8 +1445,7 @@ ensure_families (PangoFcFontMap *fcfontmap)
+ int variable;
+ PangoFcFamily *temp_family;
+
+- res = FcPatternGetString (fontset->fonts[i], FC_FONTFORMAT, 0, (FcChar8 **)(void*)&s);
+- if (res != FcResultMatch || !pango_fc_is_supported_font_format (s))
++ if (!pango_fc_is_supported_font_format (fontset->fonts[i]))
+ continue;
+
+ res = FcPatternGetString (fontset->fonts[i], FC_FAMILY, 0, (FcChar8 **)(void*)&s);
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/devel/pango/pkg/PLIST,v
retrieving revision 1.45
diff -u -p -r1.45 PLIST
--- pkg/PLIST 16 Dec 2019 15:49:04 -0000 1.45
+++ pkg/PLIST 27 Jun 2020 14:12:35 -0000
@@ -50,7 +50,9 @@ lib/girepository-1.0/PangoXft-1.0.typeli
@lib lib/libpangoxft-1.0.so.${LIBpangoxft-1.0_VERSION}
lib/pkgconfig/pango.pc
lib/pkgconfig/pangocairo.pc
+lib/pkgconfig/pangofc.pc
lib/pkgconfig/pangoft2.pc
+lib/pkgconfig/pangoot.pc
lib/pkgconfig/pangoxft.pc
@man man/man1/pango-view.1
share/gir-1.0/Pango-1.0.gir
--
http://gmerlin.de
OpenPGP: http://gmerlin.de/christopher.pub
CB07 DA40 B0B6 571D 35E2 0DEF 87E2 92A7 13E5 DEE1
No comments:
Post a Comment