26 #ifndef vtkFreeTypeTools_h
27 #define vtkFreeTypeTools_h
29 #include "vtkRenderingFreeTypeModule.h"
40 #include "vtk_freetype.h"
41 #include FT_FREETYPE_H
48 class vtkTextPropertyLookup;
87 vtkGetMacro(DebugTextures,
bool)
94 FT_Library* GetLibrary();
103 vtkGetMacro(MaximumNumberOfFaces,
unsigned int);
104 vtkSetClampMacro(MaximumNumberOfSizes,
unsigned int,1,VTK_UNSIGNED_INT_MAX);
105 vtkGetMacro(MaximumNumberOfSizes,
unsigned int);
107 vtkGetMacro(MaximumNumberOfBytes,
unsigned long);
120 int dpi,
int bbox[4]);
122 int dpi,
int bbox[4]);
173 int dpi,
int targetWidth,
int targetHeight);
176 int targetWidth,
int targetHeight);
183 static vtkTypeUInt16 HashString(const
char *str);
189 static vtkTypeUInt32 HashBuffer(const
void* str,
size_t n, vtkTypeUInt32 hash = 0);
202 void MapTextPropertyToId(
vtkTextProperty *tprop,
size_t *tprop_cache_id);
203 void MapIdToTextProperty(
size_t tprop_cache_id,
vtkTextProperty *tprop);
214 vtkGetMacro(ScaleToPowerTwo,
bool);
225 vtkGetMacro(ForceCompiledFonts,
bool);
235 static
bool LookupFace(
vtkTextProperty *tprop, FT_Library lib, FT_Face *face);
241 virtual FT_Error CreateFTCManager();
249 bool PrepareMetaData(
vtkTextProperty *tprop,
int dpi, MetaData &metaData);
251 ImageMetaData &metaData);
264 ImageMetaData &metaData);
288 bool GetGlyphIndex(
vtkTextProperty *tprop, FT_UInt32 c, FT_UInt *gindex);
305 GLYPH_REQUEST_DEFAULT = 0,
306 GLYPH_REQUEST_BITMAP = 1,
307 GLYPH_REQUEST_OUTLINE = 2
312 int request = GLYPH_REQUEST_DEFAULT);
313 bool GetSize(
size_t tprop_cache_id,
int font_size, FT_Size *
size);
314 bool GetSize(FTC_Scaler scaler, FT_Size *
size);
315 bool GetFace(
size_t tprop_cache_id, FT_Face *face);
316 bool GetGlyphIndex(
size_t tprop_cache_id, FT_UInt32 c,
318 bool GetGlyph(
size_t tprop_cache_id,
322 int request = GLYPH_REQUEST_DEFAULT);
323 bool GetGlyph(FTC_Scaler scaler,
326 int request = GLYPH_REQUEST_DEFAULT);
341 FT_Face &face,
bool &face_has_kerning);
347 FT_Bitmap* GetBitmap(FT_UInt32 c,
size_t prop_cache_id,
348 int prop_font_size, FT_UInt &gindex,
349 FT_BitmapGlyph &bitmap_glyph);
350 FT_Bitmap* GetBitmap(FT_UInt32 c, FTC_Scaler scaler, FT_UInt &gindex,
351 FT_BitmapGlyph &bitmap_glyph);
358 FT_Outline* GetOutline(FT_UInt32 c,
size_t prop_cache_id,
359 int prop_font_size, FT_UInt &gindex,
360 FT_OutlineGlyph &outline_glyph);
361 FT_Outline* GetOutline(FT_UInt32 c, FTC_Scaler scaler, FT_UInt &gindex,
362 FT_OutlineGlyph &outline_glyph);
373 vtkTextPropertyLookup *TextPropertyLookup;
384 FTC_Manager *CacheManager;
385 FTC_ImageCache *ImageCache;
386 FTC_CMapCache *CMapCache;
393 FTC_Manager* GetCacheManager();
394 FTC_ImageCache* GetImageCache();
395 FTC_CMapCache* GetCMapCache();
398 unsigned int MaximumNumberOfFaces;
399 unsigned int MaximumNumberOfSizes;
400 unsigned long MaximumNumberOfBytes;
402 bool ForceCompiledFonts;
405 void InitializeCacheManager();
406 void ReleaseCacheManager();
415 template <typename StringType>
416 bool RenderStringInternal(
vtkTextProperty *tprop, const StringType &str,
422 template <typename StringType>
423 bool StringToPathInternal(
vtkTextProperty *tprop, const StringType &str,
431 bool CalculateBoundingBox(const
vtkStdString& str, MetaData &metaData);
433 template <typename T>
434 bool CalculateBoundingBox(const T& str, MetaData &metaData, const T& defaultHeightString);
442 template <typename StringType, typename DataType>
443 bool PopulateData(const StringType& str, DataType data, MetaData &metaData);
448 template <typename IteratorType, typename DataType>
449 bool RenderLine(IteratorType begin, IteratorType end,
int lineIndex,
450 DataType data, MetaData &metaData);
456 template <typename CharType>
457 bool RenderCharacter(CharType character,
int &x,
int &y,
460 template <typename CharType>
461 bool RenderCharacter(CharType character,
int &x,
int &y,
462 FT_UInt &previousGlyphIndex,
vtkPath *path,
471 template <typename T>
472 int FitStringToBBox(const T &str, MetaData &metaData,
int targetWidth,
484 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.