Differential D10958 Diff 26441 files/0003-Use-pango_font_metrics_get_height-to-calculate-font-height.patch
Changeset View
Changeset View
Standalone View
Standalone View
files/0003-Use-pango_font_metrics_get_height-to-calculate-font-height.patch
- This file was added.
| commit 163608d7fd861c2c4911a38f45be484c88626bdc | |||||
| Author: John Levon <levon@movementarian.org> | |||||
| Date: Mon Sep 7 17:53:31 2020 +0100 | |||||
| Use pango_font_metrics_get_height() to calculate font height (#2500) | |||||
| diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c | |||||
| index fac0c4e6..418bb4da 100644 | |||||
| --- a/src/fe-gtk/xtext.c | |||||
| +++ b/src/fe-gtk/xtext.c | |||||
| @@ -283,8 +283,24 @@ backend_font_open (GtkXText *xtext, char *name) | |||||
| metrics = pango_context_get_metrics (context, xtext->font->font, lang); | |||||
| xtext->font->ascent = pango_font_metrics_get_ascent (metrics) / PANGO_SCALE; | |||||
| xtext->font->descent = pango_font_metrics_get_descent (metrics) / PANGO_SCALE; | |||||
| + | |||||
| + /* | |||||
| + * In later versions of pango, a font's height should be calculated like | |||||
| + * this to account for line gap; a typical symptom of not doing so is | |||||
| + * cutting off the underscore on some fonts. | |||||
| + */ | |||||
| +#if PANGO_VERSION_CHECK(1, 44, 0) | |||||
| + xtext->fontsize = pango_font_metrics_get_height (metrics) / PANGO_SCALE + 1; | |||||
| + | |||||
| + if (xtext->fontsize == 0) | |||||
| + xtext->fontsize = xtext->font->ascent + xtext->font->descent; | |||||
| +#else | |||||
| + xtext->fontsize = xtext->font->ascent + xtext->font->descent; | |||||
| +#endif | |||||
| + | |||||
| pango_font_metrics_unref (metrics); | |||||
| } | |||||
| + | |||||
| static int | |||||
| backend_get_text_width_emph (GtkXText *xtext, guchar *str, int len, int emphasis) | |||||
| { | |||||
| @@ -3479,8 +3495,6 @@ gtk_xtext_set_font (GtkXText *xtext, char *name) | |||||
| if (xtext->font == NULL) | |||||
| return FALSE; | |||||
| - xtext->fontsize = xtext->font->ascent + xtext->font->descent; | |||||
| - | |||||
| { | |||||
| char *time_str; | |||||
| int stamp_size = xtext_get_stamp_str (time(0), &time_str); | |||||
Copyright © 2015-2021 Solus Project. The Solus logo is Copyright © 2016-2021 Solus Project. All Rights Reserved.