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

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Jan 1 22:33:32 PST 2014


 src/hb-fallback-shape.cc          |    5 +++--
 src/hb-font-private.hh            |    6 ++++++
 src/hb-ot-shape-complex-hangul.cc |   14 ++++++--------
 src/hb-ot-shape-normalize.cc      |    5 +++--
 src/hb-ot-shape.cc                |    3 +--
 5 files changed, 19 insertions(+), 14 deletions(-)

New commits:
commit 64426ec73a987bfe1e71a293ee195f268897e8d6
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Jan 2 14:33:10 2014 +0800

    [ot] Simplify composing
    
    Not tested.  Ouch.

diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index 9f3cd76..710536e 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -391,8 +391,9 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
         return;
       buffer->merge_out_clusters (starter, buffer->out_len);
       buffer->out_len--; /* Remove the second composable. */
-      buffer->out_info[starter].codepoint = composed; /* Modify starter and carry on. */
-      set_glyph (buffer->out_info[starter], font);
+      /* Modify starter and carry on. */
+      buffer->out_info[starter].codepoint = composed;
+      buffer->out_info[starter].glyph_index() = glyph;
       _hb_glyph_info_set_unicode_props (&buffer->out_info[starter], buffer->unicode);
 
       continue;
commit 8de20b1e8a1c4d2081f64e695045e6e4da7ce144
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Jan 2 14:30:45 2014 +0800

    Add font->has_glyph()

diff --git a/src/hb-font-private.hh b/src/hb-font-private.hh
index 431d047..33bbf71 100644
--- a/src/hb-font-private.hh
+++ b/src/hb-font-private.hh
@@ -144,6 +144,12 @@ struct hb_font_t {
 
   /* Public getters */
 
+  inline hb_bool_t has_glyph (hb_codepoint_t unicode)
+  {
+    hb_codepoint_t glyph;
+    return get_glyph (unicode, 0, &glyph);
+  }
+
   inline hb_bool_t get_glyph (hb_codepoint_t unicode, hb_codepoint_t variation_selector,
 			      hb_codepoint_t *glyph)
   {
diff --git a/src/hb-ot-shape-complex-hangul.cc b/src/hb-ot-shape-complex-hangul.cc
index 1d79c43..7353848 100644
--- a/src/hb-ot-shape-complex-hangul.cc
+++ b/src/hb-ot-shape-complex-hangul.cc
@@ -145,8 +145,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan,
 	if (len)
 	{
 	  hb_codepoint_t s = SBase + (l - LBase) * NCount + (v - VBase) * TCount + tindex;
-	  hb_codepoint_t glyph;
-	  if (font->get_glyph (s, 0, &glyph))
+	  if (font->has_glyph (s))
 	  {
 	    buffer->replace_glyphs (len, 1, &s);
 	    if (unlikely (buffer->in_error))
@@ -161,8 +160,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan,
     {
        /* Have <LV>, <LVT>, or <LV,T> */
       hb_codepoint_t s = u;
-      hb_codepoint_t glyph;
-      bool has_glyph = font->get_glyph (s, 0, &glyph);
+      bool has_glyph = font->has_glyph (s);
       unsigned int lindex = (s - SBase) / NCount;
       unsigned int nindex = (s - SBase) % NCount;
       unsigned int vindex = nindex / TCount;
@@ -175,7 +173,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan,
 	/* <LV,T>, try to combine. */
 	unsigned int new_tindex = buffer->cur(+1).codepoint - TBase;
 	hb_codepoint_t new_s = s + new_tindex;
-        if (font->get_glyph (new_s, 0, &glyph))
+        if (font->has_glyph (new_s))
 	{
 	  buffer->replace_glyphs (2, 1, &new_s);
 	  if (unlikely (buffer->in_error))
@@ -195,9 +193,9 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan,
 	hb_codepoint_t decomposed[3] = {LBase + lindex,
 					VBase + vindex,
 					TBase + tindex};
-        if (font->get_glyph (decomposed[0], 0, &glyph) &&
-	    font->get_glyph (decomposed[1], 0, &glyph) &&
-	    (!tindex || font->get_glyph (decomposed[2], 0, &glyph)))
+        if (font->has_glyph (decomposed[0]) &&
+	    font->has_glyph (decomposed[1]) &&
+	    (!tindex || font->has_glyph (decomposed[2])))
 	{
 	  buffer->replace_glyphs (1, tindex ? 3 : 2, decomposed);
 	  if (unlikely (buffer->in_error))
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index fcc61ae..3080a1d 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -238,8 +238,7 @@ hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font)
       HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
     return;
 
-  hb_codepoint_t dottedcircle_glyph;
-  if (!font->get_glyph (0x25CC, 0, &dottedcircle_glyph))
+  if (!font->has_glyph (0x25CC))
     return;
 
   hb_glyph_info_t dottedcircle;
commit f6298e55ae0f0f23f66935226f78afb98320ea78
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Jan 2 14:23:56 2014 +0800

    [fallback] Minor

diff --git a/src/hb-fallback-shape.cc b/src/hb-fallback-shape.cc
index b894a4a..ea54bb8 100644
--- a/src/hb-fallback-shape.cc
+++ b/src/hb-fallback-shape.cc
@@ -105,8 +105,9 @@ _hb_fallback_shape (hb_shape_plan_t    *shape_plan HB_UNUSED,
    * shaper which many people unfortunately still request.
    */
 
+  bool has_space;
   hb_codepoint_t space;
-  font->get_glyph (' ', 0, &space);
+  has_space = font->get_glyph (' ', 0, &space);
 
   buffer->clear_positions ();
 
@@ -114,7 +115,7 @@ _hb_fallback_shape (hb_shape_plan_t    *shape_plan HB_UNUSED,
 
   for (unsigned int i = 0; i < count; i++)
   {
-    if (buffer->unicode->is_default_ignorable (buffer->info[i].codepoint)) {
+    if (has_space && 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;


More information about the HarfBuzz mailing list