VTK  9.1.0
vtkTextProperty.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkTextProperty.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
27#ifndef vtkTextProperty_h
28#define vtkTextProperty_h
29
30#include "vtkObject.h"
31#include "vtkRenderingCoreModule.h" // For export macro
32
33class VTKRENDERINGCORE_EXPORT vtkTextProperty : public vtkObject
34{
35public:
36 vtkTypeMacro(vtkTextProperty, vtkObject);
37 void PrintSelf(ostream& os, vtkIndent indent) override;
38
44
46
49 vtkSetVector3Macro(Color, double);
50 vtkGetVector3Macro(Color, double);
52
54
58 vtkSetClampMacro(Opacity, double, 0., 1.);
59 vtkGetMacro(Opacity, double);
61
63
66 vtkSetVector3Macro(BackgroundColor, double);
67 vtkGetVector3Macro(BackgroundColor, double);
69
71
75 vtkSetClampMacro(BackgroundOpacity, double, 0., 1.);
76 vtkGetMacro(BackgroundOpacity, double);
78
80
83 void SetBackgroundRGBA(double rgba[4]);
84 void SetBackgroundRGBA(double r, double g, double b, double a);
85
89 void GetBackgroundRGBA(double rgba[4]);
90 void GetBackgroundRGBA(double& r, double& g, double& b, double& a);
92
94
97 vtkSetVector3Macro(FrameColor, double);
98 vtkGetVector3Macro(FrameColor, double);
100
102
105 vtkSetMacro(Frame, vtkTypeBool);
106 vtkGetMacro(Frame, vtkTypeBool);
107 vtkBooleanMacro(Frame, vtkTypeBool);
109
111
115 vtkSetClampMacro(FrameWidth, int, 0, VTK_INT_MAX);
116 vtkGetMacro(FrameWidth, int);
118
120
126 vtkGetStringMacro(FontFamilyAsString);
127 vtkSetStringMacro(FontFamilyAsString);
128 void SetFontFamily(int t);
129 int GetFontFamily();
131 void SetFontFamilyToArial();
132 void SetFontFamilyToCourier();
133 void SetFontFamilyToTimes();
134 static int GetFontFamilyFromString(const char* f);
135 static const char* GetFontFamilyAsString(int f);
137
139
147
149
152 vtkSetClampMacro(FontSize, int, 0, VTK_INT_MAX);
153 vtkGetMacro(FontSize, int);
155
157
160 vtkSetMacro(Bold, vtkTypeBool);
161 vtkGetMacro(Bold, vtkTypeBool);
162 vtkBooleanMacro(Bold, vtkTypeBool);
164
166
169 vtkSetMacro(Italic, vtkTypeBool);
170 vtkGetMacro(Italic, vtkTypeBool);
171 vtkBooleanMacro(Italic, vtkTypeBool);
173
175
178 vtkSetMacro(Shadow, vtkTypeBool);
179 vtkGetMacro(Shadow, vtkTypeBool);
180 vtkBooleanMacro(Shadow, vtkTypeBool);
182
184
188 vtkSetVector2Macro(ShadowOffset, int);
189 vtkGetVectorMacro(ShadowOffset, int, 2);
191
195 void GetShadowColor(double color[3]);
196
198
202 vtkSetClampMacro(Justification, int, VTK_TEXT_LEFT, VTK_TEXT_RIGHT);
203 vtkGetMacro(Justification, int);
204 void SetJustificationToLeft() { this->SetJustification(VTK_TEXT_LEFT); }
205 void SetJustificationToCentered() { this->SetJustification(VTK_TEXT_CENTERED); }
206 void SetJustificationToRight() { this->SetJustification(VTK_TEXT_RIGHT); }
207 const char* GetJustificationAsString();
209
211
215 vtkSetClampMacro(VerticalJustification, int, VTK_TEXT_BOTTOM, VTK_TEXT_TOP);
216 vtkGetMacro(VerticalJustification, int);
217 void SetVerticalJustificationToBottom() { this->SetVerticalJustification(VTK_TEXT_BOTTOM); }
218 void SetVerticalJustificationToCentered() { this->SetVerticalJustification(VTK_TEXT_CENTERED); }
219 void SetVerticalJustificationToTop() { this->SetVerticalJustification(VTK_TEXT_TOP); }
220 const char* GetVerticalJustificationAsString();
222
224
230 vtkSetMacro(UseTightBoundingBox, vtkTypeBool);
231 vtkGetMacro(UseTightBoundingBox, vtkTypeBool);
232 vtkBooleanMacro(UseTightBoundingBox, vtkTypeBool);
234
236
239 vtkSetMacro(Orientation, double);
240 vtkGetMacro(Orientation, double);
242
244
248 vtkSetMacro(LineSpacing, double);
249 vtkGetMacro(LineSpacing, double);
251
253
256 vtkSetMacro(LineOffset, double);
257 vtkGetMacro(LineOffset, double);
259
261
265 vtkSetMacro(CellOffset, double);
266 vtkGetMacro(CellOffset, double);
268
273
274protected:
277
278 double Color[3];
279 double Opacity;
280 double BackgroundColor[3];
283 double FrameColor[3];
286 char* FontFile;
291 int ShadowOffset[2];
299
300private:
301 vtkTextProperty(const vtkTextProperty&) = delete;
302 void operator=(const vtkTextProperty&) = delete;
303};
304
306{
307 if (f == VTK_ARIAL)
308 {
309 return "Arial";
310 }
311 else if (f == VTK_COURIER)
312 {
313 return "Courier";
314 }
315 else if (f == VTK_TIMES)
316 {
317 return "Times";
318 }
319 else if (f == VTK_FONT_FILE)
320 {
321 return "File";
322 }
323 return "Unknown";
324}
325
327{
329}
330
332{
334}
335
337{
339}
340
342{
344}
345
347{
348 if (strcmp(f, GetFontFamilyAsString(VTK_ARIAL)) == 0)
349 {
350 return VTK_ARIAL;
351 }
352 else if (strcmp(f, GetFontFamilyAsString(VTK_COURIER)) == 0)
353 {
354 return VTK_COURIER;
355 }
356 else if (strcmp(f, GetFontFamilyAsString(VTK_TIMES)) == 0)
357 {
358 return VTK_TIMES;
359 }
360 else if (strcmp(f, GetFontFamilyAsString(VTK_FONT_FILE)) == 0)
361 {
362 return VTK_FONT_FILE;
363 }
364 return VTK_UNKNOWN_FONT;
365}
366
368{
370}
371
373{
374 if (this->Justification == VTK_TEXT_LEFT)
375 {
376 return "Left";
377 }
378 else if (this->Justification == VTK_TEXT_CENTERED)
379 {
380 return "Centered";
381 }
382 else if (this->Justification == VTK_TEXT_RIGHT)
383 {
384 return "Right";
385 }
386 return "Unknown";
387}
388
390{
392 {
393 return "Bottom";
394 }
396 {
397 return "Centered";
398 }
399 else if (this->VerticalJustification == VTK_TEXT_TOP)
400 {
401 return "Top";
402 }
403 return "Unknown";
404}
405
406#endif
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:63
represent text properties.
void SetFontFamilyToArial()
Set/Get the font family.
vtkTypeBool Shadow
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.
vtkTypeBool Italic
vtkTypeBool Bold
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.
vtkTypeBool Frame
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.
@ Color
Definition: vtkX3D.h:52
@ color
Definition: vtkX3D.h:227
int vtkTypeBool
Definition: vtkABI.h:69
#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:155