29 #ifndef vtkFreeTypeTools_h
30 #define vtkFreeTypeTools_h
32 #include "vtkRenderingFreeTypeModule.h"
43 #include "vtk_freetype.h"
44 #include FT_FREETYPE_H
51 class vtkTextPropertyLookup;
90 vtkGetMacro(DebugTextures,
bool)
97 FT_Library* GetLibrary();
106 vtkGetMacro(MaximumNumberOfFaces,
unsigned int);
107 vtkSetClampMacro(MaximumNumberOfSizes,
unsigned int,1,VTK_UNSIGNED_INT_MAX);
108 vtkGetMacro(MaximumNumberOfSizes,
unsigned int);
110 vtkGetMacro(MaximumNumberOfBytes,
unsigned long);
123 int dpi,
int bbox[4]);
125 int dpi,
int bbox[4]);
176 int dpi,
int targetWidth,
int targetHeight);
179 int targetWidth,
int targetHeight);
186 static vtkTypeUInt16 HashString(const
char *str);
192 static vtkTypeUInt32 HashBuffer(const
void* str,
size_t n, vtkTypeUInt32 hash = 0);
205 void MapTextPropertyToId(
vtkTextProperty *tprop,
size_t *tprop_cache_id);
206 void MapIdToTextProperty(
size_t tprop_cache_id,
vtkTextProperty *tprop);
217 vtkGetMacro(ScaleToPowerTwo,
bool);
228 vtkGetMacro(ForceCompiledFonts,
bool);
238 static
bool LookupFace(
vtkTextProperty *tprop, FT_Library lib, FT_Face *face);
244 virtual FT_Error CreateFTCManager();
252 bool PrepareMetaData(
vtkTextProperty *tprop,
int dpi, MetaData &metaData);
254 ImageMetaData &metaData);
267 ImageMetaData &metaData);
291 bool GetGlyphIndex(
vtkTextProperty *tprop, FT_UInt32 c, FT_UInt *gindex);
308 GLYPH_REQUEST_DEFAULT = 0,
309 GLYPH_REQUEST_BITMAP = 1,
310 GLYPH_REQUEST_OUTLINE = 2
315 int request = GLYPH_REQUEST_DEFAULT);
316 bool GetSize(
size_t tprop_cache_id,
int font_size, FT_Size *
size);
317 bool GetSize(FTC_Scaler scaler, FT_Size *
size);
318 bool GetFace(
size_t tprop_cache_id, FT_Face *face);
319 bool GetGlyphIndex(
size_t tprop_cache_id, FT_UInt32 c,
321 bool GetGlyph(
size_t tprop_cache_id,
325 int request = GLYPH_REQUEST_DEFAULT);
326 bool GetGlyph(FTC_Scaler scaler,
329 int request = GLYPH_REQUEST_DEFAULT);
344 FT_Face &face,
bool &face_has_kerning);
350 FT_Bitmap* GetBitmap(FT_UInt32 c,
size_t prop_cache_id,
351 int prop_font_size, FT_UInt &gindex,
352 FT_BitmapGlyph &bitmap_glyph);
353 FT_Bitmap* GetBitmap(FT_UInt32 c, FTC_Scaler scaler, FT_UInt &gindex,
354 FT_BitmapGlyph &bitmap_glyph);
361 FT_Outline* GetOutline(FT_UInt32 c,
size_t prop_cache_id,
362 int prop_font_size, FT_UInt &gindex,
363 FT_OutlineGlyph &outline_glyph);
364 FT_Outline* GetOutline(FT_UInt32 c, FTC_Scaler scaler, FT_UInt &gindex,
365 FT_OutlineGlyph &outline_glyph);
396 FTC_Manager* GetCacheManager();
397 FTC_ImageCache* GetImageCache();
398 FTC_CMapCache* GetCMapCache();
408 void InitializeCacheManager();
409 void ReleaseCacheManager();
418 template <typename StringType>
419 bool RenderStringInternal(
vtkTextProperty *tprop, const StringType &str,
425 template <typename StringType>
426 bool StringToPathInternal(
vtkTextProperty *tprop, const StringType &str,
434 bool CalculateBoundingBox(const
vtkStdString& str, MetaData &metaData);
436 template <typename T>
437 bool CalculateBoundingBox(const T& str, MetaData &metaData, const T& defaultHeightString);
445 template <typename StringType, typename DataType>
446 bool PopulateData(const StringType& str, DataType data, MetaData &metaData);
451 template <typename IteratorType, typename DataType>
452 bool RenderLine(IteratorType begin, IteratorType end,
int lineIndex,
453 DataType data, MetaData &metaData);
459 template <typename CharType>
460 bool RenderCharacter(CharType character,
int &x,
int &y,
463 template <typename CharType>
464 bool RenderCharacter(CharType character,
int &x,
int &y,
465 FT_UInt &previousGlyphIndex,
vtkPath *path,
474 template <typename T>
475 int FitStringToBBox(const T &str, MetaData &metaData,
int targetWidth,
487 void GetLineMetrics(T begin, T end, MetaData &metaData,
int &width,
Wrapper around std::string to keep symbols short.
abstract base class for most VTK objects
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.
#define VTK_UNSIGNED_LONG_MAX
a simple class to control print indentation
topologically and geometrically regular array of data
#define VTK_UNSIGNED_INT_MAX
represent text properties.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Interface for generating images and path data from string data, using multiple backends.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
String class that stores Unicode text.