diff options
author | B. Stack <bgstack15@gmail.com> | 2024-05-10 11:21:56 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2024-05-10 11:21:56 -0400 |
commit | 7a5f22cfe87f938ef58f92b48ac379dc1c4c81c7 (patch) | |
tree | 3ed84995318afbd82d5d98a2ba044f9ba58b57c6 /wx+/image_tools.cpp | |
parent | add upstream 13.5 (diff) | |
download | FreeFileSync-7a5f22cfe87f938ef58f92b48ac379dc1c4c81c7.tar.gz FreeFileSync-7a5f22cfe87f938ef58f92b48ac379dc1c4c81c7.tar.bz2 FreeFileSync-7a5f22cfe87f938ef58f92b48ac379dc1c4c81c7.zip |
add upstream 13.613.6
Diffstat (limited to 'wx+/image_tools.cpp')
-rw-r--r-- | wx+/image_tools.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
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 <zen/string_tools.h> #include <zen/scope_guard.h> #include <wx/app.h> +#include <wx/dcmemory.h> +#include <wx+/dc.h> #include <xBRZ/src/xbrz_tools.h> using namespace zen; @@ -173,7 +175,7 @@ wxImage zen::createImageFromText(const wxString& text, const wxFont& font, const std::vector<std::pair<wxString, wxSize>> 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; |