From 4344ccbf24a899c14854c28c4e304793657dd6d0 Mon Sep 17 00:00:00 2001 From: fxliang Date: Mon, 16 Oct 2023 21:20:39 +0800 Subject: [PATCH] fix trailing white space --- WeaselUI/StandardLayout.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WeaselUI/StandardLayout.cpp b/WeaselUI/StandardLayout.cpp index b6e1757a4..86851f568 100644 --- a/WeaselUI/StandardLayout.cpp +++ b/WeaselUI/StandardLayout.cpp @@ -40,7 +40,7 @@ void weasel::StandardLayout::GetTextSizeDW(const std::wstring text, size_t nCoun // »ñÈ¡Îı¾³ß´ç DWRITE_TEXT_METRICS textMetrics; hr = pDWR->GetLayoutMetrics(&textMetrics); - sz = D2D1::SizeF(ceil(textMetrics.width), ceil(textMetrics.height)); + sz = D2D1::SizeF(ceil(textMetrics.widthIncludingTrailingWhitespace), ceil(textMetrics.height)); lpSize->cx = (int)sz.width; lpSize->cy = (int)sz.height; @@ -48,13 +48,13 @@ void weasel::StandardLayout::GetTextSizeDW(const std::wstring text, size_t nCoun if(_style.layout_type != UIStyle::LAYOUT_VERTICAL_TEXT) { - size_t max_width = _style.max_width == 0 ? textMetrics.width : _style.max_width; + size_t max_width = _style.max_width == 0 ? textMetrics.widthIncludingTrailingWhitespace : _style.max_width; hr = pDWR->CreateTextLayout(text.c_str(), nCount, pTextFormat.Get(), max_width, textMetrics.height); } else { size_t max_height = _style.max_height == 0 ? textMetrics.height : _style.max_height; - hr = pDWR->CreateTextLayout(text.c_str(), nCount, pTextFormat.Get(), textMetrics.width, max_height); + hr = pDWR->CreateTextLayout(text.c_str(), nCount, pTextFormat.Get(), textMetrics.widthIncludingTrailingWhitespace, max_height); } if (_style.layout_type == UIStyle::LAYOUT_VERTICAL_TEXT)