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