Go to the documentation of this file.
46 #ifndef vtkTextRenderer_h
47 #define vtkTextRenderer_h
49 #include "vtkRenderingCoreModule.h"
61 class RegularExpression;
85 TopLeft(0), TopRight(0), BottomLeft(0), BottomRight(0)
148 vtkGetMacro(DefaultBackend,
int)
162 virtual
bool FreeTypeIsSupported() {
return false; }
174 int bbox[4],
int dpi,
int backend = Default)
176 return this->GetBoundingBoxInternal(tprop, str, bbox, dpi, backend);
179 int bbox[4],
int dpi,
int backend = Default)
181 return this->GetBoundingBoxInternal(tprop, str, bbox, dpi, backend);
193 Metrics &metrics,
int dpi,
int backend = Default)
195 return this->GetMetricsInternal(tprop, str, metrics, dpi, backend);
198 Metrics &metrics,
int dpi,
int backend = Default)
200 return this->GetMetricsInternal(tprop, str, metrics, dpi, backend);
221 int backend = Default)
223 return this->RenderStringInternal(tprop, str,
data, textDims, dpi, backend);
227 int backend = Default)
229 return this->RenderStringInternal(tprop, str,
data, textDims, dpi, backend);
241 int targetWidth,
int targetHeight,
int dpi,
242 int backend = Default)
244 return this->GetConstrainedFontSizeInternal(str, tprop, targetWidth,
245 targetHeight, dpi, backend);
248 int targetWidth,
int targetHeight,
int dpi,
249 int backend = Default)
251 return this->GetConstrainedFontSizeInternal(str, tprop, targetWidth,
252 targetHeight, dpi, backend);
265 vtkPath *path,
int dpi,
int backend = Default)
267 return this->StringToPathInternal(tprop, str, path, dpi, backend);
270 vtkPath *path,
int dpi,
int backend = Default)
272 return this->StringToPathInternal(tprop, str, path, dpi, backend);
284 this->SetScaleToPowerOfTwoInternal(
scale);
299 int bbox[4],
int dpi,
int backend) = 0;
302 int bbox[4],
int dpi,
int backend) = 0;
305 Metrics &metrics,
int dpi,
int backend) = 0;
308 Metrics &metrics,
int dpi,
int backend) = 0;
312 int dpi,
int backend) = 0;
316 int dpi,
int backend) = 0;
319 int targetWidth,
int targetHeight,
320 int dpi,
int backend) = 0;
323 int targetWidth,
int targetHeight,
324 int dpi,
int backend) = 0;
327 int dpi,
int backend) = 0;
330 int dpi,
int backend) = 0;
369 #endif //vtkTextRenderer_h
Backend
Available backends.
void SetScaleToPowerOfTwo(bool scale)
Set to true if the graphics implmentation requires texture image dimensions to be a power of two.
virtual bool GetMetricsInternal(vtkTextProperty *tprop, const vtkUnicodeString &str, Metrics &metrics, int dpi, int backend)=0
Metrics()
Construct a Metrics object with all members initialized to 0.
int GetConstrainedFontSize(const vtkStdString &str, vtkTextProperty *tprop, int targetWidth, int targetHeight, int dpi, int backend=Default)
This function returns the font size (in points) and sets the size in tprop that is required to fit th...
virtual bool GetBoundingBoxInternal(vtkTextProperty *tprop, const vtkStdString &str, int bbox[4], int dpi, int backend)=0
Virtual methods for concrete implementations of the public methods.
virtual void CleanUpFreeTypeEscapes(vtkStdString &str)
Replace all instances of "\$" with "$".
virtual bool GetBoundingBoxInternal(vtkTextProperty *tprop, const vtkUnicodeString &str, int bbox[4], int dpi, int backend)=0
static vtkTextRendererCleanup Cleanup
virtual bool MathTextIsSupported()
concrete dataset representing a path defined by Bezier curves.
abstract base class for most VTK objects
static vtkTextRenderer * Instance
The singleton instance and the singleton cleanup instance.
virtual bool RenderStringInternal(vtkTextProperty *tprop, const vtkStdString &str, vtkImageData *data, int textDims[2], int dpi, int backend)=0
static void SetInstance(vtkTextRenderer *instance)
Set the singleton instance.
virtual int GetConstrainedFontSizeInternal(const vtkUnicodeString &str, vtkTextProperty *tprop, int targetWidth, int targetHeight, int dpi, int backend)=0
vtkVector2i TopLeft
The corners of the rendered text (or background, if applicable), in pixels.
vtksys::RegularExpression * MathTextRegExp
bool GetBoundingBox(vtkTextProperty *tprop, const vtkStdString &str, int bbox[4], int dpi, int backend=Default)
Given a text property and a string, get the bounding box {xmin, xmax, ymin, ymax} of the rendered str...
bool GetMetrics(vtkTextProperty *tprop, const vtkUnicodeString &str, Metrics &metrics, int dpi, int backend=Default)
virtual void SetScaleToPowerOfTwoInternal(bool scale)=0
bool StringToPath(vtkTextProperty *tprop, const vtkUnicodeString &str, vtkPath *path, int dpi, int backend=Default)
vtksys::RegularExpression * MathTextRegExp2
int DefaultBackend
The backend to use when none is specified.
virtual bool RenderStringInternal(vtkTextProperty *tprop, const vtkUnicodeString &str, vtkImageData *data, int textDims[2], int dpi, int backend)=0
virtual bool StringToPathInternal(vtkTextProperty *tprop, const vtkStdString &str, vtkPath *path, int dpi, int backend)=0
bool GetBoundingBox(vtkTextProperty *tprop, const vtkUnicodeString &str, int bbox[4], int dpi, int backend=Default)
topologically and geometrically regular array of data
a simple class to control print indentation
String class that stores Unicode text.
bool RenderString(vtkTextProperty *tprop, const vtkUnicodeString &str, vtkImageData *data, int textDims[2], int dpi, int backend=Default)
vtkTuple< int, 4 > BoundingBox
The axis-aligned bounding box of the rendered text and background, in pixels.
bool GetMetrics(vtkTextProperty *tprop, const vtkStdString &str, Metrics &metrics, int dpi, int backend=Default)
Given a text property and a string, get some metrics for the rendered string.
bool StringToPath(vtkTextProperty *tprop, const vtkStdString &str, vtkPath *path, int dpi, int backend=Default)
Given a text property and a string, this function populates the vtkPath path with the outline of the ...
virtual bool GetMetricsInternal(vtkTextProperty *tprop, const vtkStdString &str, Metrics &metrics, int dpi, int backend)=0
virtual void CleanUpFreeTypeEscapes(vtkUnicodeString &str)
represent text properties.
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
Interface for generating images and path data from string data, using multiple backends.
virtual bool StringToPathInternal(vtkTextProperty *tprop, const vtkUnicodeString &str, vtkPath *path, int dpi, int backend)=0
~vtkTextRendererCleanup()
Some derived classes for the different vectors commonly used.
Wrapper around std::string to keep symbols short.
int GetConstrainedFontSize(const vtkUnicodeString &str, vtkTextProperty *tprop, int targetWidth, int targetHeight, int dpi, int backend=Default)
virtual int GetConstrainedFontSizeInternal(const vtkStdString &str, vtkTextProperty *tprop, int targetWidth, int targetHeight, int dpi, int backend)=0
bool RenderString(vtkTextProperty *tprop, const vtkStdString &str, vtkImageData *data, int textDims[2], int dpi, int backend=Default)
Given a text property and a string, this function initializes the vtkImageData *data and renders it i...