From 7a5f22cfe87f938ef58f92b48ac379dc1c4c81c7 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Fri, 10 May 2024 11:21:56 -0400 Subject: add upstream 13.6 --- wx+/image_tools.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'wx+/image_tools.cpp') diff --git a/wx+/image_tools.cpp b/wx+/image_tools.cpp index e95797ca..4dfa7b30 100644 --- a/wx+/image_tools.cpp +++ b/wx+/image_tools.cpp @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include using namespace zen; @@ -173,7 +175,7 @@ wxImage zen::createImageFromText(const wxString& text, const wxFont& font, const std::vector> lineInfo; //text + extent for (const wxString& line : splitCpy(text, L'\n', SplitOnEmpty::allow)) - lineInfo.emplace_back(line, line.empty() ? wxSize() : dc.GetTextExtent(line)); + lineInfo.emplace_back(line, dc.GetTextExtent(line)); //GetTextExtent() returns (0, 0) for empty string! //------------------------------------------------------------------------------------------------ int maxWidth = 0; @@ -181,7 +183,7 @@ wxImage zen::createImageFromText(const wxString& text, const wxFont& font, const for (const auto& [lineText, lineSize] : lineInfo) { maxWidth = std::max(maxWidth, lineSize.GetWidth()); - lineHeight = std::max(lineHeight, lineSize.GetHeight()); //wxWidgets comment "GetTextExtent will return 0 for empty string" + lineHeight = std::max(lineHeight, lineSize.GetHeight()); } if (maxWidth == 0 || lineHeight == 0) return wxNullImage; -- cgit