VTK
vtkMathTextUtilities.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMathTextUtilities.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 =========================================================================*/
24 #ifndef vtkMathTextUtilities_h
25 #define vtkMathTextUtilities_h
26 
27 #include "vtkRenderingFreeTypeModule.h" // For export macro
28 #include "vtkObject.h"
29 #include "vtkTextRenderer.h" // for metrics
30 
31 class vtkImageData;
32 class vtkPath;
33 class vtkTextProperty;
34 class vtkTextActor;
35 class vtkViewport;
36 
37 //----------------------------------------------------------------------------
38 // Singleton cleanup
39 
40 class VTKRENDERINGFREETYPE_EXPORT vtkMathTextUtilitiesCleanup
41 {
42 public:
45 
46 private:
47  vtkMathTextUtilitiesCleanup(const vtkMathTextUtilitiesCleanup& other) VTK_DELETE_FUNCTION;
48  vtkMathTextUtilitiesCleanup& operator=(const vtkMathTextUtilitiesCleanup& rhs) VTK_DELETE_FUNCTION;
49 };
50 
51 class VTKRENDERINGFREETYPE_EXPORT vtkMathTextUtilities : public vtkObject
52 {
53 public:
55  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
56 
60  virtual bool IsAvailable() { return false; } // Override in subclasses.
61 
70  static vtkMathTextUtilities *New();
71 
75  static vtkMathTextUtilities* GetInstance();
76 
81  static void SetInstance(vtkMathTextUtilities *instance);
82 
87  virtual bool GetBoundingBox(vtkTextProperty *tprop, const char *str, int dpi,
88  int bbox[4]) = 0;
89 
93  virtual bool GetMetrics(vtkTextProperty *tprop, const char *str, int dpi,
94  vtkTextRenderer::Metrics &metrics) = 0;
95 
103  virtual bool RenderString(const char *str, vtkImageData *data,
104  vtkTextProperty *tprop, int dpi,
105  int textDims[2] = NULL) = 0;
106 
111  virtual bool StringToPath(const char *str, vtkPath *path,
112  vtkTextProperty *tprop, int dpi) = 0;
113 
120  virtual int GetConstrainedFontSize(const char *str,
121  vtkTextProperty *tprop,
122  int targetWidth, int targetHeight,
123  int dpi);
124 
126 
131  virtual bool GetScaleToPowerOfTwo() = 0;
132  virtual void SetScaleToPowerOfTwo(bool scale) = 0;
134 
135 protected:
137  ~vtkMathTextUtilities() VTK_OVERRIDE;
138 
139 private:
140  vtkMathTextUtilities(const vtkMathTextUtilities&) VTK_DELETE_FUNCTION;
141  void operator=(const vtkMathTextUtilities&) VTK_DELETE_FUNCTION;
142 
144 
147  static vtkMathTextUtilities* Instance;
148  static vtkMathTextUtilitiesCleanup Cleanup;
149 };
151 
152 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:53
virtual bool IsAvailable()
Returns true if mathtext rendering is available.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
concrete dataset representing a path defined by Bezier curves.
Definition: vtkPath.h:32
abstract specification for Viewports
Definition: vtkViewport.h:44
An actor that displays text.
Definition: vtkTextActor.h:50
a simple class to control print indentation
Definition: vtkIndent.h:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
represent text properties.
Abstract interface to equation rendering.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...