35#include <NDEVR/Model.h>
36#include <NDEVR/TextConstructor.h>
37#include <NDEVR/Font.h>
40 enum TextControlSequence
46 , e_set_underline =
'_'
47 , e_set_overstrike =
'-'
48 , e_set_alignment =
'a'
49 , e_set_font_size =
's'
50 , e_set_fixed_width =
'w'
51 , e_set_tab_advance =
't'
53 class TextConstructor;
58 Text(
const Model& model);
59 Text(
const Model& model,
const Font& font);
60 Text(
const Model& model,
const DynamicPointer<TextConstructor>& font);
61 void setText(
const TranslatedString& text,
bool update_now =
false);
62 void setText(
const String& text,
bool update_now =
false);
63 void setText(
const Buffer<TextBlock>& text,
bool update_now =
false);
64 void setAlignment(uint01 alignment,
bool update_now =
false);
65 void setInsertionAlignment(uint01 alignment,
bool update_now =
false);
67 Model textObject()
const;
70 void setCursor(uint04 cursor_position);
72 bool needsUpdate()
const;
73 void updateTranslation();
74 void setConstrainedSize(
const Vector<2, fltp08>& size);
75 void setReferenceSize(
const Vector<2, fltp08>& size);
76 void setForwardBias(fltp08 forward_bias);
77 const Material outlineMaterial()
const;
78 Material outlineMaterial();
79 const Material fillMaterial()
const;
80 Material fillMaterial();
81 void setLineSpaceFactor(fltp08 line_space);
82 fltp08 lineSpaceFactor()
const;
83 void setFillMaterial(
const Material& material);
84 void setOutlineMaterial(
const Material& material);
85 String plainText()
const;
86 const Buffer<TextBlock>& blocks()
const {
return m_text_blocks; };
87 Buffer<TextBlock> autoInsertNewLines()
const;
88 void setFont(
const Font& font,
bool update_now =
false);
90 void saveBlockMetaData();
91 void readBlockMetaData();
92 Model getLetterAt(uint04 string_position)
const;
93 static constexpr const char* TypeName() {
return "text"; }
94 void setFaceCamera(
bool face_camera);
95 void setScaleToCamera(
bool face_camera);
96 void setFillBackground(
bool fill_background);
97 static fltp04 DefaultScaler() {
return .01f; }
99 bool setupLetter(
const DynamicPointer<TextConstructor>& printer, Model& letter,
char value, fltp08 hor_advance, fltp08 scale,
const Font& font);
100 bool setupLetter(
const DynamicPointer<TextConstructor>& printer, Model& letter, wchar value, fltp08 hor_advance, fltp08 scale,
const Font& font);
101 void setupCursor(
const Matrix<fltp08>& matrix,
const Vector<2, fltp08>& cursor_location,
const Font& font);
102 void findCursor(
bool create_if_not_exists);
103 void updateBackground();
107 mutable DynamicPointer<TextConstructor> m_printer;
108 Buffer<TextBlock> m_text_blocks;
109 Vector<2, fltp08> m_constrained_size;
110 Vector<2, fltp08> m_reference_size;
115 uint01 m_insertion_alignment;
116 mutable fltp08 m_line_space_factor;
117 fltp08 m_forward_bias = 0.0;
118 bool m_has_background =
false;
float fltp04
Defines an alias representing a 4 byte floating-point number.
Definition BaseValues.hpp:157
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:98
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181