summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-08-24 19:25:31 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-08-25 00:17:24 -0400
commitdec273128a15821949011c66836db4f87c04a442 (patch)
treeff9b2b3dddde6beaeea4018ac34e37376fa18952
parentbd48e5894d95ab00961d3b7466b08ce1307a5b6d (diff)
downloadpango-dec273128a15821949011c66836db4f87c04a442.tar.gz
shape: Rearrange hb buffer setup
Rearrange the buffer setup code slightly, so that we can change it easier, later.
-rw-r--r--pango/shape.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/pango/shape.c b/pango/shape.c
index aeb9aa47..707534ed 100644
--- a/pango/shape.c
+++ b/pango/shape.c
@@ -392,18 +392,18 @@ pango_hb_shape (const char *item_text,
hb_buffer_set_flags (hb_buffer, hb_buffer_flags);
hb_buffer_set_invisible_glyph (hb_buffer, PANGO_GLYPH_EMPTY);
+ /* Add pre-context */
+ hb_buffer_add_utf8 (hb_buffer, paragraph_text, item_offset, item_offset, 0);
+
if (transform == PANGO_TEXT_TRANSFORM_NONE)
{
- hb_buffer_add_utf8 (hb_buffer, paragraph_text, paragraph_length, item_offset, item_length);
+ hb_buffer_add_utf8 (hb_buffer, paragraph_text, item_offset + item_length, item_offset, item_length);
}
else
{
const char *p;
int i;
- /* Add pre-context */
- hb_buffer_add_utf8 (hb_buffer, paragraph_text, item_offset, item_offset, 0);
-
/* Transform the item text according to text transform.
* Note: we assume text transforms won't cross font boundaries
*/
@@ -447,12 +447,11 @@ pango_hb_shape (const char *item_text,
else
hb_buffer_add (hb_buffer, ch, index);
}
-
- /* Add post-context */
- hb_buffer_add_utf8 (hb_buffer, paragraph_text + item_offset + item_length, paragraph_length - (item_offset + item_length),
- item_offset + item_length, 0);
}
+ /* Add post-context */
+ hb_buffer_add_utf8 (hb_buffer, paragraph_text, paragraph_length, item_offset + item_length, 0);
+
if (analysis->flags & PANGO_ANALYSIS_FLAG_NEED_HYPHEN)
{
/* Insert either a Unicode or ASCII hyphen. We may