pangox-compat: fix build with latest pango

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
This commit is contained in:
Andreas Müller
2019-09-27 22:25:14 +02:00
parent df91c16f07
commit 57a16f33ef
2 changed files with 190 additions and 0 deletions

View File

@@ -0,0 +1,189 @@
From 23b4318e2836d82c04b3bead9d21ab2e53d0dd5f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Sun, 25 Aug 2019 22:12:39 +0200
Subject: [PATCH] Hack to build with recent pango
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Upstream-Status: Inapropriate [dead-project]
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
pango-impl-utils.h | 145 +++++++++++++++++++++++++++++++++++++++++++++
pangox.c | 2 +
2 files changed, 147 insertions(+)
diff --git a/pango-impl-utils.h b/pango-impl-utils.h
index 6d6c8ff..55af764 100644
--- a/pango-impl-utils.h
+++ b/pango-impl-utils.h
@@ -27,6 +27,151 @@
#include <glib-object.h>
#include <pango/pango.h>
+/* pango plays remove and oops don't remove with PangoFontClass so add our own fallback [1]
+ * [1] https://gitlab.gnome.org/GNOME/pango/commit/db1e5dae6e355db792e75cdcca0b7845c89ac4a4 */
+
+#include <pango/pango-font.h>
+
+#ifndef PANGO_FONT_CLASS
+#define PANGO_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT, PangoFontClass))
+#define PANGO_IS_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT))
+#define PANGO_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT, PangoFontClass))
+
+typedef struct _PangoFontClass PangoFontClass;
+
+struct _PangoFontMetrics
+{
+ /* <private> */
+ guint ref_count;
+
+ int ascent;
+ int descent;
+ int height;
+ int approximate_char_width;
+ int approximate_digit_width;
+ int underline_position;
+ int underline_thickness;
+ int strikethrough_position;
+ int strikethrough_thickness;
+};
+
+struct _PangoFontClass
+{
+ GObjectClass parent_class;
+
+ /*< public >*/
+
+ PangoFontDescription *(*describe) (PangoFont *font);
+ PangoCoverage * (*get_coverage) (PangoFont *font,
+ PangoLanguage *language);
+ void (*get_glyph_extents) (PangoFont *font,
+ PangoGlyph glyph,
+ PangoRectangle *ink_rect,
+ PangoRectangle *logical_rect);
+ PangoFontMetrics * (*get_metrics) (PangoFont *font,
+ PangoLanguage *language);
+ PangoFontMap * (*get_font_map) (PangoFont *font);
+ PangoFontDescription *(*describe_absolute) (PangoFont *font);
+ void (*get_features) (PangoFont *font,
+ hb_feature_t *features,
+ guint len,
+ guint *num_features);
+ hb_font_t * (*create_hb_font) (PangoFont *font);
+};
+#endif /* PANGO_FONT_CLASS */
+
+
+#ifndef PANGO_FONT_FAMILY_CLASS
+#define PANGO_FONT_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass))
+#define PANGO_IS_FONT_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_FAMILY))
+#define PANGO_FONT_FAMILY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass))
+
+typedef struct _PangoFontFamily PangoFontFamily;
+typedef struct _PangoFontFamilyClass PangoFontFamilyClass;
+
+#ifndef PANGO_DISABLE_DEPRECATED
+
+/**
+ * PangoFontFamily:
+ *
+ * The #PangoFontFamily structure is used to represent a family of related
+ * font faces. The faces in a family share a common design, but differ in
+ * slant, weight, width and other aspects.
+ */
+struct _PangoFontFamily
+{
+ GObject parent_instance;
+};
+
+struct _PangoFontFamilyClass
+{
+ GObjectClass parent_class;
+
+ /*< public >*/
+
+ void (*list_faces) (PangoFontFamily *family,
+ PangoFontFace ***faces,
+ int *n_faces);
+ const char * (*get_name) (PangoFontFamily *family);
+ gboolean (*is_monospace) (PangoFontFamily *family);
+ gboolean (*is_variable) (PangoFontFamily *family);
+
+ /*< private >*/
+
+ /* Padding for future expansion */
+ void (*_pango_reserved2) (void);
+ void (*_pango_reserved3) (void);
+};
+
+#endif /* PANGO_DISABLE_DEPRECATED */
+#endif /* PANGO_FONT_FAMILY_CLASS */
+
+#ifndef PANGO_FONT_FACE_CLASS
+
+#define PANGO_FONT_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FACE, PangoFontFaceClass))
+#define PANGO_IS_FONT_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_FACE))
+#define PANGO_FONT_FACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FACE, PangoFontFaceClass))
+
+typedef struct _PangoFontFaceClass PangoFontFaceClass;
+
+#ifndef PANGO_DISABLE_DEPRECATED
+
+/**
+ * PangoFontFace:
+ *
+ * The #PangoFontFace structure is used to represent a group of fonts with
+ * the same family, slant, weight, width, but varying sizes.
+ */
+struct _PangoFontFace
+{
+ GObject parent_instance;
+};
+
+struct _PangoFontFaceClass
+{
+ GObjectClass parent_class;
+
+ /*< public >*/
+
+ const char * (*get_face_name) (PangoFontFace *face);
+ PangoFontDescription * (*describe) (PangoFontFace *face);
+ void (*list_sizes) (PangoFontFace *face,
+ int **sizes,
+ int *n_sizes);
+ gboolean (*is_synthesized) (PangoFontFace *face);
+
+ /*< private >*/
+
+ /* Padding for future expansion */
+ void (*_pango_reserved3) (void);
+ void (*_pango_reserved4) (void);
+};
+
+#endif /* PANGO_DISABLE_DEPRECATED */
+#endif /* PANGO_FONT_FACE_CLASS */
+
+/* end of pango fallback */
+
G_BEGIN_DECLS
#define PANGO_DEFINE_TYPE_FULL(name, prefix, \
diff --git a/pangox.c b/pangox.c
index 1a98fa5..1362c14 100644
--- a/pangox.c
+++ b/pangox.c
@@ -279,7 +279,9 @@ pango_x_font_class_init (PangoXFontClass *class)
font_class->describe = pango_x_font_describe;
font_class->get_coverage = pango_x_font_get_coverage;
+#ifndef PANGO_VERSION_1_44
font_class->find_shaper = pango_x_font_find_shaper;
+#endif
font_class->get_glyph_extents = pango_x_font_get_glyph_extents;
font_class->get_metrics = pango_x_font_get_metrics;
font_class->get_font_map = pango_x_font_get_font_map;
--
2.21.0

View File

@@ -6,5 +6,6 @@ inherit gnomebase pkgconfig
DEPENDS += "pango"
SRC_URI += "file://0001-Hack-to-build-with-recent-pango.patch"
SRC_URI[archive.md5sum] = "7bcbd0187f03e1e27af9a81e07249c33"
SRC_URI[archive.sha256sum] = "552092b3b6c23f47f4beee05495d0f9a153781f62a1c4b7ec53857a37dfce046"