From e5f519b42db9b06e6c44977213ab761e4a845408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=9B=A6?= Date: Thu, 16 Jan 2025 20:22:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=8F=8C=E9=87=8D=E6=B0=B4?= =?UTF-8?q?=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 3136401f..2c372503 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -1607,10 +1607,12 @@ void DrawOutlineText(cv::Ptr ft2, cv::Mat& mat, const std::st for (std::vector::const_iterator it = lines.cbegin(); it != lines.cend(); ++it ) { - textSize = ft2->getTextSize(*it, fontSize, thickness, &baseline); + std::string trimmedLine = *it; + trimString(trimmedLine); + textSize = ft2->getTextSize(trimmedLine, fontSize, thickness, &baseline); lineHeight = std::max(fontSize, textSize.height + baseline); - ft2->putText(mat, *it, pt, fontSize, clr, thickness, cv::LINE_AA, false, true); + ft2->putText(mat, trimmedLine, pt, fontSize, clr, thickness, cv::LINE_AA, false, true); pt.x = startPoint.x; pt.y += lineHeight + (lineHeight >> 2); // 125%