From bcba8b45024e1eca8be77ca2657de1dc44dbf8fb Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 16 Jul 2014 14:59:04 -0400 Subject: [PATCH] New API hb_buffer_add_codepoints() Like hb_buffer_add_utf32, but doesn't do any Unicode validation. This is like what hb_buffer_add_utf32 used to be until a couple commits ago. --- src/hb-buffer.cc | 32 +++++++++++++++++++++++++++----- src/hb-buffer.h | 8 ++++++++ 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index d92055223..242cded36 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -1290,7 +1290,7 @@ hb_buffer_guess_segment_properties (hb_buffer_t *buffer) buffer->guess_segment_properties (); } -template +template static inline void hb_buffer_add_utf (hb_buffer_t *buffer, const T *text, @@ -1298,7 +1298,7 @@ hb_buffer_add_utf (hb_buffer_t *buffer, unsigned int item_offset, int item_length) { - typedef hb_utf_t utf_t; + typedef hb_utf_t utf_t; assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE || (!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID)); @@ -1377,7 +1377,7 @@ hb_buffer_add_utf8 (hb_buffer_t *buffer, unsigned int item_offset, int item_length) { - hb_buffer_add_utf (buffer, (const uint8_t *) text, text_length, item_offset, item_length); + hb_buffer_add_utf (buffer, (const uint8_t *) text, text_length, item_offset, item_length); } /** @@ -1399,7 +1399,7 @@ hb_buffer_add_utf16 (hb_buffer_t *buffer, unsigned int item_offset, int item_length) { - hb_buffer_add_utf (buffer, text, text_length, item_offset, item_length); + hb_buffer_add_utf (buffer, text, text_length, item_offset, item_length); } /** @@ -1421,7 +1421,29 @@ hb_buffer_add_utf32 (hb_buffer_t *buffer, unsigned int item_offset, int item_length) { - hb_buffer_add_utf (buffer, text, text_length, item_offset, item_length); + hb_buffer_add_utf (buffer, text, text_length, item_offset, item_length); +} + +/** + * hb_buffer_add_codepoints: + * @buffer: a buffer. + * @text: (array length=text_length): + * @text_length: + * @item_offset: + * @item_length: + * + * + * + * Since: 1.0 + **/ +void +hb_buffer_add_codepoints (hb_buffer_t *buffer, + const hb_codepoint_t *text, + int text_length, + unsigned int item_offset, + int item_length) +{ + hb_buffer_add_utf (buffer, text, text_length, item_offset, item_length); } diff --git a/src/hb-buffer.h b/src/hb-buffer.h index 3086851b0..777c3d980 100644 --- a/src/hb-buffer.h +++ b/src/hb-buffer.h @@ -240,6 +240,14 @@ hb_buffer_add_utf32 (hb_buffer_t *buffer, unsigned int item_offset, int item_length); +/* Like add_utf32 but does NOT check for invalid Unicode codepoints. */ +void +hb_buffer_add_codepoints (hb_buffer_t *buffer, + const hb_codepoint_t *text, + int text_length, + unsigned int item_offset, + int item_length); + /* Clears any new items added at the end */ hb_bool_t