hasufell-repository/packages/app-editors/neovim-gtk/files/Try-to-fix-render-issues-due-to-changes-in-pango_1.4.patch

51 lines
2.3 KiB
Diff
Raw Normal View History

2021-01-06 22:20:24 +00:00
Upstream: yes
Reason: https://github.com/daa84/neovim-gtk/issues/208
From c1dbe9b9549383b22807a2de9c76094ca9204f51 Mon Sep 17 00:00:00 2001
From: daa <daa@localhost.localdomain>
Date: Tue, 26 Nov 2019 19:25:42 +0300
Subject: [PATCH] Try to fix render issues due to changes in pango_1.44 (#208)
---
src/render/context.rs | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/src/render/context.rs b/src/render/context.rs
index 8168296..0c19437 100644
--- a/src/render/context.rs
+++ b/src/render/context.rs
@@ -111,21 +111,19 @@ pub struct CellMetrics {
impl CellMetrics {
fn new(font_metrics: &pango::FontMetrics, line_space: i32) -> Self {
+ let ascent = (f64::from(font_metrics.get_ascent()) / f64::from(pango::SCALE)).ceil();
+ let descent = (f64::from(font_metrics.get_descent()) / f64::from(pango::SCALE)).ceil();
+ let underline_position = (f64::from(font_metrics.get_underline_position()) / f64::from(pango::SCALE)).ceil();
CellMetrics {
pango_ascent: font_metrics.get_ascent(),
pango_descent: font_metrics.get_descent(),
pango_char_width: font_metrics.get_approximate_digit_width(),
- ascent: f64::from(font_metrics.get_ascent()) / f64::from(pango::SCALE),
- line_height: f64::from(font_metrics.get_ascent() + font_metrics.get_descent())
- / f64::from(pango::SCALE)
- + f64::from(line_space),
- char_width: f64::from(font_metrics.get_approximate_digit_width())
- / f64::from(pango::SCALE),
- underline_position: f64::from(
- font_metrics.get_ascent() - font_metrics.get_underline_position(),
- ) / f64::from(pango::SCALE),
- underline_thickness: f64::from(font_metrics.get_underline_thickness())
- / f64::from(pango::SCALE),
+ ascent,
+ line_height: ascent + descent + f64::from(line_space),
+ char_width: (f64::from(font_metrics.get_approximate_digit_width())
+ / f64::from(pango::SCALE)).ceil(),
+ underline_position: ascent - underline_position,
+ underline_thickness: f64::from(font_metrics.get_underline_thickness()) / f64::from(pango::SCALE),
}
}
--
2.30.0