[pango/fix-hyphen-width: 1/2] layout: Fix a poblem with hyphen width




commit c03ca7de6c6001251684f7a3a071b38b3d35317e
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Nov 10 17:20:13 2021 -0500

    layout: Fix a poblem with hyphen width
    
    In some cases, we were forgetting to account
    for the width of a hyphen.

 pango/pango-layout.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 9e8ce248..1a460d4c 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3792,7 +3792,8 @@ find_break_extra_width (PangoLayout    *layout,
 
 #if 0
 # define DEBUG debug
-void
+static int pango_layout_line_get_width (PangoLayoutLine *line);
+static void
 debug (const char *where, PangoLayoutLine *line, ParaBreakState *state)
 {
   int line_width = pango_layout_line_get_width (line);
@@ -3919,10 +3920,10 @@ process_item (PangoLayout     *layout,
       extra_width = 0;
       for (num_chars = 0; num_chars < item->num_chars; num_chars++)
         {
+          extra_width = find_break_extra_width (layout, state, num_chars);
+
           if (width + extra_width > state->remaining_width && break_num_chars < item->num_chars)
-            {
-              break;
-            }
+            break;
 
           /* If there are no previous runs we have to take care to grab at least one char. */
           if (can_break_at (layout, state->start_offset + num_chars, retrying_with_char_breaks) &&
@@ -3931,11 +3932,7 @@ process_item (PangoLayout     *layout,
               break_num_chars = num_chars;
               break_width = width;
               break_extra_width = extra_width;
-
-              extra_width = find_break_extra_width (layout, state, num_chars);
             }
-          else
-            extra_width = 0;
 
           width += state->log_widths[state->log_widths_offset + num_chars];
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]