changeset 26221:76ac35f71573

Fix regression in multi-line text rendering (bug #55218) * ft-text-renderer.cc (ft_text_renderer::compute_bbox, push_new_line): Make sure line spacing is an integer using math::round. (ft_text_renderer::process_character): Don't change the character y position when a pixel is expected to be out of boundaries.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Thu, 13 Dec 2018 16:11:50 +0100
parents f125a6ed45be
children 52a595c996bc
files libinterp/corefcn/ft-text-renderer.cc
diffstat 1 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/ft-text-renderer.cc	Wed Dec 12 21:45:14 2018 -0800
+++ b/libinterp/corefcn/ft-text-renderer.cc	Thu Dec 13 16:11:50 2018 +0100
@@ -589,7 +589,7 @@
           Matrix new_bbox = line_bbox.front ();
 
           xoffset = line_xoffset = compute_line_xoffset (new_bbox);
-          line_yoffset -= (-old_bbox(1) + 0.4 * m_max_fontsize
+          line_yoffset -= (-old_bbox(1) + math::round (0.4 * m_max_fontsize)
                            + (new_bbox(3) + new_bbox(1)));
           yoffset = 0;
           m_ymin = m_ymax = m_deltax = 0;
@@ -641,7 +641,7 @@
               bbox = lbox.extract (0, 0, 0, 3);
             else
               {
-                double delta = 0.4 * m_max_fontsize + lbox(3);
+                double delta = math::round (0.4 * m_max_fontsize) + lbox(3);
                 bbox(1) -= delta;
                 bbox(3) += delta;
                 bbox(2) = math::max (bbox(2), lbox(2));
@@ -779,9 +779,6 @@
                     if (x0 < 0)
                       x0 = 0;
 
-                    if (y0 < (static_cast<int> (bitmap.rows) - 1))
-                      y0 = bitmap.rows - 1;
-
                     for (int r = 0; static_cast<unsigned int> (r) < bitmap.rows; r++)
                       for (int c = 0; static_cast<unsigned int> (c) < bitmap.width; c++)
                         {