From ae1c7443a8411569fbdbf9b188b4715b86b969e4 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 21 Dec 2015 21:22:59 +0000 Subject: avoid the same thing ever happening in the vcl cairo text renderer Change-Id: I6cc9694b14366f022f1cef440d03ac4a1be94c4a --- vcl/unx/generic/gdi/cairotextrender.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index 5434ddbe40bf..bf1297e88021 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -199,6 +199,13 @@ void CairoTextRender::DrawServerFontLayout( const ServerFontLayout& rLayout ) if (cairo_glyphs.empty()) return; + ServerFont& rFont = rLayout.GetServerFont(); + const FontSelectPattern& rFSD = rFont.GetFontSelData(); + int nHeight = rFSD.mnHeight; + int nWidth = rFSD.mnWidth ? rFSD.mnWidth : nHeight; + if (nWidth == 0 || nHeight == 0) + return; + /* * It might be ideal to cache surface and cairo context between calls and * only destroy it when the drawable changes, but to do that we need to at @@ -227,8 +234,6 @@ void CairoTextRender::DrawServerFontLayout( const ServerFontLayout& rLayout ) SALCOLOR_GREEN(mnTextColor)/255.0, SALCOLOR_BLUE(mnTextColor)/255.0); - ServerFont& rFont = rLayout.GetServerFont(); - FT_Face aFace = rFont.GetFtFace(); CairoFontsCache::CacheId aId; aId.maFace = aFace; @@ -236,9 +241,6 @@ void CairoTextRender::DrawServerFontLayout( const ServerFontLayout& rLayout ) aId.mbEmbolden = rFont.NeedsArtificialBold(); cairo_matrix_t m; - const FontSelectPattern& rFSD = rFont.GetFontSelData(); - int nHeight = rFSD.mnHeight; - int nWidth = rFSD.mnWidth ? rFSD.mnWidth : nHeight; std::vector::const_iterator aEnd = glyph_extrarotation.end(); std::vector::const_iterator aStart = glyph_extrarotation.begin(); -- cgit v1.2.3