Update bundled HarfBuzz to 0.9.39

No significant changes, just stick to a released version.

Change-Id: Ib9c4ce6f7da07727e890a4ac3265fc4574e89821
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
Konstantin Ritt 2015-02-09 17:15:29 +04:00
parent bdf43cac03
commit 01203a94b5
7 changed files with 90 additions and 30 deletions

View File

@ -1328,15 +1328,15 @@ hb_buffer_guess_segment_properties (hb_buffer_t *buffer)
buffer->guess_segment_properties (); buffer->guess_segment_properties ();
} }
template <bool validate, typename T> template <typename utf_t>
static inline void static inline void
hb_buffer_add_utf (hb_buffer_t *buffer, hb_buffer_add_utf (hb_buffer_t *buffer,
const T *text, const typename utf_t::codepoint_t *text,
int text_length, int text_length,
unsigned int item_offset, unsigned int item_offset,
int item_length) int item_length)
{ {
typedef hb_utf_t<T, true> utf_t; typedef typename utf_t::codepoint_t T;
const hb_codepoint_t replacement = buffer->replacement; const hb_codepoint_t replacement = buffer->replacement;
assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE || assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE ||
@ -1416,7 +1416,7 @@ hb_buffer_add_utf8 (hb_buffer_t *buffer,
unsigned int item_offset, unsigned int item_offset,
int item_length) int item_length)
{ {
hb_buffer_add_utf<true> (buffer, (const uint8_t *) text, text_length, item_offset, item_length); hb_buffer_add_utf<hb_utf8_t> (buffer, (const uint8_t *) text, text_length, item_offset, item_length);
} }
/** /**
@ -1438,7 +1438,7 @@ hb_buffer_add_utf16 (hb_buffer_t *buffer,
unsigned int item_offset, unsigned int item_offset,
int item_length) int item_length)
{ {
hb_buffer_add_utf<true> (buffer, text, text_length, item_offset, item_length); hb_buffer_add_utf<hb_utf16_t> (buffer, text, text_length, item_offset, item_length);
} }
/** /**
@ -1460,7 +1460,29 @@ hb_buffer_add_utf32 (hb_buffer_t *buffer,
unsigned int item_offset, unsigned int item_offset,
int item_length) int item_length)
{ {
hb_buffer_add_utf<true> (buffer, text, text_length, item_offset, item_length); hb_buffer_add_utf<hb_utf32_t<> > (buffer, text, text_length, item_offset, item_length);
}
/**
* hb_buffer_add_latin1:
* @buffer: a buffer.
* @text: (array length=text_length) (element-type uint8_t):
* @text_length:
* @item_offset:
* @item_length:
*
*
*
* Since: 1.0
**/
void
hb_buffer_add_latin1 (hb_buffer_t *buffer,
const uint8_t *text,
int text_length,
unsigned int item_offset,
int item_length)
{
hb_buffer_add_utf<hb_latin1_t> (buffer, text, text_length, item_offset, item_length);
} }
/** /**
@ -1482,7 +1504,7 @@ hb_buffer_add_codepoints (hb_buffer_t *buffer,
unsigned int item_offset, unsigned int item_offset,
int item_length) int item_length)
{ {
hb_buffer_add_utf<false> (buffer, text, text_length, item_offset, item_length); hb_buffer_add_utf<hb_utf32_t<false> > (buffer, text, text_length, item_offset, item_length);
} }

View File

@ -253,6 +253,14 @@ hb_buffer_add_utf32 (hb_buffer_t *buffer,
unsigned int item_offset, unsigned int item_offset,
int item_length); int item_length);
/* Allows only access to first 256 Unicode codepoints. */
void
hb_buffer_add_latin1 (hb_buffer_t *buffer,
const uint8_t *text,
int text_length,
unsigned int item_offset,
int item_length);
/* Like add_utf32 but does NOT check for invalid Unicode codepoints. */ /* Like add_utf32 but does NOT check for invalid Unicode codepoints. */
void void
hb_buffer_add_codepoints (hb_buffer_t *buffer, hb_buffer_add_codepoints (hb_buffer_t *buffer,

View File

@ -265,6 +265,7 @@ retry:
*lang = key; *lang = key;
if (!hb_atomic_ptr_cmpexch (&langs, first_lang, lang)) { if (!hb_atomic_ptr_cmpexch (&langs, first_lang, lang)) {
lang->finish ();
free (lang); free (lang);
goto retry; goto retry;
} }

View File

@ -197,16 +197,17 @@ static inline void
decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shortest) decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shortest)
{ {
hb_buffer_t * const buffer = c->buffer; hb_buffer_t * const buffer = c->buffer;
hb_codepoint_t u = buffer->cur().codepoint;
hb_codepoint_t glyph; hb_codepoint_t glyph;
/* Kind of a cute waterfall here... */ /* Kind of a cute waterfall here... */
if (shortest && c->font->get_glyph (buffer->cur().codepoint, 0, &glyph)) if (shortest && c->font->get_glyph (u, 0, &glyph))
next_char (buffer, glyph); next_char (buffer, glyph);
else if (decompose (c, shortest, buffer->cur().codepoint)) else if (decompose (c, shortest, u))
skip_char (buffer); skip_char (buffer);
else if (!shortest && c->font->get_glyph (buffer->cur().codepoint, 0, &glyph)) else if (!shortest && c->font->get_glyph (u, 0, &glyph))
next_char (buffer, glyph); next_char (buffer, glyph);
else if (decompose_compatibility (c, buffer->cur().codepoint)) else if (decompose_compatibility (c, u))
skip_char (buffer); skip_char (buffer);
else else
next_char (buffer, glyph); /* glyph is initialized in earlier branches. */ next_char (buffer, glyph); /* glyph is initialized in earlier branches. */

View File

@ -676,7 +676,7 @@ hb_ot_hide_default_ignorables (hb_ot_shape_context_t *c)
pos[i].y_advance = 0; pos[i].y_advance = 0;
} }
else else
continue; /* Delete it. */ continue; /* Delete it. XXX Merge clusters? */
} }
if (j != i) if (j != i)
{ {

View File

@ -79,10 +79,9 @@ struct hb_shaper_data_t {
HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (HB_SHAPER_DATA_TYPE (shaper, object) *data) HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (HB_SHAPER_DATA_TYPE (shaper, object) *data)
#define HB_SHAPER_DATA_DESTROY(shaper, object) \ #define HB_SHAPER_DATA_DESTROY(shaper, object) \
if (object->shaper_data.shaper && \ if (HB_SHAPER_DATA_TYPE (shaper, object) *data = HB_SHAPER_DATA (shaper, object)) \
object->shaper_data.shaper != HB_SHAPER_DATA_INVALID && \ if (data != HB_SHAPER_DATA_INVALID && data != HB_SHAPER_DATA_SUCCEEDED) \
object->shaper_data.shaper != HB_SHAPER_DATA_SUCCEEDED) \ HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data);
HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (HB_SHAPER_DATA (shaper, object));
#define HB_SHAPER_DATA_ENSURE_DECLARE(shaper, object) \ #define HB_SHAPER_DATA_ENSURE_DECLARE(shaper, object) \
static inline bool \ static inline bool \

View File

@ -29,14 +29,11 @@
#include "hb-private.hh" #include "hb-private.hh"
template <typename T, bool validate=true> struct hb_utf_t;
struct hb_utf8_t
/* UTF-8 */
template <>
struct hb_utf_t<uint8_t, true>
{ {
typedef uint8_t codepoint_t;
static inline const uint8_t * static inline const uint8_t *
next (const uint8_t *text, next (const uint8_t *text,
const uint8_t *end, const uint8_t *end,
@ -131,11 +128,10 @@ struct hb_utf_t<uint8_t, true>
}; };
/* UTF-16 */ struct hb_utf16_t
template <>
struct hb_utf_t<uint16_t, true>
{ {
typedef uint16_t codepoint_t;
static inline const uint16_t * static inline const uint16_t *
next (const uint16_t *text, next (const uint16_t *text,
const uint16_t *end, const uint16_t *end,
@ -204,11 +200,11 @@ struct hb_utf_t<uint16_t, true>
}; };
/* UTF-32 */ template <bool validate=true>
struct hb_utf32_t
template <bool validate>
struct hb_utf_t<uint32_t, validate>
{ {
typedef uint32_t codepoint_t;
static inline const uint32_t * static inline const uint32_t *
next (const uint32_t *text, next (const uint32_t *text,
const uint32_t *end HB_UNUSED, const uint32_t *end HB_UNUSED,
@ -246,4 +242,37 @@ struct hb_utf_t<uint32_t, validate>
}; };
struct hb_latin1_t
{
typedef uint8_t codepoint_t;
static inline const uint8_t *
next (const uint8_t *text,
const uint8_t *end HB_UNUSED,
hb_codepoint_t *unicode,
hb_codepoint_t replacement HB_UNUSED)
{
*unicode = *text++;
return text;
}
static inline const uint8_t *
prev (const uint8_t *text,
const uint8_t *start HB_UNUSED,
hb_codepoint_t *unicode,
hb_codepoint_t replacement)
{
*unicode = *--text;
return text;
}
static inline unsigned int
strlen (const uint8_t *text)
{
unsigned int l = 0;
while (*text++) l++;
return l;
}
};
#endif /* HB_UTF_PRIVATE_HH */ #endif /* HB_UTF_PRIVATE_HH */