[HarfBuzz] harfbuzz-ng: Branch 'master' - 3 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Oct 26 08:28:30 PDT 2010


 src/hb-buffer-private.hh |   19 ++++++++++++++++---
 src/hb-buffer.cc         |   11 ++++++++++-
 src/hb-font.cc           |    2 +-
 src/hb-ot-shape.cc       |    6 ++++--
 4 files changed, 31 insertions(+), 7 deletions(-)

New commits:
commit ec6c0e54d322d58cbc835feb58dcec7ede6ab744
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Oct 26 11:28:14 2010 -0400

    Fix blob leak

diff --git a/src/hb-font.cc b/src/hb-font.cc
index ba8ab0d..bd55681 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -310,7 +310,7 @@ _hb_face_for_data_closure_create (hb_blob_t *blob, unsigned int index)
   if (unlikely (!closure))
     return NULL;
 
-  closure->blob = hb_blob_reference (blob);
+  closure->blob = blob;
   closure->index = index;
 
   return closure;
commit bd7378b2ef9793de4e7f57b920f29f48ac9d0c25
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Oct 13 18:33:16 2010 -0400

    Massage mask setting a bit more
    
    Still finding the exact correct way the masks should be set.

diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index 8154b17..585a82a 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -107,6 +107,10 @@ _hb_buffer_reset_masks (hb_buffer_t *buffer,
 
 HB_INTERNAL void
 _hb_buffer_add_masks (hb_buffer_t *buffer,
+		      hb_mask_t    mask);
+
+HB_INTERNAL void
+_hb_buffer_set_masks (hb_buffer_t *buffer,
 		      hb_mask_t    value,
 		      hb_mask_t    mask,
 		      unsigned int cluster_start,
@@ -165,12 +169,21 @@ struct _hb_buffer_t {
   { _hb_buffer_add_output_glyph (this, glyph_index, component, ligID); }
   inline void replace_glyph (hb_codepoint_t glyph_index) { add_output_glyph (glyph_index); }
 
-  inline void reset_masks (hb_mask_t mask) { _hb_buffer_reset_masks (this, mask); }
-  inline void add_masks (hb_mask_t value,
+  inline void reset_masks (hb_mask_t mask)
+  {
+    for (unsigned int i = 0; i < len; i++)
+      info[i].mask = mask;
+  }
+  inline void add_masks (hb_mask_t mask)
+  {
+    for (unsigned int i = 0; i < len; i++)
+      info[i].mask |= mask;
+  }
+  inline void set_masks (hb_mask_t value,
 			 hb_mask_t mask,
 			 unsigned int cluster_start,
 			 unsigned int cluster_end)
-  { _hb_buffer_add_masks (this, value, mask, cluster_start, cluster_end); }
+  { _hb_buffer_set_masks (this, value, mask, cluster_start, cluster_end); }
 
 };
 
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index c6bceeb..930f380 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -470,6 +470,15 @@ _hb_buffer_reset_masks (hb_buffer_t *buffer,
 
 void
 _hb_buffer_add_masks (hb_buffer_t *buffer,
+		      hb_mask_t    mask)
+{
+  unsigned int count = buffer->len;
+  for (unsigned int i = 0; i < count; i++)
+    buffer->info[i].mask |= mask;
+}
+
+void
+_hb_buffer_set_masks (hb_buffer_t *buffer,
 		      hb_mask_t    value,
 		      hb_mask_t    mask,
 		      unsigned int cluster_start,
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index ee5f796..7b4a451 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -88,13 +88,15 @@ hb_ot_shape_setup_masks (hb_ot_shape_context_t *c)
 
   hb_ot_shape_complex_setup_masks (c);
 
+  c->buffer->reset_masks (global_mask);
+
   for (unsigned int i = 0; i < c->num_user_features; i++)
   {
     const hb_feature_t *feature = &c->user_features[i];
     if (!(feature->start == 0 && feature->end == (unsigned int)-1)) {
       unsigned int shift;
       hb_mask_t mask = c->plan->map.get_mask (feature->tag, &shift);
-      c->buffer->add_masks (feature->value << shift, mask, feature->start, feature->end);
+      c->buffer->set_masks (feature->value << shift, mask, feature->start, feature->end);
     }
   }
 }
@@ -180,7 +182,7 @@ hb_mirror_chars (hb_ot_shape_context_t *c)
   for (unsigned int i = 0; i < count; i++) {
     hb_codepoint_t codepoint = get_mirroring (c->buffer->info[i].codepoint);
     if (likely (codepoint == c->buffer->info[i].codepoint))
-      c->buffer->info[i].mask |= rtlm_mask;
+      c->buffer->info[i].mask |= rtlm_mask; /* XXX this should be moved to before setting user-feature masks */
     else
       c->buffer->info[i].codepoint = codepoint;
   }
commit 961f9baa7bc3556f1e4e7135859cebe1351f73a4
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Oct 13 17:17:00 2010 -0400

    Oops, actually set global mask

diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 36a5e13..c6bceeb 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -465,7 +465,7 @@ _hb_buffer_reset_masks (hb_buffer_t *buffer,
 {
   unsigned int count = buffer->len;
   for (unsigned int i = 0; i < count; i++)
-    buffer->info[i].mask = 1;
+    buffer->info[i].mask = mask;
 }
 
 void



More information about the HarfBuzz mailing list