From c408fa2e68555bdf3a2516680448b247fe64ed15 Mon Sep 17 00:00:00 2001 From: "XI.CHEN" <2311041011@qq.com> Date: Wed, 15 Jan 2025 21:04:59 +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 0b0f4fb8..53d70ee6 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -2135,10 +2135,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%