From d5b46fb3432b73e60d23cf1d6cb33af55121eca3 Mon Sep 17 00:00:00 2001 From: "XI.CHEN" <2311041011@qq.com> Date: Tue, 31 Dec 2024 13:56:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=B3=E4=B8=8AOSD=E6=8D=A2=E8=A1=8C?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 6af7fc80..028aa0fe 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -3421,6 +3421,8 @@ bool CPhoneDevice::PostProcessPhoto(const PHOTO_INFO& photoInfo, const vector (int)width - 1) { @@ -3467,6 +3469,16 @@ bool CPhoneDevice::PostProcessPhoto(const PHOTO_INFO& photoInfo, const vectoralignment == OSD_ALIGNMENT_TOP_RIGHT) { + std::size_t newlinePos = it->text.find('\n'); + if (newlinePos != std::string::npos) + { + std::string textBeforeNewline = it->text.substr(0, newlinePos); + std::string textAfterNewline = it->text.substr(newlinePos + 1); + if(textBeforeNewline.length()>=textAfterNewline.length()) + textSize = ft2->getTextSize(textBeforeNewline, fontSize, thickness, &baseline); + else + textSize = ft2->getTextSize(textAfterNewline, fontSize, thickness, &baseline); + } pt.x = width - textSize.width - it->x * ratio; pt.y= it->y * ratio; }