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; }