Horizon
src
common
text.hpp
1
#pragma once
2
#include "util/uuid.hpp"
3
#include "nlohmann/json_fwd.hpp"
4
#include "common.hpp"
5
#include "util/uuid_provider.hpp"
6
#include "util/placement.hpp"
7
#include "util/text_data.hpp"
8
#include <vector>
9
#include <map>
10
#include <fstream>
11
12
namespace
horizon
{
13
using
json
=
nlohmann::json
;
14
enum class
TextOrigin { BASELINE, CENTER, BOTTOM };
15
19
class
Text
:
public
UUIDProvider
{
20
public
:
21
Text
(
const
UUID
&uu,
const
json
&j);
22
Text
(
const
UUID
&uu);
23
24
UUID
uuid;
25
26
TextOrigin origin = TextOrigin::CENTER;
27
TextData::Font font = TextData::Font::SIMPLEX;
28
Placement
placement;
29
std::string text;
30
uint64_t size = 1.5_mm;
31
uint64_t width = 0;
32
int
layer = 0;
33
std::string text_override;
34
39
bool
overridden =
false
;
40
45
bool
from_smash =
false
;
46
47
// not stored
48
bool
temp;
49
50
UUID
get_uuid()
const override
;
51
json
serialize()
const
;
52
};
53
}
// namespace horizon
nlohmann::basic_json
a class to store JSON values
Definition:
json.hpp:161
horizon::Placement
Definition:
placement.hpp:8
horizon::UUIDProvider
Interface for objects that have a UUID.
Definition:
uuid_provider.hpp:9
horizon::Text
Used wherever a user-editable text is needed.
Definition:
text.hpp:19
horizon::UUID
This class encapsulates a UUID and allows it to be uses as a value type.
Definition:
uuid.hpp:16
horizon
Definition:
block.cpp:9
nlohmann::json
basic_json<> json
default JSON class
Definition:
json_fwd.hpp:61
Generated by
1.8.13