From 3c8c8a1f5ec9a01c19090e4ff29fc7222f61c67a Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Wed, 31 Jul 2013 13:12:15 +0300 Subject: [PATCH] Gfx: Additional change to 37fd105 --- Common/Gfx/CanvasD2D.cpp | 5 ++++- Common/Gfx/Util/DWriteHelpers.cpp | 6 ------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Common/Gfx/CanvasD2D.cpp b/Common/Gfx/CanvasD2D.cpp index 4db268cb..70c92d6c 100644 --- a/Common/Gfx/CanvasD2D.cpp +++ b/Common/Gfx/CanvasD2D.cpp @@ -377,8 +377,11 @@ bool CanvasD2D::MeasureTextLinesW(const WCHAR* str, UINT strLen, const TextForma const DWRITE_TEXT_METRICS metrics = Util::GetAdjustedDWriteTextLayoutMetrics(textLayout.Get(), !m_AccurateText); rect.Width = metrics.width; - rect.Height = metrics.height; lines = metrics.lineCount; + + // GDI+ draws multi-line text even though the last line may be clipped slightly at the bottom. + // This is a workaround to emulate that behaviour. + rect.Height = metrics.height + 1.0f; return true; } diff --git a/Common/Gfx/Util/DWriteHelpers.cpp b/Common/Gfx/Util/DWriteHelpers.cpp index 1f564acd..b01fa228 100644 --- a/Common/Gfx/Util/DWriteHelpers.cpp +++ b/Common/Gfx/Util/DWriteHelpers.cpp @@ -36,12 +36,6 @@ DWRITE_TEXT_METRICS GetAdjustedDWriteTextLayoutMetrics( metrics.width = floor(metrics.width + (size / 2.05f) + (metrics.width / 55.0f) - 0.5f); metrics.height = floor(metrics.height + (size / 9.25f) + 0.3f); } - else - { - // GDI+ draws multi-line text even though the last line may be clipped slightly at the bottom. - // This is a workaround to emulate that behaviour. - metrics.height += 1.0f; - } return metrics; }