[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Apr 21 19:21:54 PDT 2015


 src/hb-coretext.cc |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit 24f17afeafd40ff77177ed42c9007a0f34fcbb78
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Apr 21 19:21:32 2015 -0700

    [coretext] Fix positioning with trailing whitespace
    
    Fixes https://code.google.com/p/chromium/issues/detail?id=476913

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 4a45175..fc47669 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -788,6 +788,17 @@ retry:
     buffer->len = 0;
     uint32_t status_and = ~0, status_or = 0;
     double advances_so_far = 0;
+    /* For right-to-left runs, CoreText returns the glyphs positioned such that
+     * any trailing whitespace is to the left of (0,0).  Adjust coordinate system
+     * to fix for that.  Test with any RTL string with trailing spaces.
+     * https://code.google.com/p/chromium/issues/detail?id=476913
+     */
+    if (HB_DIRECTION_IS_BACKWARD (buffer->props.direction))
+    {
+      advances_so_far -= CTLineGetTrailingWhitespaceWidth (line);
+      if (HB_DIRECTION_IS_VERTICAL (buffer->props.direction))
+	  advances_so_far = -advances_so_far;
+    }
 
     const CFRange range_all = CFRangeMake (0, 0);
 


More information about the HarfBuzz mailing list