[pango/line-breaking-fixes: 9/12] Handle break-after-space correctly
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/line-breaking-fixes: 9/12] Handle break-after-space correctly
- Date: Fri, 12 Nov 2021 20:15:12 +0000 (UTC)
commit afc19960c553f6616fc692e42705304d9e250c45
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Nov 12 13:55:22 2021 -0500
Handle break-after-space correctly
When we are breaking after a space, we should not
count the width of the space towards the line,
since we are zeroing it later.
pango/pango-layout.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index a8c0f757..3059d08f 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3752,7 +3752,11 @@ find_break_extra_width (PangoLayout *layout,
ParaBreakState *state,
int pos)
{
- /* Check whether to insert a hyphen */
+ /* Check whether to insert a hyphen,
+ * or whether we are breaking after one of those
+ * characters that turn into a hyphen,
+ * or after a space.
+ */
if (layout->log_attrs[state->start_offset + pos].break_inserts_hyphen)
{
ensure_hyphen_width (state);
@@ -3762,6 +3766,11 @@ find_break_extra_width (PangoLayout *layout,
else
return state->hyphen_width;
}
+ else if (state->start_offset + pos > 0 &&
+ layout->log_attrs[state->start_offset + pos - 1].is_white)
+ {
+ return - state->log_widths[state->log_widths_offset + pos - 1];
+ }
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]