Horizon
text.hpp
1 #pragma once
2 #include "util/uuid.hpp"
3 #include "nlohmann/json_fwd.hpp"
4 #include "common.hpp"
5 #include "util/placement.hpp"
6 #include "util/text_data.hpp"
7 #include <vector>
8 #include <map>
9 #include <fstream>
10 
11 namespace horizon {
12 using json = nlohmann::json;
13 enum class TextOrigin { BASELINE, CENTER, BOTTOM };
14 
18 class Text {
19 public:
20  Text(const UUID &uu, const json &j);
21  Text(const UUID &uu);
22 
23  UUID uuid;
24 
25  TextOrigin origin = TextOrigin::CENTER;
26  TextData::Font font = TextData::Font::SIMPLEX;
27  Placement placement;
28  std::string text;
29  uint64_t size = 1.5_mm;
30  uint64_t width = 0;
31  int layer = 0;
32  std::string text_override;
33 
38  bool overridden = false;
39 
44  bool from_smash = false;
45 
46  UUID get_uuid() const;
47  json serialize() const;
48 };
49 } // namespace horizon
horizon::Text::from_smash
bool from_smash
true if this is the result of a smash operation.
Definition: text.hpp:44
horizon::Text::overridden
bool overridden
When set, the renderer will render text_override instead of text.
Definition: text.hpp:38
nlohmann::basic_json
a class to store JSON values
Definition: json.hpp:166
nlohmann::json
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61
libzip::uint64_t
zip_uint64_t uint64_t
zip_uint64_t_t typedef.
Definition: zip.hpp:108