VTK  9.3.0
vtkTextProperty.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
27#ifndef vtkTextProperty_h
28#define vtkTextProperty_h
29
30#include "vtkObject.h"
31#include "vtkRenderingCoreModule.h" // For export macro
32
33VTK_ABI_NAMESPACE_BEGIN
34class VTKRENDERINGCORE_EXPORT vtkTextProperty : public vtkObject
35{
36public:
37 vtkTypeMacro(vtkTextProperty, vtkObject);
38 void PrintSelf(ostream& os, vtkIndent indent) override;
39
45
47
50 vtkSetVector3Macro(Color, double);
51 vtkGetVector3Macro(Color, double);
53
55
59 vtkSetClampMacro(Opacity, double, 0., 1.);
60 vtkGetMacro(Opacity, double);
62
64
67 vtkSetVector3Macro(BackgroundColor, double);
68 vtkGetVector3Macro(BackgroundColor, double);
70
72
76 vtkSetClampMacro(BackgroundOpacity, double, 0., 1.);
77 vtkGetMacro(BackgroundOpacity, double);
79
81
84 void SetBackgroundRGBA(double rgba[4]);
85 void SetBackgroundRGBA(double r, double g, double b, double a);
86
90 void GetBackgroundRGBA(double rgba[4]);
91 void GetBackgroundRGBA(double& r, double& g, double& b, double& a);
93
95
98 vtkSetVector3Macro(FrameColor, double);
99 vtkGetVector3Macro(FrameColor, double);
101
103
106 vtkSetMacro(Frame, vtkTypeBool);
107 vtkGetMacro(Frame, vtkTypeBool);
108 vtkBooleanMacro(Frame, vtkTypeBool);
110
112
116 vtkSetClampMacro(FrameWidth, int, 0, VTK_INT_MAX);
117 vtkGetMacro(FrameWidth, int);
119
121
127 vtkGetStringMacro(FontFamilyAsString);
128 vtkSetStringMacro(FontFamilyAsString);
129 void SetFontFamily(int t);
130 int GetFontFamily();
132 void SetFontFamilyToArial();
133 void SetFontFamilyToCourier();
134 void SetFontFamilyToTimes();
135 static int GetFontFamilyFromString(const char* f);
136 static const char* GetFontFamilyAsString(int f);
138
140
148
150
153 vtkSetClampMacro(FontSize, int, 0, VTK_INT_MAX);
154 vtkGetMacro(FontSize, int);
156
158
161 vtkSetMacro(Bold, vtkTypeBool);
162 vtkGetMacro(Bold, vtkTypeBool);
163 vtkBooleanMacro(Bold, vtkTypeBool);
165
167
170 vtkSetMacro(Italic, vtkTypeBool);
171 vtkGetMacro(Italic, vtkTypeBool);
172 vtkBooleanMacro(Italic, vtkTypeBool);
174
176
179 vtkSetMacro(Shadow, vtkTypeBool);
180 vtkGetMacro(Shadow, vtkTypeBool);
181 vtkBooleanMacro(Shadow, vtkTypeBool);
183
185
189 vtkSetVector2Macro(ShadowOffset, int);
190 vtkGetVectorMacro(ShadowOffset, int, 2);
192
196 void GetShadowColor(double color[3]);
197
199
203 vtkSetClampMacro(Justification, int, VTK_TEXT_LEFT, VTK_TEXT_RIGHT);
204 vtkGetMacro(Justification, int);
205 void SetJustificationToLeft() { this->SetJustification(VTK_TEXT_LEFT); }
206 void SetJustificationToCentered() { this->SetJustification(VTK_TEXT_CENTERED); }
207 void SetJustificationToRight() { this->SetJustification(VTK_TEXT_RIGHT); }
208 const char* GetJustificationAsString();
210
212
216 vtkSetClampMacro(VerticalJustification, int, VTK_TEXT_BOTTOM, VTK_TEXT_TOP);
217 vtkGetMacro(VerticalJustification, int);
218 void SetVerticalJustificationToBottom() { this->SetVerticalJustification(VTK_TEXT_BOTTOM); }
219 void SetVerticalJustificationToCentered() { this->SetVerticalJustification(VTK_TEXT_CENTERED); }
220 void SetVerticalJustificationToTop() { this->SetVerticalJustification(VTK_TEXT_TOP); }
221 const char* GetVerticalJustificationAsString();
223
225
231 vtkSetMacro(UseTightBoundingBox, vtkTypeBool);
232 vtkGetMacro(UseTightBoundingBox, vtkTypeBool);
233 vtkBooleanMacro(UseTightBoundingBox, vtkTypeBool);
235
237
240 vtkSetMacro(Orientation, double);
241 vtkGetMacro(Orientation, double);
243
245
249 vtkSetMacro(LineSpacing, double);
250 vtkGetMacro(LineSpacing, double);
252
254
257 vtkSetMacro(LineOffset, double);
258 vtkGetMacro(LineOffset, double);
260
262
266 vtkSetMacro(CellOffset, double);
267 vtkGetMacro(CellOffset, double);
269
271
275 vtkSetMacro(InteriorLinesVisibility, bool);
276 vtkGetMacro(InteriorLinesVisibility, bool);
278
280
284 vtkSetMacro(InteriorLinesWidth, int);
285 vtkGetMacro(InteriorLinesWidth, int);
287
289
293 vtkSetVector3Macro(InteriorLinesColor, double);
294 vtkGetVector3Macro(InteriorLinesColor, double);
296
301
302protected:
305
306 double Color[3];
307 double Opacity;
308 double BackgroundColor[3];
311 double FrameColor[3];
314 char* FontFile;
319 int ShadowOffset[2];
327 bool InteriorLinesVisibility = false;
328 int InteriorLinesWidth = 1;
329 double InteriorLinesColor[3] = { 0.0, 0.0, 0.0 };
330
331private:
332 vtkTextProperty(const vtkTextProperty&) = delete;
333 void operator=(const vtkTextProperty&) = delete;
334};
335
337{
338 if (f == VTK_ARIAL)
339 {
340 return "Arial";
341 }
342 else if (f == VTK_COURIER)
343 {
344 return "Courier";
345 }
346 else if (f == VTK_TIMES)
347 {
348 return "Times";
349 }
350 else if (f == VTK_FONT_FILE)
351 {
352 return "File";
353 }
354 return "Unknown";
355}
356
358{
360}
361
363{
365}
366
368{
370}
371
373{
375}
376
378{
379 if (strcmp(f, GetFontFamilyAsString(VTK_ARIAL)) == 0)
380 {
381 return VTK_ARIAL;
382 }
383 else if (strcmp(f, GetFontFamilyAsString(VTK_COURIER)) == 0)
384 {
385 return VTK_COURIER;
386 }
387 else if (strcmp(f, GetFontFamilyAsString(VTK_TIMES)) == 0)
388 {
389 return VTK_TIMES;
390 }
391 else if (strcmp(f, GetFontFamilyAsString(VTK_FONT_FILE)) == 0)
392 {
393 return VTK_FONT_FILE;
394 }
395 return VTK_UNKNOWN_FONT;
396}
397
399{
401}
402
404{
405 if (this->Justification == VTK_TEXT_LEFT)
406 {
407 return "Left";
408 }
409 else if (this->Justification == VTK_TEXT_CENTERED)
410 {
411 return "Centered";
412 }
413 else if (this->Justification == VTK_TEXT_RIGHT)
414 {
415 return "Right";
416 }
417 return "Unknown";
418}
419
421{
423 {
424 return "Bottom";
425 }
427 {
428 return "Centered";
429 }
430 else if (this->VerticalJustification == VTK_TEXT_TOP)
431 {
432 return "Top";
433 }
434 return "Unknown";
435}
436
437VTK_ABI_NAMESPACE_END
438#endif
a simple class to control print indentation
Definition vtkIndent.h:38
abstract base class for most VTK objects
Definition vtkObject.h:58
represent text properties.
void SetFontFamilyToArial()
Set/Get the font family.
void ShallowCopy(vtkTextProperty *tprop)
Shallow copy of a text property.
static vtkTextProperty * New()
Creates a new text property with font size 12, bold off, italic off, and Arial font.
static int GetFontFamilyFromString(const char *f)
Set/Get the font family.
virtual char * GetFontFamilyAsString()
Set/Get the font family.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetJustificationToCentered()
Set/Get the horizontal justification to left (default), centered, or right.
void SetFontFamilyToCourier()
Set/Get the font family.
void SetVerticalJustificationToCentered()
Set/Get the vertical justification to bottom (default), middle, or top.
void GetBackgroundRGBA(double rgba[4])
Convenience method to get the background color and the opacity at once.
int GetFontFamily()
Set/Get the font family.
void SetJustificationToLeft()
Set/Get the horizontal justification to left (default), centered, or right.
int GetFontFamilyMinValue()
Set/Get the font family.
const char * GetVerticalJustificationAsString()
Set/Get the vertical justification to bottom (default), middle, or top.
vtkGetFilePathMacro(FontFile)
The absolute filepath to a local file containing a freetype-readable font if GetFontFamily() return V...
vtkSetFilePathMacro(FontFile)
The absolute filepath to a local file containing a freetype-readable font if GetFontFamily() return V...
vtkTypeBool UseTightBoundingBox
void GetBackgroundRGBA(double &r, double &g, double &b, double &a)
Convenience method to set the background color and the opacity at once.
void SetJustificationToRight()
Set/Get the horizontal justification to left (default), centered, or right.
void SetVerticalJustificationToTop()
Set/Get the vertical justification to bottom (default), middle, or top.
~vtkTextProperty() override
void SetBackgroundRGBA(double rgba[4])
Convenience method to set the background color and the opacity at once.
void SetFontFamily(int t)
Set/Get the font family.
void GetShadowColor(double color[3])
Get the shadow color.
void SetVerticalJustificationToBottom()
Set/Get the vertical justification to bottom (default), middle, or top.
const char * GetJustificationAsString()
Set/Get the horizontal justification to left (default), centered, or right.
virtual void SetFontFamilyAsString(const char *)
Set/Get the font family.
void SetBackgroundRGBA(double r, double g, double b, double a)
Convenience method to set the background color and the opacity at once.
void SetFontFamilyToTimes()
Set/Get the font family.
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_TEXT_TOP
#define VTK_TEXT_RIGHT
#define VTK_TEXT_LEFT
#define VTK_COURIER
#define VTK_TEXT_BOTTOM
#define VTK_FONT_FILE
#define VTK_ARIAL
#define VTK_TIMES
#define VTK_UNKNOWN_FONT
#define VTK_TEXT_CENTERED
#define VTK_INT_MAX
Definition vtkType.h:144