[pango/soft-hyphen: 4/5] break: Mark breaks induced by soft hyphens
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/soft-hyphen: 4/5] break: Mark breaks induced by soft hyphens
- Date: Sun, 7 Jul 2019 02:29:34 +0000 (UTC)
commit 29450ef695de4a138173c85af07fcb31f52b3c2b
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jul 6 22:26:30 2019 -0400
break: Mark breaks induced by soft hyphens
Use a bit in PangoLogAttr to mark line breaks
that are due to soft hyphens; we want to insert
hyphens here later, if the break is taken.
pango/break.c | 7 ++++---
pango/pango-break.h | 5 ++++-
2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/pango/break.c b/pango/break.c
index 3f00f7d2..13ccbdaf 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -984,6 +984,7 @@ pango_default_break (const gchar *text,
attrs[i].is_char_break = FALSE;
attrs[i].is_line_break = FALSE;
attrs[i].is_mandatory_break = FALSE;
+ attrs[i].is_soft_hyphen = FALSE;
/* Rule LB1:
assign a line breaking class to each code point of the input. */
@@ -1369,9 +1370,9 @@ pango_default_break (const gchar *text,
case BREAK_ALREADY_HANDLED:
if (attrs[i].is_line_break)
{
- /* After Soft Hyphen or Hyphen-Minus */
- if (prev_wc == 0x00AD || prev_wc == 0x002D)
- attrs[i].is_hyphen = TRUE;
+ /* After Soft Hyphen */
+ if (prev_wc == 0x00AD)
+ attrs[i].is_soft_hyphen = TRUE;
}
break;
diff --git a/pango/pango-break.h b/pango/pango-break.h
index 0924eeab..66d81631 100644
--- a/pango/pango-break.h
+++ b/pango/pango-break.h
@@ -79,6 +79,9 @@ G_BEGIN_DECLS
* This flag implements Unicode's
* <ulink url="http://www.unicode.org/reports/tr29/">Word
* Boundaries</ulink> semantics. (Since: 1.22)
+ * @is_soft_hyphen: is a line break due to a Soft Hyphen (0x00AD).
+ * This indicates a position where a hyphen should be inserted
+ * if the break is taken.
*
* The #PangoLogAttr structure stores information
* about the attributes of a single character.
@@ -129,7 +132,7 @@ struct _PangoLogAttr
/* Word boundary as defined by UAX#29 */
guint is_word_boundary : 1; /* is NOT in the middle of a word */
- guint is_hyphen : 1; /* line break due to hyphen */
+ guint is_soft_hyphen : 1; /* line break due to a soft hyphen */
};
/* Determine information about cluster/word/line breaks in a string
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]