diff --git a/src/graphics/LabelBuilder.cpp b/src/graphics/LabelBuilder.cpp index 342e605..6b9ec4d 100644 --- a/src/graphics/LabelBuilder.cpp +++ b/src/graphics/LabelBuilder.cpp @@ -31,6 +31,10 @@ LabelBuilder::LabelBuilder(int printerHeight) : mPrinterHeight(printerHeight) { ILabelBuilder& LabelBuilder::addText(const std::string& text) { if (!text.empty()) { + if (!mAccumulatedText.empty()) { + // Add a newline if the label already has some text accumulated + mAccumulatedText += '\n'; + } mAccumulatedText += text; spdlog::debug("LabelBuilder: Added text '{}', total length: {}", text, mAccumulatedText.length()); } @@ -81,9 +85,9 @@ std::unique_ptr LabelBuilder::build() { ILabelBuilder& LabelBuilder::reset() { mAccumulatedText.clear(); mCurrentFontFamily = DEFAULT_FONT_FAMILY; - mCurrentFontSize = DEFAULT_FONT_SIZE; - mCurrentHAlign = HAlignPosition::LEFT; - mCurrentVAlign = VAlignPosition::MIDDLE; + mCurrentFontSize = DEFAULT_FONT_SIZE; + mCurrentHAlign = HAlignPosition::LEFT; + mCurrentVAlign = VAlignPosition::MIDDLE; spdlog::debug("LabelBuilder: Reset to default state"); return *this; }