Horizon
text_renderer.hpp
1 #pragma once
2 #include "text_data.hpp"
3 #include "canvas/color_palette.hpp"
4 #include "common/common.hpp"
5 #include "common/text.hpp"
6 
7 namespace horizon {
8 class TextRenderer {
9 public:
10  struct Options {
11  uint64_t width = 0;
12  bool flip = false;
13  bool mirror = false;
14  bool draw = true;
15  TextData::Font font = TextData::Font::SIMPLEX;
16  bool center = false;
17  bool allow_upside_down = false;
18  };
19 
20 
21  std::pair<Coordf, Coordf> render(const Text &text, ColorP co, Placement transform, bool rev);
22 
23  virtual std::pair<Coordf, Coordf> draw(const Coordf &p, float size, const std::string &rtext, int angle,
24  TextOrigin origin, ColorP color, int layer, const Options &opts);
25 
26 protected:
27  virtual void draw_line(const Coordf &a, const Coordf &b, ColorP color, int layer, uint64_t width)
28  {
29  }
30 
31 private:
32  TextData::Buffer buffer;
33 };
34 } // namespace horizon
Definition: placement.hpp:8
Definition: text_renderer.hpp:8
Used wherever a user-editable text is needed.
Definition: text.hpp:15
Definition: text_renderer.hpp:10