[Libreoffice-commits] core.git: vcl/quartz

Khaled Hosny khaledhosny at eglug.org
Mon Dec 12 20:02:01 UTC 2016


 vcl/quartz/ctfonts.cxx |   13 +++++++++++++
 1 file changed, 13 insertions(+)

New commits:
commit 04a77bfa9c5a3da6d99ee6ad8d4802638b7d76fa
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Mon Dec 12 14:51:32 2016 +0200

    Don’t return false for blank glyphs
    
    CTFontCreatePathForGlyph() will return NULL for blank glyphs causing
    CoreTextStyle::GetGlyphOutline() to return false which propagated as
    error all the way to OutputDevice::GetTextOutlines() causing it to
    needlessly enter into fallback code. Other implementations just return
    true and an empty polygon here.
    
    Change-Id: Ib20ebff00f7cb3aae22f1c6b4c3a0e9d7a429987
    Reviewed-on: https://gerrit.libreoffice.org/31902
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index f5ea6db..1c60db3 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -231,6 +231,19 @@ bool CoreTextStyle::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPol
 
     CGGlyph nCGGlyph = rGlyph.maGlyphId;
     CTFontRef pCTFont = static_cast<CTFontRef>(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName ));
+
+    SAL_WNODEPRECATED_DECLARATIONS_PUSH
+    const CTFontOrientation aFontOrientation = kCTFontDefaultOrientation;
+    SAL_WNODEPRECATED_DECLARATIONS_POP
+    CGRect aCGRect = CTFontGetBoundingRectsForGlyphs(pCTFont, aFontOrientation, &nCGGlyph, nullptr, 1);
+
+    if (!CGRectIsNull(aCGRect) && CGRectIsEmpty(aCGRect))
+    {
+        // CTFontCreatePathForGlyph returns NULL for blank glyphs, but we want
+        // to return true for them.
+        return true;
+    }
+
     CGPathRef xPath = CTFontCreatePathForGlyph( pCTFont, nCGGlyph, nullptr );
     if (!xPath)
     {


More information about the Libreoffice-commits mailing list