From c0cce5c6090f5cbf7c71a71671d514b6fe8e68cd Mon Sep 17 00:00:00 2001 From: fanlumaster <1730976608@qq.com> Date: Tue, 17 Jun 2025 23:18:04 +0800 Subject: [PATCH] [fix]: Resolve preedit unwrap when typing buuima --- server/src/d2d/candidate_window_d2d.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/src/d2d/candidate_window_d2d.cpp b/server/src/d2d/candidate_window_d2d.cpp index 02dbf700..6e149d6b 100644 --- a/server/src/d2d/candidate_window_d2d.cpp +++ b/server/src/d2d/candidate_window_d2d.cpp @@ -120,6 +120,7 @@ bool InitD2DAndDWrite() L"zh-cn", // pTextFormat.GetAddressOf() // ); + pTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); // pTextFormatOfPreedit hr = pDWriteFactory->CreateTextFormat( // @@ -132,6 +133,7 @@ bool InitD2DAndDWrite() L"zh-cn", // pTextFormatOfPreedit.GetAddressOf() // ); + pTextFormatOfPreedit->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); // TextFormatOfNum hr = pDWriteFactory->CreateTextFormat( // @@ -144,6 +146,7 @@ bool InitD2DAndDWrite() L"zh-cn", // pTextFormatOfNum.GetAddressOf() // ); + pTextFormatOfNum->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); if (FAILED(hr)) return false; @@ -215,8 +218,8 @@ std::pair MeasureTextWidth( // text.c_str(), // static_cast(text.length()), // pTextFormat.Get(), // - 1000.0f, // Max width enough to avoid wrapping - 1000.0f, // Max height + FLT_MAX, // + FLT_MAX, // pTextLayout.GetAddressOf() // );