summaryrefslogtreecommitdiff
path: root/pango/pangofc-shape.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2017-08-10 19:50:16 -0700
committerBehdad Esfahbod <behdad@behdad.org>2017-08-10 19:50:16 -0700
commitf0cb1dde12ab12411da2feb54025cf1fab306a68 (patch)
tree95ba754c993fe29cdfa2a7cc6c0d0fc11bc5ba13 /pango/pangofc-shape.c
parent49b9a1bf3ad4e5c8cf2b77fdb6bc4125784a30de (diff)
downloadpango-f0cb1dde12ab12411da2feb54025cf1fab306a68.tar.gz
Simplify hb_buffer_set_flags()
From a 2014 HarfBuzz commit: commit 763e5466c0a03a7c27020e1e2598e488612529a7 Author: Behdad Esfahbod <behdad@behdad.org> Date: Sat Aug 2 16:17:44 2014 -0400 Make it easier to use HB_BUFFER_FLAG_BOT/EOT Previously, we expected users to provide BOT/EOT flags when the text *segment* was at paragraph boundaries. This meant that for clients that provide full paragraph to HarfBuzz (eg. Pango), they had code like this: hb_buffer_set_flags (hb_buffer, (item_offset == 0 ? HB_BUFFER_FLAG_BOT : 0) | (item_offset + item_length == paragraph_length ? HB_BUFFER_FLAG_EOT : 0)); hb_buffer_add_utf8 (hb_buffer, paragraph_text, paragraph_length, item_offset, item_length); After this change such clients can simply say: hb_buffer_set_flags (hb_buffer, HB_BUFFER_FLAG_BOT | HB_BUFFER_FLAG_EOT); hb_buffer_add_utf8 (hb_buffer, paragraph_text, paragraph_length, item_offset, item_length); Ie, HarfBuzz itself checks whether the segment is at the beginning/end of the paragraph. Clients that only pass item-at-a-time to HarfBuzz continue not setting any flags whatsoever. Another way to put it is: if there's pre-context text in the buffer, HarfBuzz ignores the BOT flag. If there's post-context, it ignores EOT flag.
Diffstat (limited to 'pango/pangofc-shape.c')
-rw-r--r--pango/pangofc-shape.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/pango/pangofc-shape.c b/pango/pangofc-shape.c
index a18fa732..6ba7fb3b 100644
--- a/pango/pangofc-shape.c
+++ b/pango/pangofc-shape.c
@@ -346,9 +346,7 @@ _pango_fc_shape (PangoFont *font,
#if HB_VERSION_ATLEAST(1,0,3)
hb_buffer_set_cluster_level (hb_buffer, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS);
#endif
- hb_buffer_set_flags (hb_buffer,
- (item_offset == 0 ? HB_BUFFER_FLAG_BOT : 0) |
- (item_offset + item_length == paragraph_length ? HB_BUFFER_FLAG_EOT : 0));
+ hb_buffer_set_flags (hb_buffer, HB_BUFFER_FLAG_BOT | HB_BUFFER_FLAG_EOT);
hb_buffer_add_utf8 (hb_buffer, paragraph_text, paragraph_length, item_offset, item_length);