From: Matthew Fernandez Date: Tue, 5 Apr 2022 01:59:19 +0000 (-0700) Subject: LASi plugin: support newer Pango weights introduced ≥1.24 X-Git-Tag: 4.0.0~117^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=89edf3fe0ac0378b7d1297a0ca349a15bade3980;p=graphviz LASi plugin: support newer Pango weights introduced ≥1.24 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 --- 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 {