TODO | 4 +- src/Makefile.am | 3 + src/hb-blob.cc | 2 - src/hb-open-type-private.hh | 8 ++--- src/hb-ot-head-private.hh | 1 src/hb-ot-layout.cc | 1 src/hb-ot-map-private.hh | 7 ++++ src/hb-ot-maxp-private.hh | 68 ++++++++++++++++++++++++++++++++++++++++++++ src/hb-ot-shape-private.hh | 2 + src/hb-ot-shape.cc | 2 + src/hb-private.hh | 10 +++++- src/hb-unicode.cc | 6 --- test/test-unicode.c | 6 +++ 13 files changed, 105 insertions(+), 15 deletions(-)
New commits: commit 4101ca7dbbdf1438fa116fb8cad935501ac7cca8 Author: Behdad Esfahbod <[email protected]> Date: Wed May 11 14:30:56 2011 -0400 Plug more leaks All good now. diff --git a/src/hb-blob.cc b/src/hb-blob.cc index cdb7496..17ff339 100644 --- a/src/hb-blob.cc +++ b/src/hb-blob.cc @@ -126,7 +126,7 @@ hb_blob_create_sub_blob (hb_blob_t *parent, { hb_blob_t *blob; - if (!length || offset >= parent->length || !(blob = hb_object_create<hb_blob_t> ())) + if (!length || offset >= parent->length) return &_hb_blob_nil; hb_blob_make_immutable (parent); diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index e16eddd..4aa47ec 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -191,8 +191,8 @@ struct hb_sanitize_context_t inline void setup (void) { - this->start = hb_blob_get_data (blob, NULL); - this->end = this->start + hb_blob_get_length (blob); + this->start = hb_blob_get_data (this->blob, NULL); + this->end = this->start + hb_blob_get_length (this->blob); this->edit_count = 0; this->debug_depth = 0; @@ -321,10 +321,8 @@ struct Sanitizer sane = false; } } - c->finish (); } else { unsigned int edit_count = c->edit_count; - c->finish (); if (edit_count && !c->writable) { c->start = hb_blob_get_data_writable (blob, NULL); c->end = c->start + hb_blob_get_length (blob); @@ -339,6 +337,8 @@ struct Sanitizer } } + c->finish (); + (void) (HB_DEBUG_SANITIZE && fprintf (stderr, "Sanitizer %p %s %s\n", blob, sane ? "passed" : "FAILED", HB_FUNC)); if (sane) commit 6a7ac79e26e85f6781186cf708a12825c0857324 Author: Behdad Esfahbod <[email protected]> Date: Wed May 11 14:19:18 2011 -0400 Plug leaks diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map-private.hh index 2a74138..02f5a91 100644 --- a/src/hb-ot-map-private.hh +++ b/src/hb-ot-map-private.hh @@ -120,6 +120,13 @@ struct hb_ot_map_t { hb_ot_layout_position_lookup (font, buffer, lookup_maps[1][i].index, lookup_maps[1][i].mask); } + inline void finish (void) { + feature_infos.finish (); + feature_maps.finish (); + lookup_maps[0].finish (); + lookup_maps[1].finish (); + } + private: hb_mask_t global_mask; diff --git a/src/hb-ot-shape-private.hh b/src/hb-ot-shape-private.hh index c0faf8c..b95815a 100644 --- a/src/hb-ot-shape-private.hh +++ b/src/hb-ot-shape-private.hh @@ -51,6 +51,8 @@ struct hb_ot_shape_plan_t { hb_ot_map_t map; hb_ot_complex_shaper_t shaper; + + inline void finish (void) { map.finish (); } }; diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 4f90027..aa5b920 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -381,6 +381,8 @@ hb_ot_shape (hb_font_t *font, hb_ot_shape_plan_internal (&plan, font->face, &buffer->props, features, num_features); hb_ot_shape_execute (&plan, font, buffer, features, num_features); + + plan.finish (); } diff --git a/src/hb-private.hh b/src/hb-private.hh index f22e0d2..215ef96 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -313,6 +313,14 @@ struct hb_prealloced_array_t { { return (const Type *) ::bsearch (key, array, len, sizeof (Type), (hb_compare_func_t) Type::cmp); } + + inline void finish (void) + { + if (array != static_array) + free (array); + array = NULL; + allocated = len = 0; + } }; template <typename Type> @@ -394,7 +402,7 @@ struct hb_lockable_set_t old.finish (); l.lock (); } - items.shrink (0); + items.finish (); l.unlock (); } commit 7aa12ebdff11a4ffbd04bf9b164586eb0c172e37 Author: Behdad Esfahbod <[email protected]> Date: Wed May 11 11:55:11 2011 -0400 [unicode] Simplify method setting diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc index 62cbcdc..943d7a7 100644 --- a/src/hb-unicode.cc +++ b/src/hb-unicode.cc @@ -206,14 +206,10 @@ hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t *ufuncs, \ ufuncs->get.name = func; \ ufuncs->user_data.name = user_data; \ ufuncs->destroy.name = destroy; \ - } else if (ufuncs->parent != NULL) { \ + } else { \ ufuncs->get.name = ufuncs->parent->get.name; \ ufuncs->user_data.name = ufuncs->parent->user_data.name; \ ufuncs->destroy.name = NULL; \ - } else { \ - ufuncs->get.name = hb_unicode_get_##name##_nil; \ - ufuncs->user_data.name = NULL; \ - ufuncs->destroy.name = NULL; \ } \ } \ \ diff --git a/test/test-unicode.c b/test/test-unicode.c index c730aed..f5aae10 100644 --- a/test/test-unicode.c +++ b/test/test-unicode.c @@ -482,6 +482,7 @@ test_unicode_properties (gconstpointer user_data) gboolean failed = TRUE; g_assert (hb_unicode_funcs_is_immutable (uf)); + g_assert (hb_unicode_funcs_get_parent (uf)); for (i = 0; i < G_N_ELEMENTS (properties); i++) { const property_t *p = &properties[i]; @@ -609,6 +610,9 @@ test_unicode_setters (void) g_assert_cmphex (p->getter (uf, 'a'), ==, HB_SCRIPT_LATIN); g_assert_cmphex (p->getter (uf, '0'), ==, HB_SCRIPT_UNKNOWN); + p->func_setter (uf, (get_func_t) NULL, NULL, NULL); + g_assert (data[0].freed && !data[1].freed); + g_assert (!hb_unicode_funcs_is_immutable (uf)); hb_unicode_funcs_make_immutable (uf); g_assert (hb_unicode_funcs_is_immutable (uf)); @@ -616,7 +620,7 @@ test_unicode_setters (void) /* Since uf is immutable now, the following setter should do nothing. */ p->func_setter (uf, (get_func_t) a_is_for_arabic_get_script, &data[1], free_up); - g_assert (!data[0].freed && !data[1].freed); + g_assert (data[0].freed && !data[1].freed); hb_unicode_funcs_destroy (uf); g_assert (data[0].freed && !data[1].freed); commit d5bfd0272130a315d3b5e6cdcf9b7e6395879204 Author: Behdad Esfahbod <[email protected]> Date: Wed May 11 11:48:28 2011 -0400 Minor diff --git a/src/Makefile.am b/src/Makefile.am index 6115d6e..1427340 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -66,7 +66,7 @@ HBHEADERS += \ hb-ot-tag.h \ $(NULL) -MAINTAINERCLEANFILES = \ +MAINTAINERCLEANFILES += \ $(srcdir)/hb-version.h \ $(NULL) commit 6a4e7e1372ef9fde81b84ecc9c4d1f23d97396c1 Author: Behdad Esfahbod <[email protected]> Date: Wed May 11 10:31:33 2011 -0400 Add maxp table Not used for anything right now. Will use to get num_glyphs in the future. diff --git a/src/Makefile.am b/src/Makefile.am index 73ac547..6115d6e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -25,6 +25,7 @@ HBSOURCES = \ hb-open-file-private.hh \ hb-open-type-private.hh \ hb-ot-head-private.hh \ + hb-ot-maxp-private.hh \ hb-private.hh \ hb-shape.cc \ hb-unicode-private.hh \ diff --git a/src/hb-ot-head-private.hh b/src/hb-ot-head-private.hh index 45015ca..436666f 100644 --- a/src/hb-ot-head-private.hh +++ b/src/hb-ot-head-private.hh @@ -50,7 +50,6 @@ struct head inline bool sanitize (hb_sanitize_context_t *c) { TRACE_SANITIZE (); - /* Shall we check for magicNumber here? Who cares? */ return c->check_struct (this) && likely (version.major == 1); } diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 4f26e11..8398bba 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -34,6 +34,7 @@ #include "hb-ot-layout-gsub-private.hh" #include "hb-ot-layout-gpos-private.hh" #include "hb-ot-head-private.hh" +#include "hb-ot-maxp-private.hh" #include <stdlib.h> diff --git a/src/hb-ot-maxp-private.hh b/src/hb-ot-maxp-private.hh new file mode 100644 index 0000000..fa2cb26 --- /dev/null +++ b/src/hb-ot-maxp-private.hh @@ -0,0 +1,68 @@ +/* + * 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_OT_MAXP_PRIVATE_HH +#define HB_OT_MAXP_PRIVATE_HH + +#include "hb-open-type-private.hh" + +HB_BEGIN_DECLS + + +/* + * maxp + */ + +#define HB_OT_TAG_maxp HB_TAG('m','a','x','p') + +struct maxp +{ + static const hb_tag_t Tag = HB_OT_TAG_maxp; + + inline unsigned int get_num_glyphs (void) const { + return numGlyphs; + } + + inline bool sanitize (hb_sanitize_context_t *c) { + TRACE_SANITIZE (); + return c->check_struct (this) && + likely (version.major == 1 || + (version.major == 0 && version.minor == 0x5000)); + } + + /* We only implement version 0.5 as none of the extra fields in version 1.0 are useful. */ + private: + FixedVersion version; /* Version of the maxp table (0.5 or 1.0), + * 0x00005000 or 0x00010000. */ + USHORT numGlyphs; /* The number of glyphs in the font. */ + public: + DEFINE_SIZE_STATIC (6); +}; + + +HB_END_DECLS + +#endif /* HB_OT_MAXP_PRIVATE_HH */ commit e0b0710ae52bcc8c6fbd87dfae83818faa5d5f5f Author: Behdad Esfahbod <[email protected]> Date: Wed May 11 08:58:21 2011 -0400 Minor diff --git a/TODO b/TODO index 298730f..16a2199 100644 --- a/TODO +++ b/TODO @@ -3,7 +3,9 @@ General fixes: - Instead of forming clusters immediately, only do it if we are reversing the text. We'd need a separate bit to indicate cluster start then. - Right now, BTW, for non-native direction runs, we get the cluster wrong... + +- Right now, BTW, for non-native direction runs, we get the cluster wrong... + Should do min(input-glyphs.cluster) - Fix tt kern on/off and GPOS interaction
_______________________________________________ HarfBuzz mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/harfbuzz
