26 #ifndef vtkFreeTypeTools_h
27 #define vtkFreeTypeTools_h
30 #include "vtkRenderingFreeTypeModule.h"
43 #include "vtk_freetype.h"
44 #include FT_FREETYPE_H
51 class vtkTextPropertyLookup;
108 vtkSetMacro(DebugTextures,
bool);
109 vtkGetMacro(DebugTextures,
bool);
110 vtkBooleanMacro(DebugTextures,
bool);
148 vtkGetMacro(MaximumNumberOfFaces,
unsigned int);
150 vtkGetMacro(MaximumNumberOfSizes,
unsigned int);
152 vtkGetMacro(MaximumNumberOfBytes,
unsigned long);
191 int textDims[2] =
nullptr);
216 int targetWidth,
int targetHeight);
229 static vtkTypeUInt32
HashBuffer(
const void* str,
size_t n, vtkTypeUInt32 hash = 0);
253 vtkSetMacro(ScaleToPowerTwo,
bool);
254 vtkGetMacro(ScaleToPowerTwo,
bool);
255 vtkBooleanMacro(ScaleToPowerTwo,
bool);
264 vtkSetMacro(ForceCompiledFonts,
bool);
265 vtkGetMacro(ForceCompiledFonts,
bool);
266 vtkBooleanMacro(ForceCompiledFonts,
bool);
343 GLYPH_REQUEST_DEFAULT = 0,
344 GLYPH_REQUEST_BITMAP = 1,
345 GLYPH_REQUEST_OUTLINE = 2
348 vtkTextProperty* tprop, FT_UInt32 c, FT_Glyph* glyph,
int request = GLYPH_REQUEST_DEFAULT);
349 bool GetSize(
size_t tprop_cache_id,
int font_size, FT_Size*
size);
351 bool GetFace(
size_t tprop_cache_id, FT_Face* face);
353 bool GetGlyph(
size_t tprop_cache_id,
int font_size, FT_UInt gindex, FT_Glyph* glyph,
354 int request = GLYPH_REQUEST_DEFAULT);
356 FTC_Scaler scaler, FT_UInt gindex, FT_Glyph* glyph,
int request = GLYPH_REQUEST_DEFAULT);
376 FT_Bitmap*
GetBitmap(FT_UInt32 c,
size_t prop_cache_id,
int prop_font_size, FT_UInt& gindex,
377 FT_BitmapGlyph& bitmap_glyph);
379 FT_UInt32 c, FTC_Scaler scaler, FT_UInt& gindex, FT_BitmapGlyph& bitmap_glyph);
386 FT_Outline*
GetOutline(FT_UInt32 c,
size_t prop_cache_id,
int prop_font_size, FT_UInt& gindex,
387 FT_OutlineGlyph& outline_glyph);
389 FT_UInt32 c, FTC_Scaler scaler, FT_UInt& gindex, FT_OutlineGlyph& outline_glyph);
442 template <
typename StringType>
443 bool RenderStringInternal(
449 template <
typename StringType>
457 bool CalculateBoundingBox(
const vtkStdString& str, MetaData& metaData);
459 template <
typename T>
460 bool CalculateBoundingBox(
const T& str, MetaData& metaData,
const T& defaultHeightString);
468 template <
typename StringType,
typename DataType>
469 bool PopulateData(
const StringType& str, DataType
data, MetaData& metaData);
474 template <
typename IteratorType,
typename DataType>
476 IteratorType begin, IteratorType end,
int lineIndex, DataType
data, MetaData& metaData);
482 template <
typename CharType>
483 bool RenderCharacter(CharType character,
int& x,
int& y, FT_UInt& previousGlyphIndex,
485 template <
typename CharType>
486 bool RenderCharacter(CharType character,
int& x,
int& y, FT_UInt& previousGlyphIndex,
487 vtkPath* path, MetaData& metaData);
490 void OutlineToPath(
int x,
int y, FT_Outline* outline,
vtkPath* path);
497 template <
typename T>
498 int FitStringToBBox(
const T& str, MetaData& metaData,
int targetWidth,
int targetHeight);
508 template <
typename T>
509 void GetLineMetrics(T begin, T end, MetaData& metaData,
int& width,
int bbox[4]);
topologically and geometrically regular array of data
a simple class to control print indentation
abstract base class for most VTK objects
concrete dataset representing a path defined by Bezier curves.
Wrapper around std::string to keep symbols short.
represent text properties.
String class that stores Unicode text.
#define VTK_UNSIGNED_LONG_MAX
#define VTK_UNSIGNED_INT_MAX
vtkTypeUInt32 vtkUnicodeStringValueType