From 6f81e31f10c207b66bb7bd8329659eb8833bf916 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 28 Mar 2013 15:52:17 +0200 Subject: [PATCH] Gfx: Delay creation of ellipsis with D2D --- Common/Gfx/TextFormatD2D.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Common/Gfx/TextFormatD2D.cpp b/Common/Gfx/TextFormatD2D.cpp index 2dae6375..d5bf1ea2 100644 --- a/Common/Gfx/TextFormatD2D.cpp +++ b/Common/Gfx/TextFormatD2D.cpp @@ -104,8 +104,6 @@ void TextFormatD2D::SetProperties(const WCHAR* fontFamily, int size, bool bold, if (SUCCEEDED(hr)) { - CanvasD2D::c_DW->CreateEllipsisTrimmingSign(m_TextFormat, &m_InlineEllipsis); - SetHorizontalAlignment(GetHorizontalAlignment()); SetVerticalAlignment(GetVerticalAlignment()); } @@ -122,6 +120,11 @@ void TextFormatD2D::SetTrimming(bool trim) DWRITE_WORD_WRAPPING wordWrapping = DWRITE_WORD_WRAPPING_NO_WRAP; if (trim) { + if (!m_InlineEllipsis) + { + CanvasD2D::c_DW->CreateEllipsisTrimmingSign(m_TextFormat, &m_InlineEllipsis); + } + inlineObject = m_InlineEllipsis; trimming.granularity = DWRITE_TRIMMING_GRANULARITY_CHARACTER; wordWrapping = DWRITE_WORD_WRAPPING_WRAP;