We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1af5c5a commit 8c3bedfCopy full SHA for 8c3bedf
src/jngl/text.cpp
@@ -55,11 +55,16 @@ class Text::Line {
55
double height = std::numeric_limits<double>::quiet_NaN();
56
};
57
58
-Text::Text(const std::string& text) : font(pWindow->getFontImpl()) {
59
- setText(text);
+Text::Text(const std::string& text) : font(text.empty() ? nullptr : pWindow->getFontImpl()) {
+ if (!text.empty()) {
60
+ setText(text);
61
+ }
62
}
63
64
void Text::setText(const std::string& text, double maxWidth) {
65
+ if (!font) {
66
+ font = pWindow->getFontImpl();
67
68
lines.clear();
69
for (const auto& lineText : splitlines(text)) {
70
addLine(lineText, maxWidth);
0 commit comments