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=========================================================================*/
36#ifndef vtkTextProperty_h
37#define vtkTextProperty_h
38
39#include "vtkObject.h"
40#include "vtkRenderingCoreModule.h" // For export macro
41
42class VTKRENDERINGCORE_EXPORT vtkTextProperty : public vtkObject
43{
44public:
45 vtkTypeMacro(vtkTextProperty, vtkObject);
46 void PrintSelf(ostream& os, vtkIndent indent) override;
47
53
55
58 vtkSetVector3Macro(Color, double);
59 vtkGetVector3Macro(Color, double);
61
63
67 vtkSetClampMacro(Opacity, double, 0., 1.);
68 vtkGetMacro(Opacity, double);
70
72
75 vtkSetVector3Macro(BackgroundColor, double);
76 vtkGetVector3Macro(BackgroundColor, double);
78
80
84 vtkSetClampMacro(BackgroundOpacity, double, 0., 1.);
85 vtkGetMacro(BackgroundOpacity, double);
87
89
92 void SetBackgroundRGBA(double rgba[4]);
93 void SetBackgroundRGBA(double r, double g, double b, double a);
94
98 void GetBackgroundRGBA(double rgba[4]);
99 void GetBackgroundRGBA(double& r, double& g, double& b, double& a);
101
103
106 vtkSetVector3Macro(FrameColor, double);
107 vtkGetVector3Macro(FrameColor, double);
109
111
114 vtkSetMacro(Frame, vtkTypeBool);
115 vtkGetMacro(Frame, vtkTypeBool);
116 vtkBooleanMacro(Frame, vtkTypeBool);
118
120
124 vtkSetClampMacro(FrameWidth, int, 0, VTK_INT_MAX);
125 vtkGetMacro(FrameWidth, int);
127
129
135 vtkGetStringMacro(FontFamilyAsString);
136 vtkSetStringMacro(FontFamilyAsString);
137 void SetFontFamily(int t);
138 int GetFontFamily();
140 void SetFontFamilyToArial();
141 void SetFontFamilyToCourier();
142 void SetFontFamilyToTimes();
143 static int GetFontFamilyFromString(const char* f);
144 static const char* GetFontFamilyAsString(int f);
146
148
156
158
161 vtkSetClampMacro(FontSize, int, 0, VTK_INT_MAX);
162 vtkGetMacro(FontSize, int);
164
166
169 vtkSetMacro(Bold, vtkTypeBool);
170 vtkGetMacro(Bold, vtkTypeBool);
171 vtkBooleanMacro(Bold, vtkTypeBool);
173
175
178 vtkSetMacro(Italic, vtkTypeBool);
179 vtkGetMacro(Italic, vtkTypeBool);
180 vtkBooleanMacro(Italic, vtkTypeBool);
182
184
187 vtkSetMacro(Shadow, vtkTypeBool);
188 vtkGetMacro(Shadow, vtkTypeBool);
189 vtkBooleanMacro(Shadow, vtkTypeBool);
191
193
197 vtkSetVector2Macro(ShadowOffset, int);
198 vtkGetVectorMacro(ShadowOffset, int, 2);
200
204 void GetShadowColor(double color[3]);
205
207
211 vtkSetClampMacro(Justification, int, VTK_TEXT_LEFT, VTK_TEXT_RIGHT);
212 vtkGetMacro(Justification, int);
213 void SetJustificationToLeft() { this->SetJustification(VTK_TEXT_LEFT); }
214 void SetJustificationToCentered() { this->SetJustification(VTK_TEXT_CENTERED); }
215 void SetJustificationToRight() { this->SetJustification(VTK_TEXT_RIGHT); }
216 const char* GetJustificationAsString();
218
220
224 vtkSetClampMacro(VerticalJustification, int, VTK_TEXT_BOTTOM, VTK_TEXT_TOP);
225 vtkGetMacro(VerticalJustification, int);
226 void SetVerticalJustificationToBottom() { this->SetVerticalJustification(VTK_TEXT_BOTTOM); }
227 void SetVerticalJustificationToCentered() { this->SetVerticalJustification(VTK_TEXT_CENTERED); }
228 void SetVerticalJustificationToTop() { this->SetVerticalJustification(VTK_TEXT_TOP); }
229 const char* GetVerticalJustificationAsString();
231
233
239 vtkSetMacro(UseTightBoundingBox, vtkTypeBool);
240 vtkGetMacro(UseTightBoundingBox, vtkTypeBool);
241 vtkBooleanMacro(UseTightBoundingBox, vtkTypeBool);
243
245
248 vtkSetMacro(Orientation, double);
249 vtkGetMacro(Orientation, double);
251
253
257 vtkSetMacro(LineSpacing, double);
258 vtkGetMacro(LineSpacing, double);
260
262
265 vtkSetMacro(LineOffset, double);
266 vtkGetMacro(LineOffset, double);
268
270
274 vtkSetMacro(CellOffset, double);
275 vtkGetMacro(CellOffset, double);
277
282
283protected:
286
287 double Color[3];
288 double Opacity;
289 double BackgroundColor[3];
292 double FrameColor[3];
295 char* FontFile;
300 int ShadowOffset[2];
308
309private:
310 vtkTextProperty(const vtkTextProperty&) = delete;
311 void operator=(const vtkTextProperty&) = delete;
312};
313
315{
316 if (f == VTK_ARIAL)
317 {
318 return "Arial";
319 }
320 else if (f == VTK_COURIER)
321 {
322 return "Courier";
323 }
324 else if (f == VTK_TIMES)
325 {
326 return "Times";
327 }
328 else if (f == VTK_FONT_FILE)
329 {
330 return "File";
331 }
332 return "Unknown";
333}
334
336{
338}
339
341{
343}
344
346{
348}
349
351{
353}
354
356{
357 if (strcmp(f, GetFontFamilyAsString(VTK_ARIAL)) == 0)
358 {
359 return VTK_ARIAL;
360 }
361 else if (strcmp(f, GetFontFamilyAsString(VTK_COURIER)) == 0)
362 {
363 return VTK_COURIER;
364 }
365 else if (strcmp(f, GetFontFamilyAsString(VTK_TIMES)) == 0)
366 {
367 return VTK_TIMES;
368 }
369 else if (strcmp(f, GetFontFamilyAsString(VTK_FONT_FILE)) == 0)
370 {
371 return VTK_FONT_FILE;
372 }
373 return VTK_UNKNOWN_FONT;
374}
375
377{
379}
380
382{
383 if (this->Justification == VTK_TEXT_LEFT)
384 {
385 return "Left";
386 }
387 else if (this->Justification == VTK_TEXT_CENTERED)
388 {
389 return "Centered";
390 }
391 else if (this->Justification == VTK_TEXT_RIGHT)
392 {
393 return "Right";
394 }
395 return "Unknown";
396}
397
399{
401 {
402 return "Bottom";
403 }
405 {
406 return "Centered";
407 }
408 else if (this->VerticalJustification == VTK_TEXT_TOP)
409 {
410 return "Top";
411 }
412 return "Unknown";
413}
414
415#endif
a simple class to control print indentation
Definition: vtkIndent.h:43
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