diff options
author | bashi@chromium.org <bashi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-05 01:55:59 +0000 |
---|---|---|
committer | bashi@chromium.org <bashi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-05 01:55:59 +0000 |
commit | aaf2a32109d62ae6f96cc83263370a824ee85a6d (patch) | |
tree | ee8c96611be52917b3d2903244f21d846b29ab52 /third_party/harfbuzz-ng | |
parent | 19aeb1ff1ed2b9689f9a3ebd0dbdd386b9b8de78 (diff) | |
download | chromium_src-aaf2a32109d62ae6f96cc83263370a824ee85a6d.zip chromium_src-aaf2a32109d62ae6f96cc83263370a824ee85a6d.tar.gz chromium_src-aaf2a32109d62ae6f96cc83263370a824ee85a6d.tar.bz2 |
harfbuzz-ng roll
previous revision: 811eefe225d20b20f1de20c6e62a0ebd6d89102a
new revision: 431bef2e16c7888ca3960f5797432d3a20903550
BUG=158978
Review URL: https://chromiumcodereview.appspot.com/11367051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165892 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/harfbuzz-ng')
26 files changed, 705 insertions, 451 deletions
diff --git a/third_party/harfbuzz-ng/README.chromium b/third_party/harfbuzz-ng/README.chromium index 390ab3a..7e29086 100644 --- a/third_party/harfbuzz-ng/README.chromium +++ b/third_party/harfbuzz-ng/README.chromium @@ -2,8 +2,8 @@ Name: harfbuzz-ng Short Name: harfbuzz-ng URL: http://freedesktop.org/wiki/Software/HarfBuzz Version: unknown -Date: 20120910 -Revision: 811eefe225d20b20f1de20c6e62a0ebd6d89102a +Date: 20121102 +Revision: 431bef2e16c7888ca3960f5797432d3a20903550 Security Critical: yes License: MIT License File: NOT_SHIPPED diff --git a/third_party/harfbuzz-ng/harfbuzz.gyp b/third_party/harfbuzz-ng/harfbuzz.gyp index c586f90..aaf115b 100644 --- a/third_party/harfbuzz-ng/harfbuzz.gyp +++ b/third_party/harfbuzz-ng/harfbuzz.gyp @@ -85,6 +85,7 @@ 'src/hb-unicode-private.hh', 'src/hb-unicode.cc', 'src/hb-unicode.h', + 'src/hb-utf-private.hh', 'src/hb-version.h', 'src/hb-warning.cc', 'src/hb.h', diff --git a/third_party/harfbuzz-ng/src/hb-atomic-private.hh b/third_party/harfbuzz-ng/src/hb-atomic-private.hh index 4ae5b86..5861a71 100644 --- a/third_party/harfbuzz-ng/src/hb-atomic-private.hh +++ b/third_party/harfbuzz-ng/src/hb-atomic-private.hh @@ -85,19 +85,6 @@ typedef int hb_atomic_int_t; #define hb_atomic_ptr_get(P) (void *) (__sync_synchronize (), *(P)) #define hb_atomic_ptr_cmpexch(P,O,N) __sync_bool_compare_and_swap ((P), (O), (N)) -#elif !defined(HB_NO_MT) && defined(HAVE_GLIB) - -#include <glib.h> -typedef int hb_atomic_int_t; -#if GLIB_CHECK_VERSION(2,29,5) -#define hb_atomic_int_add(AI, V) g_atomic_int_add (&(AI), (V)) -#else -#define hb_atomic_int_add(AI, V) g_atomic_int_exchange_and_add (&(AI), (V)) -#endif - -#define hb_atomic_ptr_get(P) g_atomic_pointer_get (P) -#define hb_atomic_ptr_cmpexch(P,O,N) g_atomic_pointer_compare_and_exchange ((void **) (P), (void *) (O), (void *) (N)) - #elif !defined(HB_NO_MT) diff --git a/third_party/harfbuzz-ng/src/hb-buffer-private.hh b/third_party/harfbuzz-ng/src/hb-buffer-private.hh index f5d64f3f8..c1acffd 100644 --- a/third_party/harfbuzz-ng/src/hb-buffer-private.hh +++ b/third_party/harfbuzz-ng/src/hb-buffer-private.hh @@ -1,7 +1,7 @@ /* * Copyright © 1998-2004 David Turner and Werner Lemberg * Copyright © 2004,2007,2009,2010 Red Hat, Inc. - * Copyright © 2011 Google, Inc. + * Copyright © 2011,2012 Google, Inc. * * This is part of HarfBuzz, a text shaping library. * @@ -117,9 +117,18 @@ struct hb_buffer_t { inline hb_glyph_info_t prev (void) const { return info[out_len - 1]; } unsigned int serial; + + /* These reflect current allocations of the bytes in glyph_info_t's var1 and var2. */ uint8_t allocated_var_bytes[8]; const char *allocated_var_owner[8]; + /* Text before / after the main buffer contents. + * Always in Unicode, and ordered outward. + * Index 0 is for "pre-context", 1 for "post-context". */ + static const unsigned int CONTEXT_LENGTH = 5; + hb_codepoint_t context[2][CONTEXT_LENGTH]; + unsigned int context_len[2]; + /* Methods */ @@ -144,6 +153,7 @@ struct hb_buffer_t { HB_INTERNAL void guess_properties (void); HB_INTERNAL void swap_buffers (void); + HB_INTERNAL void remove_output (void); HB_INTERNAL void clear_output (void); HB_INTERNAL void clear_positions (void); @@ -206,6 +216,8 @@ struct hb_buffer_t { HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out); HB_INTERNAL void *get_scratch_buffer (unsigned int *size); + + inline void clear_context (unsigned int side) { context_len[side] = 0; } }; diff --git a/third_party/harfbuzz-ng/src/hb-buffer.cc b/third_party/harfbuzz-ng/src/hb-buffer.cc index fec9225..06b5c05 100644 --- a/third_party/harfbuzz-ng/src/hb-buffer.cc +++ b/third_party/harfbuzz-ng/src/hb-buffer.cc @@ -1,7 +1,7 @@ /* * Copyright © 1998-2004 David Turner and Werner Lemberg * Copyright © 2004,2007,2009,2010 Red Hat, Inc. - * Copyright © 2011 Google, Inc. + * Copyright © 2011,2012 Google, Inc. * * This is part of HarfBuzz, a text shaping library. * @@ -28,9 +28,7 @@ */ #include "hb-buffer-private.hh" - -#include <string.h> - +#include "hb-utf-private.hh" #ifndef HB_DEBUG_BUFFER @@ -73,7 +71,7 @@ hb_buffer_t::enlarge (unsigned int size) if (unlikely (_hb_unsigned_int_mul_overflows (size, sizeof (info[0])))) goto done; - while (size > new_allocated) + while (size >= new_allocated) new_allocated += (new_allocated >> 1) + 32; ASSERT_STATIC (sizeof (info[0]) == sizeof (pos[0])); @@ -160,6 +158,9 @@ hb_buffer_t::reset (void) serial = 0; memset (allocated_var_bytes, 0, sizeof allocated_var_bytes); memset (allocated_var_owner, 0, sizeof allocated_var_owner); + + memset (context, 0, sizeof context); + memset (context_len, 0, sizeof context_len); } void @@ -182,6 +183,19 @@ hb_buffer_t::add (hb_codepoint_t codepoint, } void +hb_buffer_t::remove_output (void) +{ + if (unlikely (hb_object_is_inert (this))) + return; + + have_output = false; + have_positions = false; + + out_len = 0; + out_info = info; +} + +void hb_buffer_t::clear_output (void) { if (unlikely (hb_object_is_inert (this))) @@ -572,6 +586,8 @@ hb_buffer_get_empty (void) true, /* in_error */ true, /* have_output */ true /* have_positions */ + + /* Zero is good enough for everything else. */ }; return const_cast<hb_buffer_t *> (&_hb_buffer_nil); @@ -725,6 +741,7 @@ hb_buffer_add (hb_buffer_t *buffer, unsigned int cluster) { buffer->add (codepoint, mask, cluster); + buffer->clear_context (1); } hb_bool_t @@ -745,6 +762,11 @@ hb_buffer_set_length (hb_buffer_t *buffer, } buffer->len = length; + + if (!length) + buffer->clear_context (0); + buffer->clear_context (1); + return true; } @@ -797,68 +819,70 @@ hb_buffer_guess_properties (hb_buffer_t *buffer) buffer->guess_properties (); } -#define ADD_UTF(T) \ - HB_STMT_START { \ - if (text_length == -1) { \ - text_length = 0; \ - const T *p = (const T *) text; \ - while (*p) { \ - text_length++; \ - p++; \ - } \ - } \ - if (item_length == -1) \ - item_length = text_length - item_offset; \ - buffer->ensure (buffer->len + item_length * sizeof (T) / 4); \ - const T *next = (const T *) text + item_offset; \ - const T *end = next + item_length; \ - while (next < end) { \ - hb_codepoint_t u; \ - const T *old_next = next; \ - next = UTF_NEXT (next, end, u); \ - hb_buffer_add (buffer, u, 1, old_next - (const T *) text); \ - } \ - } HB_STMT_END - - -#define UTF8_COMPUTE(Char, Mask, Len) \ - if (Char < 128) { Len = 1; Mask = 0x7f; } \ - else if ((Char & 0xe0) == 0xc0) { Len = 2; Mask = 0x1f; } \ - else if ((Char & 0xf0) == 0xe0) { Len = 3; Mask = 0x0f; } \ - else if ((Char & 0xf8) == 0xf0) { Len = 4; Mask = 0x07; } \ - else Len = 0; - -static inline const uint8_t * -hb_utf8_next (const uint8_t *text, - const uint8_t *end, - hb_codepoint_t *unicode) -{ - uint8_t c = *text; - unsigned int mask, len; - - /* TODO check for overlong sequences? */ - - UTF8_COMPUTE (c, mask, len); - if (unlikely (!len || (unsigned int) (end - text) < len)) { - *unicode = -1; - return text + 1; - } else { - hb_codepoint_t result; - unsigned int i; - result = c & mask; - for (i = 1; i < len; i++) - { - if (unlikely ((text[i] & 0xc0) != 0x80)) - { - *unicode = -1; - return text + 1; - } - result <<= 6; - result |= (text[i] & 0x3f); - } - *unicode = result; - return text + len; +template <typename T> +static inline void +hb_buffer_add_utf (hb_buffer_t *buffer, + const T *text, + int text_length, + unsigned int item_offset, + int item_length) +{ + assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE || + (!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID)); + + if (unlikely (hb_object_is_inert (buffer))) + return; + + if (text_length == -1) + text_length = hb_utf_strlen (text); + + if (item_length == -1) + item_length = text_length - item_offset; + + buffer->ensure (buffer->len + item_length * sizeof (T) / 4); + + /* If buffer is empty and pre-context provided, install it. + * This check is written this way, to make sure people can + * provide pre-context in one add_utf() call, then provide + * text in a follow-up call. See: + * + * https://bugzilla.mozilla.org/show_bug.cgi?id=801410#c13 + */ + if (!buffer->len && item_offset > 0) + { + /* Add pre-context */ + buffer->clear_context (0); + const T *prev = text + item_offset; + const T *start = text; + while (start < prev && buffer->context_len[0] < buffer->CONTEXT_LENGTH) + { + hb_codepoint_t u; + prev = hb_utf_prev (prev, start, &u); + buffer->context[0][buffer->context_len[0]++] = u; + } + } + + const T *next = text + item_offset; + const T *end = next + item_length; + while (next < end) + { + hb_codepoint_t u; + const T *old_next = next; + next = hb_utf_next (next, end, &u); + buffer->add (u, 1, old_next - (const T *) text); + } + + /* Add post-context */ + buffer->clear_context (1); + end = text + text_length; + while (next < end && buffer->context_len[1] < buffer->CONTEXT_LENGTH) + { + hb_codepoint_t u; + next = hb_utf_next (next, end, &u); + buffer->context[1][buffer->context_len[1]++] = u; } + + buffer->content_type = HB_BUFFER_CONTENT_TYPE_UNICODE; } void @@ -868,36 +892,7 @@ hb_buffer_add_utf8 (hb_buffer_t *buffer, unsigned int item_offset, int item_length) { - assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE || - (!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID)); - if (unlikely (hb_object_is_inert (buffer))) - return; - buffer->content_type = HB_BUFFER_CONTENT_TYPE_UNICODE; -#define UTF_NEXT(S, E, U) hb_utf8_next (S, E, &(U)) - ADD_UTF (uint8_t); -#undef UTF_NEXT -} - -static inline const uint16_t * -hb_utf16_next (const uint16_t *text, - const uint16_t *end, - hb_codepoint_t *unicode) -{ - uint16_t c = *text++; - - if (unlikely (c >= 0xd800 && c < 0xdc00)) { - /* high surrogate */ - uint16_t l; - if (text < end && ((l = *text), likely (l >= 0xdc00 && l < 0xe000))) { - /* low surrogate */ - *unicode = ((hb_codepoint_t) ((c) - 0xd800) * 0x400 + (l) - 0xdc00 + 0x10000); - text++; - } else - *unicode = -1; - } else - *unicode = c; - - return text; + hb_buffer_add_utf (buffer, (const uint8_t *) text, text_length, item_offset, item_length); } void @@ -907,14 +902,7 @@ hb_buffer_add_utf16 (hb_buffer_t *buffer, unsigned int item_offset, int item_length) { - assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE || - (!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID)); - if (unlikely (hb_object_is_inert (buffer))) - return; - buffer->content_type = HB_BUFFER_CONTENT_TYPE_UNICODE; -#define UTF_NEXT(S, E, U) hb_utf16_next (S, E, &(U)) - ADD_UTF (uint16_t); -#undef UTF_NEXT + hb_buffer_add_utf (buffer, text, text_length, item_offset, item_length); } void @@ -924,14 +912,7 @@ hb_buffer_add_utf32 (hb_buffer_t *buffer, unsigned int item_offset, int item_length) { - assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE || - (!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID)); - if (unlikely (hb_object_is_inert (buffer))) - return; - buffer->content_type = HB_BUFFER_CONTENT_TYPE_UNICODE; -#define UTF_NEXT(S, E, U) ((U) = *(S), (S)+1) - ADD_UTF (uint32_t); -#undef UTF_NEXT + hb_buffer_add_utf (buffer, text, text_length, item_offset, item_length); } @@ -994,7 +975,7 @@ void hb_buffer_normalize_glyphs (hb_buffer_t *buffer) { assert (buffer->have_positions); - /* XXX assert (buffer->have_glyphs); */ + assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS); bool backward = HB_DIRECTION_IS_BACKWARD (buffer->props.direction); diff --git a/third_party/harfbuzz-ng/src/hb-buffer.h b/third_party/harfbuzz-ng/src/hb-buffer.h index d89dce3c1..dc63d1b 100644 --- a/third_party/harfbuzz-ng/src/hb-buffer.h +++ b/third_party/harfbuzz-ng/src/hb-buffer.h @@ -1,7 +1,7 @@ /* * Copyright © 1998-2004 David Turner and Werner Lemberg * Copyright © 2004,2007,2009 Red Hat, Inc. - * Copyright © 2011 Google, Inc. + * Copyright © 2011,2012 Google, Inc. * * This is part of HarfBuzz, a text shaping library. * diff --git a/third_party/harfbuzz-ng/src/hb-fallback-shape-private.hh b/third_party/harfbuzz-ng/src/hb-fallback-shape-private.hh deleted file mode 100644 index 159456d..0000000 --- a/third_party/harfbuzz-ng/src/hb-fallback-shape-private.hh +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright © 2011 Google, Inc. - * - * This is part of HarfBuzz, a text shaping library. - * - * Permission is hereby granted, without written agreement and without - * license or royalty fees, to use, copy, modify, and distribute this - * software and its documentation for any purpose, provided that the - * above copyright notice and the following two paragraphs appear in - * all copies of this software. - * - * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN - * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - * - * Google Author(s): Behdad Esfahbod - */ - -#ifndef HB_FALLBACK_SHAPE_PRIVATE_HH -#define HB_FALLBACK_SHAPE_PRIVATE_HH - -#include "hb-private.hh" - -#include "hb-shape.h" - - -HB_BEGIN_DECLS - - -HB_INTERNAL hb_bool_t -_hb_fallback_shape (hb_font_t *font, - hb_buffer_t *buffer, - const hb_feature_t *features, - unsigned int num_features); - - -HB_END_DECLS - -#endif /* HB_FALLBACK_SHAPE_PRIVATE_HH */ diff --git a/third_party/harfbuzz-ng/src/hb-fallback-shape.cc b/third_party/harfbuzz-ng/src/hb-fallback-shape.cc index d7bde09..3f9024f 100644 --- a/third_party/harfbuzz-ng/src/hb-fallback-shape.cc +++ b/third_party/harfbuzz-ng/src/hb-fallback-shape.cc @@ -105,7 +105,7 @@ _hb_fallback_shape (hb_shape_plan_t *shape_plan, for (unsigned int i = 0; i < count; i++) { - if (buffer->unicode->is_zero_width (buffer->info[i].codepoint)) { + if (buffer->unicode->is_default_ignorable (buffer->info[i].codepoint)) { buffer->info[i].codepoint = space; buffer->pos[i].x_advance = 0; buffer->pos[i].y_advance = 0; diff --git a/third_party/harfbuzz-ng/src/hb-graphite2-private.hh b/third_party/harfbuzz-ng/src/hb-graphite2-private.hh deleted file mode 100644 index 644ea75..0000000 --- a/third_party/harfbuzz-ng/src/hb-graphite2-private.hh +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright © 2012 Google, Inc. - * - * This is part of HarfBuzz, a text shaping library. - * - * Permission is hereby granted, without written agreement and without - * license or royalty fees, to use, copy, modify, and distribute this - * software and its documentation for any purpose, provided that the - * above copyright notice and the following two paragraphs appear in - * all copies of this software. - * - * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN - * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - * - * Google Author(s): Behdad Esfahbod - */ - -#ifndef HB_GRAPHITE2_PRIVATE_HH -#define HB_GRAPHITE2_PRIVATE_HH - -#include "hb-private.hh" - -#include "hb-graphite2.h" - - -HB_INTERNAL hb_bool_t -_hb_graphite2_shape (hb_font_t *font, - hb_buffer_t *buffer, - const hb_feature_t *features, - unsigned int num_features); - - -#endif /* HB_GRAPHITE2_PRIVATE_HH */ diff --git a/third_party/harfbuzz-ng/src/hb-icu-le.cc b/third_party/harfbuzz-ng/src/hb-icu-le.cc index 68c9c42..d73752d 100644 --- a/third_party/harfbuzz-ng/src/hb-icu-le.cc +++ b/third_party/harfbuzz-ng/src/hb-icu-le.cc @@ -30,7 +30,7 @@ #include "hb-icu-le/PortableFontInstance.h" -#include "layout/LayoutEngine.h" +#include "layout/loengine.h" #include "unicode/unistr.h" #include "hb-icu.h" @@ -117,13 +117,13 @@ _hb_icu_le_shape (hb_shape_plan_t *shape_plan, le_int32 language_code = -1 /* TODO */; le_int32 typography_flags = 3; // essential for ligatures and kerning LEErrorCode status = LE_NO_ERROR; - LayoutEngine *le = LayoutEngine::layoutEngineFactory (font_instance, - script_code, - language_code, - typography_flags, - status); + le_engine *le = le_create ((const le_font *) font_instance, + script_code, + language_code, + typography_flags, + &status); if (status != LE_NO_ERROR) - { delete (le); return false; } + { le_close (le); return false; } retry: @@ -138,20 +138,22 @@ retry: ALLOCATE_ARRAY (LEUnicode, chars, buffer->len); ALLOCATE_ARRAY (unsigned int, clusters, buffer->len); + /* XXX Use UTF-16 decoder! */ for (unsigned int i = 0; i < buffer->len; i++) { chars[i] = buffer->info[i].codepoint; clusters[i] = buffer->info[i].cluster; } - unsigned int glyph_count = le->layoutChars(chars, + unsigned int glyph_count = le_layoutChars (le, + chars, 0, buffer->len, buffer->len, HB_DIRECTION_IS_BACKWARD (buffer->props.direction), 0., 0., - status); + &status); if (status != LE_NO_ERROR) - { delete (le); return false; } + { le_close (le); return false; } unsigned int num_glyphs = scratch_size / (sizeof (LEGlyphID) + sizeof (le_int32) + @@ -160,7 +162,7 @@ retry: if (unlikely (glyph_count >= num_glyphs || glyph_count > buffer->allocated)) { buffer->ensure (buffer->allocated * 2); if (buffer->in_error) - { delete (le); return false; } + { le_close (le); return false; } goto retry; } @@ -168,9 +170,9 @@ retry: ALLOCATE_ARRAY (le_int32, indices, glyph_count); ALLOCATE_ARRAY (float, positions, glyph_count * 2 + 2); - le->getGlyphs(glyphs, status); - le->getCharIndices(indices, status); - le->getGlyphPositions(positions, status); + le_getGlyphs (le, glyphs, &status); + le_getCharIndices (le, indices, &status); + le_getGlyphPositions (le, positions, &status); #undef ALLOCATE_ARRAY @@ -187,7 +189,7 @@ retry: info[j].codepoint = glyphs[i]; info[j].cluster = clusters[indices[i]]; - /* icu-le doesn't seem to have separapte advance values. */ + /* icu-le doesn't seem to have separate advance values. */ info[j].mask = positions[2 * i + 2] - positions[2 * i]; info[j].var1.u32 = 0; info[j].var2.u32 = -positions[2 * i + 1]; @@ -208,6 +210,6 @@ retry: pos->y_offset = info->var2.u32; } - delete (le); + le_close (le); return true; } diff --git a/third_party/harfbuzz-ng/src/hb-mutex-private.hh b/third_party/harfbuzz-ng/src/hb-mutex-private.hh index fc8ef49..5b3a17e 100644 --- a/third_party/harfbuzz-ng/src/hb-mutex-private.hh +++ b/third_party/harfbuzz-ng/src/hb-mutex-private.hh @@ -65,26 +65,6 @@ typedef pthread_mutex_t hb_mutex_impl_t; #define hb_mutex_impl_finish(M) pthread_mutex_destroy (M) -#elif !defined(HB_NO_MT) && defined(HAVE_GLIB) - -#include <glib.h> -#if !GLIB_CHECK_VERSION(2,32,0) -typedef GStaticMutex hb_mutex_impl_t; -#define HB_MUTEX_IMPL_INIT G_STATIC_MUTEX_INIT -#define hb_mutex_impl_init(M) g_static_mutex_init (M) -#define hb_mutex_impl_lock(M) g_static_mutex_lock (M) -#define hb_mutex_impl_unlock(M) g_static_mutex_unlock (M) -#define hb_mutex_impl_finish(M) g_static_mutex_free (M) -#else -typedef GMutex hb_mutex_impl_t; -#define HB_MUTEX_IMPL_INIT {0} -#define hb_mutex_impl_init(M) g_mutex_init (M) -#define hb_mutex_impl_lock(M) g_mutex_lock (M) -#define hb_mutex_impl_unlock(M) g_mutex_unlock (M) -#define hb_mutex_impl_finish(M) g_mutex_clear (M) -#endif - - #elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES) #if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_YIELD) diff --git a/third_party/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh b/third_party/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh index 90faa79..05b18cc 100644 --- a/third_party/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh +++ b/third_party/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh @@ -1343,6 +1343,7 @@ struct SubstLookup : Lookup else { /* in-place backward substitution */ + c->buffer->remove_output (); c->buffer->idx = c->buffer->len - 1; do { diff --git a/third_party/harfbuzz-ng/src/hb-ot-layout-gsubgpos-private.hh b/third_party/harfbuzz-ng/src/hb-ot-layout-gsubgpos-private.hh index da31bdf..dd7bdd3 100644 --- a/third_party/harfbuzz-ng/src/hb-ot-layout-gsubgpos-private.hh +++ b/third_party/harfbuzz-ng/src/hb-ot-layout-gsubgpos-private.hh @@ -459,7 +459,7 @@ static inline bool match_input (hb_apply_context_t *c, if (!skippy_iter.next (&property)) return TRACE_RETURN (false); - if (likely (!match_func (c->buffer->info[skippy_iter.idx].codepoint, input[i - 1], match_data))) return false; + if (likely (!match_func (c->buffer->info[skippy_iter.idx].codepoint, input[i - 1], match_data))) return TRACE_RETURN (false); unsigned int this_lig_id = get_lig_id (c->buffer->info[skippy_iter.idx]); unsigned int this_lig_comp = get_lig_comp (c->buffer->info[skippy_iter.idx]); @@ -491,7 +491,7 @@ static inline bool match_input (hb_apply_context_t *c, if (p_total_component_count) *p_total_component_count = total_component_count; - return true; + return TRACE_RETURN (true); } static inline void ligate_input (hb_apply_context_t *c, unsigned int count, /* Including the first glyph (not matched) */ @@ -655,9 +655,10 @@ static inline bool apply_lookup (hb_apply_context_t *c, const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */ apply_lookup_func_t apply_func) { + hb_auto_trace_t<HB_DEBUG_APPLY> trace (&c->debug_depth, "APPLY", NULL, HB_FUNC, "idx %d codepoint %u", c->buffer->idx, c->buffer->cur().codepoint); unsigned int end = c->buffer->len; if (unlikely (count == 0 || c->buffer->idx + count > end)) - return false; + return TRACE_RETURN (false); /* TODO We don't support lookupRecord arrays that are not increasing: * Should be easy for in_place ones at least. */ @@ -669,13 +670,13 @@ static inline bool apply_lookup (hb_apply_context_t *c, for (unsigned int i = 0; i < count; /* NOP */) { if (unlikely (c->buffer->idx == end)) - return true; + return TRACE_RETURN (true); while (c->should_mark_skip_current_glyph ()) { /* No lookup applied for this index */ c->buffer->next_glyph (); if (unlikely (c->buffer->idx == end)) - return true; + return TRACE_RETURN (true); } if (lookupCount && i == lookupRecord->sequenceIndex) @@ -690,7 +691,7 @@ static inline bool apply_lookup (hb_apply_context_t *c, /* Err, this is wrong if the lookup jumped over some glyphs */ i += c->buffer->idx - old_pos; if (unlikely (c->buffer->idx == end)) - return true; + return TRACE_RETURN (true); if (!done) goto not_applied; @@ -704,7 +705,7 @@ static inline bool apply_lookup (hb_apply_context_t *c, } } - return true; + return TRACE_RETURN (true); } diff --git a/third_party/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc b/third_party/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc index 56949dd..8428534 100644 --- a/third_party/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc +++ b/third_party/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc @@ -178,8 +178,9 @@ collect_features_arabic (hb_ot_shape_planner_t *plan) map->add_bool_feature (HB_TAG('c','a','l','t')); map->add_gsub_pause (NULL); - /* ArabicOT spec enables 'cswh' for Arabic where as for basic shaper it's disabled by default. */ map->add_bool_feature (HB_TAG('c','s','w','h')); + map->add_bool_feature (HB_TAG('d','l','i','g')); + map->add_bool_feature (HB_TAG('m','s','e','t')); } #include "hb-ot-shape-complex-arabic-fallback.hh" @@ -229,10 +230,23 @@ static void arabic_joining (hb_buffer_t *buffer) { unsigned int count = buffer->len; - unsigned int prev = 0, state = 0; + unsigned int prev = (unsigned int) -1, state = 0; HB_BUFFER_ALLOCATE_VAR (buffer, arabic_shaping_action); + /* Check pre-context */ + for (unsigned int i = 0; i < buffer->context_len[0]; i++) + { + unsigned int this_type = get_joining_type (buffer->context[0][i], buffer->unicode->general_category (buffer->context[0][i])); + + if (unlikely (this_type == JOINING_TYPE_T)) + continue; + + const arabic_state_table_entry *entry = &arabic_state_table[state][this_type]; + state = entry->next_state; + break; + } + for (unsigned int i = 0; i < count; i++) { unsigned int this_type = get_joining_type (buffer->info[i].codepoint, _hb_glyph_info_get_general_category (&buffer->info[i])); @@ -244,7 +258,7 @@ arabic_joining (hb_buffer_t *buffer) const arabic_state_table_entry *entry = &arabic_state_table[state][this_type]; - if (entry->prev_action != NONE) + if (entry->prev_action != NONE && prev != (unsigned int) -1) buffer->info[prev].arabic_shaping_action() = entry->prev_action; buffer->info[i].arabic_shaping_action() = entry->curr_action; @@ -253,6 +267,20 @@ arabic_joining (hb_buffer_t *buffer) state = entry->next_state; } + for (unsigned int i = 0; i < buffer->context_len[1]; i++) + { + unsigned int this_type = get_joining_type (buffer->context[1][i], buffer->unicode->general_category (buffer->context[0][i])); + + if (unlikely (this_type == JOINING_TYPE_T)) + continue; + + const arabic_state_table_entry *entry = &arabic_state_table[state][this_type]; + if (entry->prev_action != NONE && prev != (unsigned int) -1) + buffer->info[prev].arabic_shaping_action() = entry->prev_action; + break; + } + + HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action); } diff --git a/third_party/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh b/third_party/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh index 2e8f9b5..53f22e3 100644 --- a/third_party/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh +++ b/third_party/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh @@ -1,5 +1,5 @@ -#line 1 "hb-ot-shape-complex-indic-machine.rl" +#line 1 "../../src/hb-ot-shape-complex-indic-machine.rl" /* * Copyright © 2011,2012 Google, Inc. * @@ -32,7 +32,7 @@ #include "hb-private.hh" -#line 36 "hb-ot-shape-complex-indic-machine.hh.tmp" +#line 36 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp" static const unsigned char _indic_syllable_machine_trans_keys[] = { 1u, 16u, 13u, 13u, 5u, 7u, 5u, 7u, 7u, 7u, 5u, 7u, 5u, 7u, 7u, 7u, 5u, 7u, 5u, 7u, 7u, 7u, 5u, 7u, 5u, 7u, 7u, 7u, 4u, 4u, 6u, 6u, @@ -1125,11 +1125,11 @@ static const int indic_syllable_machine_error = -1; static const int indic_syllable_machine_en_main = 143; -#line 36 "hb-ot-shape-complex-indic-machine.rl" +#line 36 "../../src/hb-ot-shape-complex-indic-machine.rl" -#line 90 "hb-ot-shape-complex-indic-machine.rl" +#line 90 "../../src/hb-ot-shape-complex-indic-machine.rl" #define found_syllable(syllable_type) \ @@ -1149,7 +1149,7 @@ find_syllables (hb_buffer_t *buffer) int cs; hb_glyph_info_t *info = buffer->info; -#line 1153 "hb-ot-shape-complex-indic-machine.hh.tmp" +#line 1153 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp" { cs = indic_syllable_machine_start; ts = 0; @@ -1157,7 +1157,7 @@ find_syllables (hb_buffer_t *buffer) act = 0; } -#line 111 "hb-ot-shape-complex-indic-machine.rl" +#line 111 "../../src/hb-ot-shape-complex-indic-machine.rl" p = 0; @@ -1166,7 +1166,7 @@ find_syllables (hb_buffer_t *buffer) unsigned int last = 0; unsigned int syllable_serial = 1; -#line 1170 "hb-ot-shape-complex-indic-machine.hh.tmp" +#line 1170 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp" { int _slen; int _trans; @@ -1177,10 +1177,10 @@ find_syllables (hb_buffer_t *buffer) _resume: switch ( _indic_syllable_machine_from_state_actions[cs] ) { case 9: -#line 1 "hb-ot-shape-complex-indic-machine.rl" +#line 1 "../../src/hb-ot-shape-complex-indic-machine.rl" {ts = p;} break; -#line 1184 "hb-ot-shape-complex-indic-machine.hh.tmp" +#line 1184 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp" } _keys = _indic_syllable_machine_trans_keys + (cs<<1); @@ -1199,67 +1199,67 @@ _eof_trans: switch ( _indic_syllable_machine_trans_actions[_trans] ) { case 2: -#line 1 "hb-ot-shape-complex-indic-machine.rl" +#line 1 "../../src/hb-ot-shape-complex-indic-machine.rl" {te = p+1;} break; case 13: -#line 82 "hb-ot-shape-complex-indic-machine.rl" +#line 82 "../../src/hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (consonant_syllable); }} break; case 15: -#line 83 "hb-ot-shape-complex-indic-machine.rl" +#line 83 "../../src/hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (vowel_syllable); }} break; case 20: -#line 84 "hb-ot-shape-complex-indic-machine.rl" +#line 84 "../../src/hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (standalone_cluster); }} break; case 17: -#line 85 "hb-ot-shape-complex-indic-machine.rl" +#line 85 "../../src/hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (broken_cluster); }} break; case 10: -#line 86 "hb-ot-shape-complex-indic-machine.rl" +#line 86 "../../src/hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (non_indic_cluster); }} break; case 12: -#line 82 "hb-ot-shape-complex-indic-machine.rl" +#line 82 "../../src/hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (consonant_syllable); }} break; case 14: -#line 83 "hb-ot-shape-complex-indic-machine.rl" +#line 83 "../../src/hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (vowel_syllable); }} break; case 19: -#line 84 "hb-ot-shape-complex-indic-machine.rl" +#line 84 "../../src/hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (standalone_cluster); }} break; case 16: -#line 85 "hb-ot-shape-complex-indic-machine.rl" +#line 85 "../../src/hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (broken_cluster); }} break; case 18: -#line 86 "hb-ot-shape-complex-indic-machine.rl" +#line 86 "../../src/hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (non_indic_cluster); }} break; case 1: -#line 82 "hb-ot-shape-complex-indic-machine.rl" +#line 82 "../../src/hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (consonant_syllable); }} break; case 3: -#line 83 "hb-ot-shape-complex-indic-machine.rl" +#line 83 "../../src/hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (vowel_syllable); }} break; case 7: -#line 84 "hb-ot-shape-complex-indic-machine.rl" +#line 84 "../../src/hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (standalone_cluster); }} break; case 4: -#line 85 "hb-ot-shape-complex-indic-machine.rl" +#line 85 "../../src/hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (broken_cluster); }} break; case 5: -#line 1 "hb-ot-shape-complex-indic-machine.rl" +#line 1 "../../src/hb-ot-shape-complex-indic-machine.rl" { switch( act ) { case 4: {{p = ((te))-1;} found_syllable (broken_cluster); } @@ -1271,27 +1271,27 @@ _eof_trans: } break; case 6: -#line 1 "hb-ot-shape-complex-indic-machine.rl" +#line 1 "../../src/hb-ot-shape-complex-indic-machine.rl" {te = p+1;} -#line 85 "hb-ot-shape-complex-indic-machine.rl" +#line 85 "../../src/hb-ot-shape-complex-indic-machine.rl" {act = 4;} break; case 11: -#line 1 "hb-ot-shape-complex-indic-machine.rl" +#line 1 "../../src/hb-ot-shape-complex-indic-machine.rl" {te = p+1;} -#line 86 "hb-ot-shape-complex-indic-machine.rl" +#line 86 "../../src/hb-ot-shape-complex-indic-machine.rl" {act = 5;} break; -#line 1286 "hb-ot-shape-complex-indic-machine.hh.tmp" +#line 1286 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp" } _again: switch ( _indic_syllable_machine_to_state_actions[cs] ) { case 8: -#line 1 "hb-ot-shape-complex-indic-machine.rl" +#line 1 "../../src/hb-ot-shape-complex-indic-machine.rl" {ts = 0;} break; -#line 1295 "hb-ot-shape-complex-indic-machine.hh.tmp" +#line 1295 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp" } if ( ++p != pe ) @@ -1307,7 +1307,7 @@ _again: } -#line 120 "hb-ot-shape-complex-indic-machine.rl" +#line 120 "../../src/hb-ot-shape-complex-indic-machine.rl" } diff --git a/third_party/harfbuzz-ng/src/hb-ot-shape-complex-indic.cc b/third_party/harfbuzz-ng/src/hb-ot-shape-complex-indic.cc index 6a87c1e..30a9a1f 100644 --- a/third_party/harfbuzz-ng/src/hb-ot-shape-complex-indic.cc +++ b/third_party/harfbuzz-ng/src/hb-ot-shape-complex-indic.cc @@ -1157,21 +1157,28 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, */ unsigned int new_pos = base; - while (new_pos > start && - !(is_one_of (info[new_pos - 1], FLAG(OT_M) | HALANT_OR_COENG_FLAGS))) - new_pos--; - - /* In Khmer coeng model, a V,Ra can go *after* matras. If it goes after a - * split matra, it should be reordered to *before* the left part of such matra. */ - if (new_pos > start && info[new_pos - 1].indic_category() == OT_M) + /* Malayalam / Tamil do not have "half" forms or explicit virama forms. + * The glyphs formed by 'half' are Chillus or ligated explicit viramas. + * We want to position matra after them. + */ + if (buffer->props.script != HB_SCRIPT_MALAYALAM && buffer->props.script != HB_SCRIPT_TAMIL) { - unsigned int old_pos = i; - for (unsigned int i = base + 1; i < old_pos; i++) - if (info[i].indic_category() == OT_M) - { - new_pos--; - break; - } + while (new_pos > start && + !(is_one_of (info[new_pos - 1], FLAG(OT_M) | HALANT_OR_COENG_FLAGS))) + new_pos--; + + /* In Khmer coeng model, a V,Ra can go *after* matras. If it goes after a + * split matra, it should be reordered to *before* the left part of such matra. */ + if (new_pos > start && info[new_pos - 1].indic_category() == OT_M) + { + unsigned int old_pos = i; + for (unsigned int i = base + 1; i < old_pos; i++) + if (info[i].indic_category() == OT_M) + { + new_pos--; + break; + } + } } if (new_pos > start && is_halant_or_coeng (info[new_pos - 1])) diff --git a/third_party/harfbuzz-ng/src/hb-ot-shape-private.hh b/third_party/harfbuzz-ng/src/hb-ot-shape-private.hh index c4c368d..ae01215 100644 --- a/third_party/harfbuzz-ng/src/hb-ot-shape-private.hh +++ b/third_party/harfbuzz-ng/src/hb-ot-shape-private.hh @@ -85,7 +85,7 @@ inline void _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unicode) { info->unicode_props0() = ((unsigned int) unicode->general_category (info->codepoint)) | - (unicode->is_zero_width (info->codepoint) ? 0x80 : 0); + (unicode->is_default_ignorable (info->codepoint) ? 0x80 : 0); info->unicode_props1() = unicode->modified_combining_class (info->codepoint); } @@ -108,7 +108,7 @@ _hb_glyph_info_get_modified_combining_class (const hb_glyph_info_t *info) } inline hb_bool_t -_hb_glyph_info_is_zero_width (const hb_glyph_info_t *info) +_hb_glyph_info_is_default_ignorable (const hb_glyph_info_t *info) { return !!(info->unicode_props0() & 0x80); } diff --git a/third_party/harfbuzz-ng/src/hb-ot-shape.cc b/third_party/harfbuzz-ng/src/hb-ot-shape.cc index 9e44c5d..9a6260a 100644 --- a/third_party/harfbuzz-ng/src/hb-ot-shape.cc +++ b/third_party/harfbuzz-ng/src/hb-ot-shape.cc @@ -237,10 +237,8 @@ hb_set_unicode_props (hb_buffer_t *buffer) static void hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font) { - /* TODO One day, when we keep _before_ text for the buffer, take - * that into consideration. For now, insert dotted-circle if the - * very first character is a non-spacing mark. */ - if (_hb_glyph_info_get_general_category (&buffer->info[0]) != + if (buffer->context_len[0] || + _hb_glyph_info_get_general_category (&buffer->info[0]) != HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) return; @@ -521,7 +519,7 @@ hb_ot_hide_zerowidth (hb_ot_shape_context_t *c) unsigned int count = c->buffer->len; for (unsigned int i = 0; i < count; i++) if (unlikely (!is_a_ligature (c->buffer->info[i]) && - _hb_glyph_info_is_zero_width (&c->buffer->info[i]))) + _hb_glyph_info_is_default_ignorable (&c->buffer->info[i]))) { if (!space) { /* We assume that the space glyph is not gid0. */ @@ -591,7 +589,7 @@ hb_ot_map_glyphs_dumb (hb_font_t *font, { unsigned int count = buffer->len; for (unsigned int i = 0; i < count; i++) - font->get_glyph (buffer->cur().codepoint, 0, &buffer->cur().codepoint); + font->get_glyph (buffer->info[i].codepoint, 0, &buffer->info[i].codepoint); } void diff --git a/third_party/harfbuzz-ng/src/hb-private.hh b/third_party/harfbuzz-ng/src/hb-private.hh index 43b6e8a..42c0259 100644 --- a/third_party/harfbuzz-ng/src/hb-private.hh +++ b/third_party/harfbuzz-ng/src/hb-private.hh @@ -546,7 +546,7 @@ _hb_debug (unsigned int level, #define DEBUG_LEVEL(WHAT, LEVEL) (_hb_debug ((LEVEL), HB_DEBUG_##WHAT)) #define DEBUG(WHAT) (DEBUG_LEVEL (WHAT, 0)) -template <int max_level> inline void +template <int max_level> static inline void _hb_debug_msg_va (const char *what, const void *obj, const char *func, @@ -608,7 +608,7 @@ _hb_debug_msg_va<0> (const char *what HB_UNUSED, const char *message HB_UNUSED, va_list ap HB_UNUSED) {} -template <int max_level> inline void +template <int max_level> static inline void _hb_debug_msg (const char *what, const void *obj, const char *func, @@ -617,7 +617,7 @@ _hb_debug_msg (const char *what, int level_dir, const char *message, ...) HB_PRINTF_FUNC(7, 8); -template <int max_level> inline void +template <int max_level> static inline void _hb_debug_msg (const char *what, const void *obj, const char *func, diff --git a/third_party/harfbuzz-ng/src/hb-ucdn.cc b/third_party/harfbuzz-ng/src/hb-ucdn.cc new file mode 100644 index 0000000..3506304 --- /dev/null +++ b/third_party/harfbuzz-ng/src/hb-ucdn.cc @@ -0,0 +1,205 @@ +/* + * Copyright (C) 2012 Grigori Goronzy <greg@kinoho.net> + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "hb-private.hh" + +#include "hb-unicode-private.hh" + +#include "ucdn.h" + +static const hb_script_t ucdn_script_translate[] = +{ + HB_SCRIPT_COMMON, + HB_SCRIPT_LATIN, + HB_SCRIPT_GREEK, + HB_SCRIPT_CYRILLIC, + HB_SCRIPT_ARMENIAN, + HB_SCRIPT_HEBREW, + HB_SCRIPT_ARABIC, + HB_SCRIPT_SYRIAC, + HB_SCRIPT_THAANA, + HB_SCRIPT_DEVANAGARI, + HB_SCRIPT_BENGALI, + HB_SCRIPT_GURMUKHI, + HB_SCRIPT_GUJARATI, + HB_SCRIPT_ORIYA, + HB_SCRIPT_TAMIL, + HB_SCRIPT_TELUGU, + HB_SCRIPT_KANNADA, + HB_SCRIPT_MALAYALAM, + HB_SCRIPT_SINHALA, + HB_SCRIPT_THAI, + HB_SCRIPT_LAO, + HB_SCRIPT_TIBETAN, + HB_SCRIPT_MYANMAR, + HB_SCRIPT_GEORGIAN, + HB_SCRIPT_HANGUL, + HB_SCRIPT_ETHIOPIC, + HB_SCRIPT_CHEROKEE, + HB_SCRIPT_CANADIAN_ABORIGINAL, + HB_SCRIPT_OGHAM, + HB_SCRIPT_RUNIC, + HB_SCRIPT_KHMER, + HB_SCRIPT_MONGOLIAN, + HB_SCRIPT_HIRAGANA, + HB_SCRIPT_KATAKANA, + HB_SCRIPT_BOPOMOFO, + HB_SCRIPT_HAN, + HB_SCRIPT_YI, + HB_SCRIPT_OLD_ITALIC, + HB_SCRIPT_GOTHIC, + HB_SCRIPT_DESERET, + HB_SCRIPT_INHERITED, + HB_SCRIPT_TAGALOG, + HB_SCRIPT_HANUNOO, + HB_SCRIPT_BUHID, + HB_SCRIPT_TAGBANWA, + HB_SCRIPT_LIMBU, + HB_SCRIPT_TAI_LE, + HB_SCRIPT_LINEAR_B, + HB_SCRIPT_UGARITIC, + HB_SCRIPT_SHAVIAN, + HB_SCRIPT_OSMANYA, + HB_SCRIPT_CYPRIOT, + HB_SCRIPT_BRAILLE, + HB_SCRIPT_BUGINESE, + HB_SCRIPT_COPTIC, + HB_SCRIPT_NEW_TAI_LUE, + HB_SCRIPT_GLAGOLITIC, + HB_SCRIPT_TIFINAGH, + HB_SCRIPT_SYLOTI_NAGRI, + HB_SCRIPT_OLD_PERSIAN, + HB_SCRIPT_KHAROSHTHI, + HB_SCRIPT_BALINESE, + HB_SCRIPT_CUNEIFORM, + HB_SCRIPT_PHOENICIAN, + HB_SCRIPT_PHAGS_PA, + HB_SCRIPT_NKO, + HB_SCRIPT_SUNDANESE, + HB_SCRIPT_LEPCHA, + HB_SCRIPT_OL_CHIKI, + HB_SCRIPT_VAI, + HB_SCRIPT_SAURASHTRA, + HB_SCRIPT_KAYAH_LI, + HB_SCRIPT_REJANG, + HB_SCRIPT_LYCIAN, + HB_SCRIPT_CARIAN, + HB_SCRIPT_LYDIAN, + HB_SCRIPT_CHAM, + HB_SCRIPT_TAI_THAM, + HB_SCRIPT_TAI_VIET, + HB_SCRIPT_AVESTAN, + HB_SCRIPT_EGYPTIAN_HIEROGLYPHS, + HB_SCRIPT_SAMARITAN, + HB_SCRIPT_LISU, + HB_SCRIPT_BAMUM, + HB_SCRIPT_JAVANESE, + HB_SCRIPT_MEETEI_MAYEK, + HB_SCRIPT_IMPERIAL_ARAMAIC, + HB_SCRIPT_OLD_SOUTH_ARABIAN, + HB_SCRIPT_INSCRIPTIONAL_PARTHIAN, + HB_SCRIPT_INSCRIPTIONAL_PAHLAVI, + HB_SCRIPT_OLD_TURKIC, + HB_SCRIPT_KAITHI, + HB_SCRIPT_BATAK, + HB_SCRIPT_BRAHMI, + HB_SCRIPT_MANDAIC, + HB_SCRIPT_CHAKMA, + HB_SCRIPT_MEROITIC_CURSIVE, + HB_SCRIPT_MEROITIC_HIEROGLYPHS, + HB_SCRIPT_MIAO, + HB_SCRIPT_SHARADA, + HB_SCRIPT_SORA_SOMPENG, + HB_SCRIPT_TAKRI, + HB_SCRIPT_UNKNOWN, +}; + +static hb_unicode_combining_class_t +hb_ucdn_combining_class(hb_unicode_funcs_t *ufuncs, hb_codepoint_t unicode, + void *user_data) +{ + return (hb_unicode_combining_class_t) ucdn_get_combining_class(unicode); +} + +static unsigned int +hb_ucdn_eastasian_width(hb_unicode_funcs_t *ufuncs, hb_codepoint_t unicode, + void *user_data) +{ + int w = ucdn_get_east_asian_width(unicode); + return (w == UCDN_EAST_ASIAN_F || w == UCDN_EAST_ASIAN_W) ? 2 : 1; +} + +static hb_unicode_general_category_t +hb_ucdn_general_category(hb_unicode_funcs_t *ufuncs, + hb_codepoint_t unicode, void *user_data) +{ + return (hb_unicode_general_category_t)ucdn_get_general_category(unicode); +} + +static hb_codepoint_t +hb_ucdn_mirroring(hb_unicode_funcs_t *ufuncs, hb_codepoint_t unicode, + void *user_data) +{ + return ucdn_mirror(unicode); +} + +static hb_script_t +hb_ucdn_script(hb_unicode_funcs_t *ufuncs, hb_codepoint_t unicode, + void *user_data) +{ + return ucdn_script_translate[ucdn_get_script(unicode)]; +} + +static hb_bool_t +hb_ucdn_compose(hb_unicode_funcs_t *ufuncs, hb_codepoint_t a, + hb_codepoint_t b, hb_codepoint_t *ab, void *user_data) +{ + return ucdn_compose(ab, a, b); +} + +static hb_bool_t +hb_ucdn_decompose(hb_unicode_funcs_t *ufuncs, hb_codepoint_t ab, + hb_codepoint_t *a, hb_codepoint_t *b, void *user_data) +{ + return ucdn_decompose(ab, a, b); +} + +static unsigned int +hb_ucdn_decompose_compatibility(hb_unicode_funcs_t *ufuncs, hb_codepoint_t u, + hb_codepoint_t *decomposed, void *user_data) +{ + return ucdn_compat_decompose(u, decomposed); +} + +extern "C" HB_INTERNAL +hb_unicode_funcs_t * +hb_ucdn_get_unicode_funcs (void) +{ + static const hb_unicode_funcs_t _hb_ucdn_unicode_funcs = { + HB_OBJECT_HEADER_STATIC, + + NULL, /* parent */ + true, /* immutable */ + { +#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_ucdn_##name, + HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS +#undef HB_UNICODE_FUNC_IMPLEMENT + } + }; + + return const_cast<hb_unicode_funcs_t *> (&_hb_ucdn_unicode_funcs); +} + diff --git a/third_party/harfbuzz-ng/src/hb-unicode-private.hh b/third_party/harfbuzz-ng/src/hb-unicode-private.hh index 9f24a9f..7be4b04 100644 --- a/third_party/harfbuzz-ng/src/hb-unicode-private.hh +++ b/third_party/harfbuzz-ng/src/hb-unicode-private.hh @@ -119,47 +119,73 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE 0xE0100, 0xE01EF)); /* VARIATION SELECTOR-17..256 */ } - /* Zero-Width invisible characters: + /* Default_Ignorable codepoints: * - * 00AD SOFT HYPHEN - * 034F COMBINING GRAPHEME JOINER + * Note that as of Oct 2012 (Unicode 6.2), U+180E MONGOLIAN VOWEL SEPARATOR + * is NOT Default_Ignorable, but it really behaves in a way that it should + * be. That has been reported to the Unicode Technical Committee for + * consideration. As such, we include it here, since Uniscribe removes it. * - * 180E MONGOLIAN VOWEL SEPARATOR + * Gathered from: + * http://unicode.org/cldr/utility/list-unicodeset.jsp?a=[:DI:]&abb=on&ucd=on&esc=on * - * 200B ZERO WIDTH SPACE - * 200C ZERO WIDTH NON-JOINER - * 200D ZERO WIDTH JOINER - * 200E LEFT-TO-RIGHT MARK - * 200F RIGHT-TO-LEFT MARK + * Last updated to the page with the following versions: + * Version 3.6; ICU version: 50.0.1.0; Unicode version: 6.1.0.0 * - * 2028 LINE SEPARATOR + * 4,167 Code Points * - * 202A LEFT-TO-RIGHT EMBEDDING - * 202B RIGHT-TO-LEFT EMBEDDING - * 202C POP DIRECTIONAL FORMATTING - * 202D LEFT-TO-RIGHT OVERRIDE - * 202E RIGHT-TO-LEFT OVERRIDE + * [\u00AD\u034F\u115F\u1160\u17B4\u17B5\u180B-\u180D\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8\U0001D173-\U0001D17A\U000E0000-\U000E0FFF] * - * 2060 WORD JOINER - * 2061 FUNCTION APPLICATION - * 2062 INVISIBLE TIMES - * 2063 INVISIBLE SEPARATOR - * - * FEFF ZERO WIDTH NO-BREAK SPACE + * 00AD ;SOFT HYPHEN + * 034F ;COMBINING GRAPHEME JOINER + * 115F ;HANGUL CHOSEONG FILLER + * 1160 ;HANGUL JUNGSEONG FILLER + * 17B4 ;KHMER VOWEL INHERENT AQ + * 17B5 ;KHMER VOWEL INHERENT AA + * 180B..180D ;MONGOLIAN FREE VARIATION SELECTOR THREE + * 200B..200F ;RIGHT-TO-LEFT MARK + * 202A..202E ;RIGHT-TO-LEFT OVERRIDE + * 2060..206F ;NOMINAL DIGIT SHAPES + * 3164 ;HANGUL FILLER + * FE00..FE0F ;VARIATION SELECTOR-16 + * FEFF ;ZERO WIDTH NO-BREAK SPACE + * FFA0 ;HALFWIDTH HANGUL FILLER + * FFF0..FFF8 ;<unassigned-FFF8> + * 1D173..1D17A ;MUSICAL SYMBOL END PHRASE + * E0000..E0FFF ;<unassigned-E0FFF> */ inline hb_bool_t - is_zero_width (hb_codepoint_t ch) + is_default_ignorable (hb_codepoint_t ch) { - return ((ch & ~0x007F) == 0x2000 && (hb_in_ranges<hb_codepoint_t> (ch, - 0x200B, 0x200F, - 0x202A, 0x202E, - 0x2060, 0x2064) || - (ch == 0x2028))) || - unlikely (ch == 0x0009 || - ch == 0x00AD || - ch == 0x034F || - ch == 0x180E || - ch == 0xFEFF); + hb_codepoint_t plane = ch >> 16; + if (likely (plane == 0)) + { + /* BMP */ + hb_codepoint_t page = ch >> 8; + switch (page) { + case 0x00: return unlikely (ch == 0x00AD); + case 0x03: return unlikely (ch == 0x034F); + case 0x11: return hb_in_range<hb_codepoint_t> (ch, 0x115F, 0x1160); + case 0x17: return hb_in_range<hb_codepoint_t> (ch, 0x17B4, 0x17B5); + case 0x18: return hb_in_range<hb_codepoint_t> (ch, 0x180B, 0x180E); + case 0x20: return hb_in_ranges<hb_codepoint_t> (ch, 0x200B, 0x200F, + 0x202A, 0x202E, + 0x2060, 0x206F); + case 0x31: return unlikely (ch == 0x3164); + case 0xFE: return hb_in_range<hb_codepoint_t> (ch, 0xFE00, 0xFE0F) || ch == 0xFEFF; + case 0xFF: return hb_in_range<hb_codepoint_t> (ch, 0xFFF0, 0xFFF8) || ch == 0xFFA0; + default: return false; + } + } + else + { + /* Other planes */ + switch (plane) { + case 0x01: return hb_in_range<hb_codepoint_t> (ch, 0x0001D173, 0x0001D17A); + case 0x0E: return hb_in_range<hb_codepoint_t> (ch, 0x000E0000, 0x000E0FFF); + default: return false; + } + } } diff --git a/third_party/harfbuzz-ng/src/hb-unicode.cc b/third_party/harfbuzz-ng/src/hb-unicode.cc index 2e2d077..0a3907e 100644 --- a/third_party/harfbuzz-ng/src/hb-unicode.cc +++ b/third_party/harfbuzz-ng/src/hb-unicode.cc @@ -112,6 +112,7 @@ hb_unicode_decompose_compatibility_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED #define HB_UNICODE_FUNCS_IMPLEMENT_SET \ HB_UNICODE_FUNCS_IMPLEMENT (glib) \ HB_UNICODE_FUNCS_IMPLEMENT (icu) \ + HB_UNICODE_FUNCS_IMPLEMENT (ucdn) \ HB_UNICODE_FUNCS_IMPLEMENT (nil) \ /* ^--- Add new callbacks before nil */ @@ -134,6 +135,8 @@ hb_unicode_funcs_get_default (void) HB_UNICODE_FUNCS_IMPLEMENT(glib) #elif defined(HAVE_ICU) HB_UNICODE_FUNCS_IMPLEMENT(icu) +#elif defined(HAVE_UCDN) + HB_UNICODE_FUNCS_IMPLEMENT(ucdn) #else #define HB_UNICODE_FUNCS_NIL 1 HB_UNICODE_FUNCS_IMPLEMENT(nil) diff --git a/third_party/harfbuzz-ng/src/hb-uniscribe-private.hh b/third_party/harfbuzz-ng/src/hb-uniscribe-private.hh deleted file mode 100644 index 239ab0c..0000000 --- a/third_party/harfbuzz-ng/src/hb-uniscribe-private.hh +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright © 2012 Google, Inc. - * - * This is part of HarfBuzz, a text shaping library. - * - * Permission is hereby granted, without written agreement and without - * license or royalty fees, to use, copy, modify, and distribute this - * software and its documentation for any purpose, provided that the - * above copyright notice and the following two paragraphs appear in - * all copies of this software. - * - * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN - * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - * - * Google Author(s): Behdad Esfahbod - */ - -#ifndef HB_UNISCRIBE_PRIVATE_HH -#define HB_UNISCRIBE_PRIVATE_HH - -#include "hb-private.hh" - -#include "hb-uniscribe.h" - - -HB_INTERNAL hb_bool_t -_hb_uniscribe_shape (hb_font_t *font, - hb_buffer_t *buffer, - const hb_feature_t *features, - unsigned int num_features); - - -#endif /* HB_UNISCRIBE_PRIVATE_HH */ diff --git a/third_party/harfbuzz-ng/src/hb-utf-private.hh b/third_party/harfbuzz-ng/src/hb-utf-private.hh new file mode 100644 index 0000000..8cde827 --- /dev/null +++ b/third_party/harfbuzz-ng/src/hb-utf-private.hh @@ -0,0 +1,204 @@ +/* + * Copyright © 2011,2012 Google, Inc. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Google Author(s): Behdad Esfahbod + */ + +#ifndef HB_UTF_PRIVATE_HH +#define HB_UTF_PRIVATE_HH + +#include "hb-private.hh" + + +/* UTF-8 */ + +#define HB_UTF8_COMPUTE(Char, Mask, Len) \ + if (Char < 128) { Len = 1; Mask = 0x7f; } \ + else if ((Char & 0xe0) == 0xc0) { Len = 2; Mask = 0x1f; } \ + else if ((Char & 0xf0) == 0xe0) { Len = 3; Mask = 0x0f; } \ + else if ((Char & 0xf8) == 0xf0) { Len = 4; Mask = 0x07; } \ + else Len = 0; + +static inline const uint8_t * +hb_utf_next (const uint8_t *text, + const uint8_t *end, + hb_codepoint_t *unicode) +{ + hb_codepoint_t c = *text, mask; + unsigned int len; + + /* TODO check for overlong sequences? */ + + HB_UTF8_COMPUTE (c, mask, len); + if (unlikely (!len || (unsigned int) (end - text) < len)) { + *unicode = -1; + return text + 1; + } else { + hb_codepoint_t result; + unsigned int i; + result = c & mask; + for (i = 1; i < len; i++) + { + if (unlikely ((text[i] & 0xc0) != 0x80)) + { + *unicode = -1; + return text + 1; + } + result <<= 6; + result |= (text[i] & 0x3f); + } + *unicode = result; + return text + len; + } +} + +static inline const uint8_t * +hb_utf_prev (const uint8_t *text, + const uint8_t *start, + hb_codepoint_t *unicode) +{ + const uint8_t *end = text; + while (start < text && (*--text & 0xc0) == 0x80 && end - text < 4) + text--; + + hb_codepoint_t c = *text, mask; + unsigned int len; + + /* TODO check for overlong sequences? */ + + HB_UTF8_COMPUTE (c, mask, len); + if (unlikely (!len || (unsigned int) (end - text) != len)) { + *unicode = -1; + return end - 1; + } else { + hb_codepoint_t result; + unsigned int i; + result = c & mask; + for (i = 1; i < len; i++) + { + result <<= 6; + result |= (text[i] & 0x3f); + } + *unicode = result; + return text; + } +} + + +static inline unsigned int +hb_utf_strlen (const uint8_t *text) +{ + return strlen ((const char *) text); +} + + +/* UTF-16 */ + +static inline const uint16_t * +hb_utf_next (const uint16_t *text, + const uint16_t *end, + hb_codepoint_t *unicode) +{ + hb_codepoint_t c = *text++; + + if (unlikely (hb_in_range<hb_codepoint_t> (c, 0xd800, 0xdbff))) + { + /* high surrogate */ + hb_codepoint_t l; + if (text < end && ((l = *text), likely (hb_in_range<hb_codepoint_t> (l, 0xdc00, 0xdfff)))) + { + /* low surrogate */ + *unicode = (c << 10) + l - ((0xd800 << 10) - 0x10000 + 0xdc00); + text++; + } else + *unicode = -1; + } else + *unicode = c; + + return text; +} + +static inline const uint16_t * +hb_utf_prev (const uint16_t *text, + const uint16_t *start, + hb_codepoint_t *unicode) +{ + hb_codepoint_t c = *--text; + + if (unlikely (hb_in_range<hb_codepoint_t> (c, 0xdc00, 0xdfff))) + { + /* low surrogate */ + hb_codepoint_t h; + if (start < text && ((h = *(text - 1)), likely (hb_in_range<hb_codepoint_t> (h, 0xd800, 0xdbff)))) + { + /* high surrogate */ + *unicode = (h << 10) + c - ((0xd800 << 10) - 0x10000 + 0xdc00); + text--; + } else + *unicode = -1; + } else + *unicode = c; + + return text; +} + + +static inline unsigned int +hb_utf_strlen (const uint16_t *text) +{ + unsigned int l = 0; + while (*text++) l++; + return l; +} + + +/* UTF-32 */ + +static inline const uint32_t * +hb_utf_next (const uint32_t *text, + const uint32_t *end, + hb_codepoint_t *unicode) +{ + *unicode = *text++; + return text; +} + +static inline const uint32_t * +hb_utf_prev (const uint32_t *text, + const uint32_t *start, + hb_codepoint_t *unicode) +{ + *unicode = *--text; + return text; +} + +static inline unsigned int +hb_utf_strlen (const uint32_t *text) +{ + unsigned int l = 0; + while (*text++) l++; + return l; +} + + +#endif /* HB_UTF_PRIVATE_HH */ diff --git a/third_party/harfbuzz-ng/src/hb-version.h b/third_party/harfbuzz-ng/src/hb-version.h index e8ed88b..c5a4e62 100644 --- a/third_party/harfbuzz-ng/src/hb-version.h +++ b/third_party/harfbuzz-ng/src/hb-version.h @@ -38,9 +38,9 @@ HB_BEGIN_DECLS #define HB_VERSION_MAJOR 0 #define HB_VERSION_MINOR 9 -#define HB_VERSION_MICRO 4 +#define HB_VERSION_MICRO 5 -#define HB_VERSION_STRING "0.9.4" +#define HB_VERSION_STRING "0.9.5" #define HB_VERSION_CHECK(major,minor,micro) \ ((major)*10000+(minor)*100+(micro) >= \ diff --git a/third_party/harfbuzz-ng/src/indic.cc b/third_party/harfbuzz-ng/src/indic.cc deleted file mode 100644 index 991a772..0000000 --- a/third_party/harfbuzz-ng/src/indic.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright © 2012 Google, Inc. - * - * This is part of HarfBuzz, a text shaping library. - * - * Permission is hereby granted, without written agreement and without - * license or royalty fees, to use, copy, modify, and distribute this - * software and its documentation for any purpose, provided that the - * above copyright notice and the following two paragraphs appear in - * all copies of this software. - * - * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN - * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - * - * Google Author(s): Behdad Esfahbod - */ - -#include "hb-ot-shape-complex-indic-private.hh" - -int -main (void) -{ - hb_unicode_funcs_t *funcs = hb_unicode_funcs_get_default (); - - printf ("There are split matras without a Unicode decomposition:\n"); - for (hb_codepoint_t u = 0; u < 0x110000; u++) - { - unsigned int type = get_indic_categories (u); - - unsigned int category = type & 0x0F; - unsigned int position = type >> 4; - - hb_unicode_general_category_t cat = hb_unicode_general_category (funcs, u); - unsigned int ccc = hb_unicode_combining_class (funcs, u); - if (category == OT_M && ccc) - printf ("U+%04X %d\n", u, ccc); - -// hb_codepoint_t a, b; -// if (!hb_unicode_decompose (funcs, u, &a, &b)) -// printf ("U+%04X %x %x\n", u, category, position); - } -} |