Generate labels with pangocairo #8

Merged
moritz merged 30 commits from generate-text-part-one into master 2025-10-12 20:07:19 +00:00
4 changed files with 5 additions and 17 deletions
Showing only changes of commit 6a593f2a40 - Show all commits

View File

@@ -90,14 +90,6 @@ int Label::getHeight() {
return mPrinterHeight;
}
int Label::getLayoutHeight() {
return mLayoutHeight;
}
int Label::getLayoutWidth() {
return mLayoutWidth;
}
void Label::configureLayout(PangoLayout* layout, const std::string& text, PangoFontDescription* fontDesc) {
pango_layout_set_font_description(layout, fontDesc);
pango_layout_set_text(layout, text.c_str(), static_cast<int>(text.length()));
@@ -189,7 +181,7 @@ bool Label::create(const std::string& labelText) {
break;
case VAlignPosition::MIDDLE:
cairo_move_to(mCairoCtx.get(), 0.0, (mPrinterHeight - mLayoutHeight) / 2);
[[fallthrough]];
break;
default:
break;
}

View File

@@ -69,8 +69,6 @@ class Label : public ILabel {
void writeToPng(const std::string& file);
[[nodiscard]] int getWidth() override;
[[nodiscard]] int getHeight() override;
[[nodiscard]] int getLayoutWidth() override;
[[nodiscard]] int getLayoutHeight() override;
[[nodiscard]] std::vector<uint8_t> getRaw() override;
void setFontSize(const double fontSize) override;
void setFontFamily(const std::string& fontFamily) override;

View File

@@ -70,8 +70,6 @@ class ILabel {
virtual std::vector<uint8_t> getRaw() = 0;
virtual int getWidth() = 0;
virtual int getHeight() = 0;
virtual int getLayoutWidth() = 0;
virtual int getLayoutHeight() = 0;
virtual void setText(const std::string& text) = 0;
virtual void setFontSize(const double fontSize) = 0;

View File

@@ -23,10 +23,10 @@
#include <memory>
#include <vector>
#include "../interface/IPrinterDriver.hpp"
#include "../interface/IPrinterTypes.hpp"
#include "../libusbwrap/LibUsbTypes.hpp"
#include "../libusbwrap/interface/IUsbDevice.hpp"
#include "interface/IPrinterDriver.hpp"
#include "interface/IPrinterTypes.hpp"
#include "libusbwrap/LibUsbTypes.hpp"
#include "libusbwrap/interface/IUsbDevice.hpp"
#pragma once