diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2016-12-12 14:51:32 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-02-24 12:24:45 +0100 |
commit | c4fff9ac4593873595dbdbbdc997dbae1dcfe442 (patch) | |
tree | 129593e4962375c9024361536a15f2b6e7a6d889 /vcl | |
parent | 710098a9ef069a5b08f36a21f2797aaba51eaf7d (diff) |
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@libreoffice.org>
Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
(cherry picked from commit 04a77bfa9c5a3da6d99ee6ad8d4802638b7d76fa)
Reviewed-on: https://gerrit.libreoffice.org/34558
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 0a0b98ae530c7f27c2f790a889f3edbfc98858bd)
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/quartz/ctfonts.cxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 20f5414b2508..d962855d6c24 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -249,6 +249,19 @@ bool CoreTextStyle::GetGlyphOutline( sal_GlyphId aGlyphId, basegfx::B2DPolyPolyg CGGlyph nCGGlyph = aGlyphId & GF_IDXMASK; // XXX: this is broken if the glyph came from fallback font 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) { |