Got it almost working...
All checks were successful
Build ptprnt / build (push) Successful in 2m29s

This commit is contained in:
2023-12-03 22:08:59 +01:00
parent 3e9c3267e2
commit b42e866a49
14 changed files with 143 additions and 78 deletions

View File

@@ -23,6 +23,11 @@
#include <cstdint>
#include <string>
#include <vector>
#include "cairo.h"
#include "pango/pango-font.h"
#include "pango/pango-types.h"
namespace ptprnt::graphics {
@@ -39,15 +44,21 @@ class Label {
Label(Label&&) = delete;
Label& operator=(Label&&) = delete;
uint8_t* getRaw();
void createLabel(const std::string& labelText);
std::vector<uint8_t> getRaw();
void create(const std::string& labelText, const uint16_t heightPixel);
void writeToPng(const std::string& file);
int getLayoutWidth();
int getLayoutHeight();
private:
// methods
uint8_t getNumLines(std::string_view str);
// members
PangoLayout* mLayout;
PangoFontDescription* mFontDescription;
cairo_surface_t* mSurface;
PangoContext* mPangoCtx{nullptr};
PangoLayout* mPangoLyt{nullptr};
PangoFontDescription* mPangoFontDesc{nullptr};
cairo_surface_t* mSurface{nullptr};
int mLayoutWidth = 0, mLayoutHeight = 0;
int mPrinterHeight = 0;
};
} // namespace ptprnt::graphics