summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2015-08-18 18:47:02 +0100
committerBehdad Esfahbod <behdad@behdad.org>2015-08-18 18:47:02 +0100
commit75504a50488a6aac0b9789f728fb5b87e641d4c3 (patch)
tree9fbe732d706869bd6f976dc28e1c1356fdfe4815
parente47b772a56af44a9a4f9ec907ee2091b725b94c1 (diff)
downloadharfbuzz-75504a50488a6aac0b9789f728fb5b87e641d4c3.tar.gz
Allow serializing buffer with output-buffer being used
Ie, don't call get_positions() if positions are not requested for serialization.
-rw-r--r--src/hb-buffer-serialize.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/hb-buffer-serialize.cc b/src/hb-buffer-serialize.cc
index 406d69db..8a22224a 100644
--- a/src/hb-buffer-serialize.cc
+++ b/src/hb-buffer-serialize.cc
@@ -99,7 +99,8 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer,
hb_buffer_serialize_flags_t flags)
{
hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, NULL);
- hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer, NULL);
+ hb_glyph_position_t *pos = (flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS) ?
+ NULL : hb_buffer_get_glyph_positions (buffer, NULL);
*buf_consumed = 0;
for (unsigned int i = start; i < end; i++)
@@ -172,7 +173,8 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer,
hb_buffer_serialize_flags_t flags)
{
hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, NULL);
- hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer, NULL);
+ hb_glyph_position_t *pos = (flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS) ?
+ NULL : hb_buffer_get_glyph_positions (buffer, NULL);
*buf_consumed = 0;
for (unsigned int i = start; i < end; i++)