From 61bcb92dee7c4166f761360bb1efa2b8d171b6cd Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Mon, 12 Aug 2013 18:52:51 +0300 Subject: [PATCH] Gfx: Make D2D draw lines if they will be clipped by at most 2 pixels --- Common/Gfx/TextFormatD2D.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Common/Gfx/TextFormatD2D.cpp b/Common/Gfx/TextFormatD2D.cpp index d0b7c40e..306a89ad 100644 --- a/Common/Gfx/TextFormatD2D.cpp +++ b/Common/Gfx/TextFormatD2D.cpp @@ -54,6 +54,16 @@ void TextFormatD2D::CreateLayout( m_LastString.assign(str, strLen); } + if (m_Trimming) + { + // GDI+ compatibility: If we trimming (i.e. clipping), GDI+ draws text lines even if they + // would be clipped. This is arguably a bad 'feature', but some in some cases the height + // might be just a pixel or two too small. In order to render those cases correctly (but + // still clipped as CanvasD2D::DrawTextW() will clip), we'll increase the max height of + // the layout. + maxH += 2.0f; + } + if (m_TextLayout && !strChanged) { if (maxW != m_TextLayout->GetMaxWidth())