From 9d001aaaf7e9c35a003236dbc69cfb3a870cf708 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Sat, 30 Jul 2022 15:05:28 +0200 Subject: [PATCH] [Theme] Do a pango version check. --- INSTALL.md | 2 +- doc/rofi-theme.5 | 8 ++++++++ doc/rofi-theme.5.markdown | 4 ++++ source/helper.c | 7 ++++++- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 429d86bf..f62ffbfc 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -24,7 +24,7 @@ You can also use [Meson](https://mesonbuild.com/) as an alternative. ### External libraries -* libpango +* libpango >= 1.50 * libpangocairo * libcairo * libcairo-xcb diff --git a/doc/rofi-theme.5 b/doc/rofi-theme.5 index 30ebfea3..f19cdf03 100644 --- a/doc/rofi-theme.5 +++ b/doc/rofi-theme.5 @@ -776,12 +776,20 @@ should be applied. \fB\fCunderline\fR: put a line under the text. .IP \(bu 2 \fB\fCstrikethrough\fR: put a line through the text. + +.RE + +.PP +The following options are available on pango 1.50.0 and up: + +.RS .IP \(bu 2 \fB\fCuppercase\fR: Uppercase the text. .IP \(bu 2 \fB\fClowercase\fR: Lowercase the text. .IP \(bu 2 \fB\fCcapitalize\fR: Capitalize the text. +This is currently disabled because of a Pango bug. .RE diff --git a/doc/rofi-theme.5.markdown b/doc/rofi-theme.5.markdown index 1a9716d3..acbd131d 100644 --- a/doc/rofi-theme.5.markdown +++ b/doc/rofi-theme.5.markdown @@ -500,9 +500,13 @@ should be applied. * `italic`: put the highlighted text in script type (slanted). * `underline`: put a line under the text. * `strikethrough`: put a line through the text. + +The following options are available on pango 1.50.0 and up: + * `uppercase`: Uppercase the text. * `lowercase`: Lowercase the text. * `capitalize`: Capitalize the text. + This is currently disabled because of a Pango bug. ## Line style diff --git a/source/helper.c b/source/helper.c index 2662b2b2..583d128c 100644 --- a/source/helper.c +++ b/source/helper.c @@ -424,6 +424,7 @@ void helper_token_match_set_pango_attr_on_style(PangoAttrList *retv, int start, pa->end_index = end; pango_attr_list_insert(retv, pa); } +#if PANGO_VERSION_CHECK(1, 50, 0) if (th.style & ROFI_HL_UPPERCASE) { PangoAttribute *pa = pango_attr_text_transform_new(PANGO_TEXT_TRANSFORM_UPPERCASE); @@ -439,12 +440,16 @@ void helper_token_match_set_pango_attr_on_style(PangoAttrList *retv, int start, pango_attr_list_insert(retv, pa); } if (th.style & ROFI_HL_CAPITALIZE) { +#if 0 PangoAttribute *pa = - pango_attr_text_transform_new(PANGO_TEXT_TRANSFORM_CAPITALIZE); + pango_attr_text_transform_new(PANGO_TEXT_TRANSFORM_CAPITALIZE); pa->start_index = start; pa->end_index = end; pango_attr_list_insert(retv, pa); +#endif + // Disabled because of bug in pango } +#endif if (th.style & ROFI_HL_UNDERLINE) { PangoAttribute *pa = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE); pa->start_index = start;