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

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon Aug 11 14:47:31 PDT 2014


 src/hb-coretext.cc |   34 +++++++++++++++++++++++++++-------
 1 file changed, 27 insertions(+), 7 deletions(-)

New commits:
commit 4acce77db7dd588ba277779c4997b0256ebe426e
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Aug 11 17:46:50 2014 -0400

    [coretext] Pass buffer direction to CoreText
    
    Have to use a CTTypesetter for this.

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 309e621..f4fa744 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -713,12 +713,28 @@ retry:
 					  kCTFontAttributeName, last_range->font);
       }
 
-      line = CTLineCreateWithAttributedString (attr_string);
+      int level = HB_DIRECTION_IS_FORWARD (buffer->props.direction) ? 0 : 1;
+      CFNumberRef level_number = CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &level);
+      CFDictionaryRef options = CFDictionaryCreate (kCFAllocatorDefault,
+						    (const void **) &kCTTypesetterOptionForcedEmbeddingLevel,
+						    (const void **) &level_number,
+						    1,
+						    &kCFTypeDictionaryKeyCallBacks,
+						    &kCFTypeDictionaryValueCallBacks);
+      if (unlikely (!options))
+        FAIL ("CFDictionaryCreate failed");
+
+      CTTypesetterRef typesetter = CTTypesetterCreateWithAttributedStringAndOptions (attr_string, options);
+      CFRelease (options);
       CFRelease (attr_string);
-    }
+      if (unlikely (!typesetter))
+	FAIL ("CTTypesetterCreateWithAttributedStringAndOptions failed");
 
-    if (unlikely (!line))
-      FAIL ("CFLineCreateWithAttributedString failed");
+      line = CTTypesetterCreateLine (typesetter, CFRangeMake(0, 0));
+      CFRelease (typesetter);
+      if (unlikely (!line))
+	FAIL ("CTTypesetterCreateLine failed");
+    }
 
     CFArrayRef glyph_runs = CTLineGetGlyphRuns (line);
     unsigned int num_runs = CFArrayGetCount (glyph_runs);
@@ -891,6 +907,8 @@ retry:
     }
   }
 
+#undef FAIL
+
 fail:
   if (string_ref)
     CFRelease (string_ref);
commit 5ec45dd37caa8a87ce2689a66272ba8a343fe6ba
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Aug 11 17:46:12 2014 -0400

    [coretext] Minor
    
    It's hard to handle all possible NULL returns from CoreText.  Add one
    more...

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 5469101..309e621 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -105,8 +105,11 @@ _hb_coretext_shaper_face_data_create (hb_face_t *face)
       DEBUG_MSG (CORETEXT, face, "Face has empty blob");
 
     CGDataProviderRef provider = CGDataProviderCreateWithData (blob, blob_data, blob_length, &release_data);
-    data = CGFontCreateWithDataProvider (provider);
-    CGDataProviderRelease (provider);
+    if (likely (provider))
+    {
+      data = CGFontCreateWithDataProvider (provider);
+      CGDataProviderRelease (provider);
+    }
   }
 
   if (unlikely (!data)) {
@@ -558,7 +561,6 @@ _hb_coretext_shape (hb_shape_plan_t    *shape_plan,
 	  CFRelease (attributes);
 
 	  range->font = CTFontCreateCopyWithAttributes (font_data->ct_font, 0.0, NULL, font_desc);
-
 	  CFRelease (font_desc);
 	}
 	else


More information about the HarfBuzz mailing list