From 89edf3fe0ac0378b7d1297a0ca349a15bade3980 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Mon, 4 Apr 2022 18:59:19 -0700 Subject: [PATCH] =?utf8?q?LASi=20plugin:=20support=20newer=20Pango=20weigh?= =?utf8?q?ts=20introduced=20=E2=89=A51.24?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Squashes a number of compiler warnings that fail the upcoming CMake build of this plugin. The version checks and mapping logic was derived from the Pango docs¹ and the LASi.h header. ¹ https://docs.gtk.org/Pango/enum.Weight.html --- plugin/lasi/gvrender_lasi.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugin/lasi/gvrender_lasi.cpp b/plugin/lasi/gvrender_lasi.cpp index 319f9544e..e2ada4bef 100644 --- a/plugin/lasi/gvrender_lasi.cpp +++ b/plugin/lasi/gvrender_lasi.cpp @@ -361,13 +361,28 @@ static void lasi_textspan(GVJ_t * job, pointf p, textspan_t * span) case PANGO_VARIANT_SMALL_CAPS: variant = SMALLCAPS; break; } switch (pango_font_description_get_weight(pango_font)) { +#if PANGO_VERSION_CHECK(1, 24, 0) + case PANGO_WEIGHT_THIN: weight = ULTRALIGHT; break; // no exact match in LASi +#endif case PANGO_WEIGHT_ULTRALIGHT: weight = ULTRALIGHT; break; case PANGO_WEIGHT_LIGHT: weight = LIGHT; break; +#if PANGO_VERSION_CHECK(1, 36, 7) + case PANGO_WEIGHT_SEMILIGHT: weight = LIGHT; break; // no exact match in LASi +#endif +#if PANGO_VERSION_CHECK(1, 24, 0) + case PANGO_WEIGHT_BOOK: weight = NORMAL_WEIGHT; break; // no exact match in LASi +#endif case PANGO_WEIGHT_NORMAL: weight = NORMAL_WEIGHT; break; +#if PANGO_VERSION_CHECK(1, 24, 0) + case PANGO_WEIGHT_MEDIUM: weight = NORMAL_WEIGHT; break; // no exact match in LASi +#endif case PANGO_WEIGHT_SEMIBOLD: weight = BOLD; break; /* no exact match in lasi */ case PANGO_WEIGHT_BOLD: weight = BOLD; break; case PANGO_WEIGHT_ULTRABOLD: weight = ULTRABOLD; break; case PANGO_WEIGHT_HEAVY: weight = HEAVY; break; +#if PANGO_VERSION_CHECK(1, 24, 0) + case PANGO_WEIGHT_ULTRAHEAVY: weight = HEAVY; break; // no exact match in LASi +#endif } } else { -- 2.40.0