VTK  9.4.20250221
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
127#ifndef vtkTextProperty_h
128#define vtkTextProperty_h
129
130#include "vtkObject.h"
131#include "vtkRenderingCoreModule.h" // For export macro
132#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
133
134VTK_ABI_NAMESPACE_BEGIN
135class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkTextProperty : public vtkObject
136{
137public:
139 void PrintSelf(ostream& os, vtkIndent indent) override;
140
146
148
151 vtkSetVector3Macro(Color, double);
152 vtkGetVector3Macro(Color, double);
154
156
160 vtkSetClampMacro(Opacity, double, 0., 1.);
161 vtkGetMacro(Opacity, double);
163
165
168 vtkSetVector3Macro(BackgroundColor, double);
169 vtkGetVector3Macro(BackgroundColor, double);
171
173
177 vtkSetClampMacro(BackgroundOpacity, double, 0., 1.);
178 vtkGetMacro(BackgroundOpacity, double);
180
182
186 void SetBackgroundRGBA(double rgba[4]);
188 void SetBackgroundRGBA(double r, double g, double b, double a);
189
194 void GetBackgroundRGBA(double rgba[4]);
196 void GetBackgroundRGBA(double& r, double& g, double& b, double& a);
198
200
203 vtkSetVector3Macro(FrameColor, double);
204 vtkGetVector3Macro(FrameColor, double);
206
208
211 vtkSetMacro(Frame, vtkTypeBool);
212 vtkGetMacro(Frame, vtkTypeBool);
213 vtkBooleanMacro(Frame, vtkTypeBool);
215
217
221 vtkSetClampMacro(FrameWidth, int, 0, VTK_INT_MAX);
222 vtkGetMacro(FrameWidth, int);
224
226
232 vtkGetStringMacro(FontFamilyAsString);
233 vtkSetStringMacro(FontFamilyAsString);
234 void SetFontFamily(int t);
235 int GetFontFamily();
236 int GetFontFamilyMinValue() { return VTK_ARIAL; }
237 void SetFontFamilyToArial();
238 void SetFontFamilyToCourier();
239 void SetFontFamilyToTimes();
240 static int GetFontFamilyFromString(const char* f);
241 static const char* GetFontFamilyAsString(int f);
243
245
253
255
258 vtkSetClampMacro(FontSize, int, 0, VTK_INT_MAX);
259 vtkGetMacro(FontSize, int);
261
263
266 vtkSetMacro(Bold, vtkTypeBool);
267 vtkGetMacro(Bold, vtkTypeBool);
268 vtkBooleanMacro(Bold, vtkTypeBool);
270
272
275 vtkSetMacro(Italic, vtkTypeBool);
276 vtkGetMacro(Italic, vtkTypeBool);
277 vtkBooleanMacro(Italic, vtkTypeBool);
279
281
284 vtkSetMacro(Shadow, vtkTypeBool);
285 vtkGetMacro(Shadow, vtkTypeBool);
286 vtkBooleanMacro(Shadow, vtkTypeBool);
288
290
294 vtkSetVector2Macro(ShadowOffset, int);
295 vtkGetVectorMacro(ShadowOffset, int, 2);
297
301 void GetShadowColor(double color[3]);
302
304
308 vtkSetClampMacro(Justification, int, VTK_TEXT_LEFT, VTK_TEXT_RIGHT);
309 vtkGetMacro(Justification, int);
310 void SetJustificationToLeft() { this->SetJustification(VTK_TEXT_LEFT); }
311 void SetJustificationToCentered() { this->SetJustification(VTK_TEXT_CENTERED); }
312 void SetJustificationToRight() { this->SetJustification(VTK_TEXT_RIGHT); }
313 const char* GetJustificationAsString();
315
317
321 vtkSetClampMacro(VerticalJustification, int, VTK_TEXT_BOTTOM, VTK_TEXT_TOP);
322 vtkGetMacro(VerticalJustification, int);
323 void SetVerticalJustificationToBottom() { this->SetVerticalJustification(VTK_TEXT_BOTTOM); }
324 void SetVerticalJustificationToCentered() { this->SetVerticalJustification(VTK_TEXT_CENTERED); }
325 void SetVerticalJustificationToTop() { this->SetVerticalJustification(VTK_TEXT_TOP); }
326 const char* GetVerticalJustificationAsString();
328
330
336 vtkSetMacro(UseTightBoundingBox, vtkTypeBool);
337 vtkGetMacro(UseTightBoundingBox, vtkTypeBool);
338 vtkBooleanMacro(UseTightBoundingBox, vtkTypeBool);
340
342
345 vtkSetMacro(Orientation, double);
346 vtkGetMacro(Orientation, double);
348
350
354 vtkSetMacro(LineSpacing, double);
355 vtkGetMacro(LineSpacing, double);
357
359
362 vtkSetMacro(LineOffset, double);
363 vtkGetMacro(LineOffset, double);
365
367
371 vtkSetMacro(CellOffset, double);
372 vtkGetMacro(CellOffset, double);
374
376
380 vtkSetMacro(InteriorLinesVisibility, bool);
381 vtkGetMacro(InteriorLinesVisibility, bool);
383
385
389 vtkSetMacro(InteriorLinesWidth, int);
390 vtkGetMacro(InteriorLinesWidth, int);
392
394
398 vtkSetVector3Macro(InteriorLinesColor, double);
399 vtkGetVector3Macro(InteriorLinesColor, double);
401
406
407protected:
410
411 double Color[3];
412 double Opacity;
413 double BackgroundColor[3];
416 double FrameColor[3];
419 char* FontFile;
424 int ShadowOffset[2];
432 bool InteriorLinesVisibility = false;
433 int InteriorLinesWidth = 1;
434 double InteriorLinesColor[3] = { 0.0, 0.0, 0.0 };
435
436private:
437 vtkTextProperty(const vtkTextProperty&) = delete;
438 void operator=(const vtkTextProperty&) = delete;
439};
440
442{
443 if (f == VTK_ARIAL)
444 {
445 return "Arial";
446 }
447 else if (f == VTK_COURIER)
448 {
449 return "Courier";
450 }
451 else if (f == VTK_TIMES)
452 {
453 return "Times";
454 }
455 else if (f == VTK_FONT_FILE)
456 {
457 return "File";
458 }
459 return "Unknown";
460}
461
463{
465}
466
468{
470}
471
473{
475}
476
478{
480}
481
483{
484 if (strcmp(f, GetFontFamilyAsString(VTK_ARIAL)) == 0)
485 {
486 return VTK_ARIAL;
487 }
488 else if (strcmp(f, GetFontFamilyAsString(VTK_COURIER)) == 0)
489 {
490 return VTK_COURIER;
491 }
492 else if (strcmp(f, GetFontFamilyAsString(VTK_TIMES)) == 0)
493 {
494 return VTK_TIMES;
495 }
496 else if (strcmp(f, GetFontFamilyAsString(VTK_FONT_FILE)) == 0)
497 {
498 return VTK_FONT_FILE;
499 }
500 return VTK_UNKNOWN_FONT;
501}
502
504{
506}
507
509{
510 if (this->Justification == VTK_TEXT_LEFT)
511 {
512 return "Left";
513 }
514 else if (this->Justification == VTK_TEXT_CENTERED)
515 {
516 return "Centered";
517 }
518 else if (this->Justification == VTK_TEXT_RIGHT)
519 {
520 return "Right";
521 }
522 return "Unknown";
523}
524
526{
528 {
529 return "Bottom";
530 }
532 {
533 return "Centered";
534 }
535 else if (this->VerticalJustification == VTK_TEXT_TOP)
536 {
537 return "Top";
538 }
539 return "Unknown";
540}
541
542VTK_ABI_NAMESPACE_END
543#endif
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
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.
int GetFontFamily()
Set/Get the font family.
void SetJustificationToLeft()
Set/Get the horizontal justification to left (default), centered, or right.
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 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 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 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
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)