From 0a597bea667a00c2434c5429cc76e82b8c610c23 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 15 Sep 2023 16:46:07 -0600 Subject: [PATCH] rulers: fix subtle off-by-one pixel error caused by double-rounding This change also makes it more clear that we're computing window-coordinate system values for the x-axis than the previous inaccurate version was --- libs/canvas/ruler.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/canvas/ruler.cc b/libs/canvas/ruler.cc index 4d3aa72268..51154c17c0 100644 --- a/libs/canvas/ruler.cc +++ b/libs/canvas/ruler.cc @@ -167,7 +167,7 @@ Ruler::render (Rect const & area, Cairo::RefPtr cr) const Duple pos; Pango::FontDescription* fd = (m->style == Mark::Major) ? (_second_font_description ? _second_font_description : _font_description) : _font_description; - pos.x = round ((m->position - _lower) / _metric->units_per_pixel); + pos.x = round (m->position/_metric->units_per_pixel) + self.x0; pos.y = self.y1; /* bottom edge */ if (fd != last_font_description) {