29 #ifndef vtkFreeTypeTools_h 30 #define vtkFreeTypeTools_h 32 #include "vtkRenderingFreeTypeModule.h" 46 #include "vtk_freetype.h" 47 #include FT_FREETYPE_H 54 class vtkTextPropertyLookup;
111 vtkGetMacro(DebugTextures,
bool)
118 FT_Library* GetLibrary();
152 vtkGetMacro(MaximumNumberOfFaces,
unsigned int);
154 vtkGetMacro(MaximumNumberOfSizes,
unsigned int);
156 vtkGetMacro(MaximumNumberOfBytes,
unsigned long);
169 int dpi,
int bbox[4]);
171 int dpi,
int bbox[4]);
222 int dpi,
int targetWidth,
int targetHeight);
225 int targetWidth,
int targetHeight);
232 static vtkTypeUInt16 HashString(
const char *str);
238 static vtkTypeUInt32 HashBuffer(
const void* str,
size_t n, vtkTypeUInt32 hash = 0);
251 void MapTextPropertyToId(
vtkTextProperty *tprop,
size_t *tprop_cache_id);
252 void MapIdToTextProperty(
size_t tprop_cache_id,
vtkTextProperty *tprop);
263 vtkGetMacro(ScaleToPowerTwo,
bool);
274 vtkGetMacro(ForceCompiledFonts,
bool);
284 static bool LookupFace(
vtkTextProperty *tprop, FT_Library lib, FT_Face *face);
290 virtual FT_Error CreateFTCManager();
298 bool PrepareMetaData(
vtkTextProperty *tprop,
int dpi, MetaData &metaData);
300 ImageMetaData &metaData);
313 ImageMetaData &metaData);
337 bool GetGlyphIndex(
vtkTextProperty *tprop, FT_UInt32 c, FT_UInt *gindex);
354 GLYPH_REQUEST_DEFAULT = 0,
355 GLYPH_REQUEST_BITMAP = 1,
356 GLYPH_REQUEST_OUTLINE = 2
361 int request = GLYPH_REQUEST_DEFAULT);
362 bool GetSize(
size_t tprop_cache_id,
int font_size, FT_Size *
size);
363 bool GetSize(FTC_Scaler scaler, FT_Size *
size);
364 bool GetFace(
size_t tprop_cache_id, FT_Face *face);
365 bool GetGlyphIndex(
size_t tprop_cache_id, FT_UInt32 c,
367 bool GetGlyph(
size_t tprop_cache_id,
371 int request = GLYPH_REQUEST_DEFAULT);
372 bool GetGlyph(FTC_Scaler scaler,
375 int request = GLYPH_REQUEST_DEFAULT);
390 FT_Face &face,
bool &face_has_kerning);
396 FT_Bitmap* GetBitmap(FT_UInt32 c,
size_t prop_cache_id,
397 int prop_font_size, FT_UInt &gindex,
398 FT_BitmapGlyph &bitmap_glyph);
399 FT_Bitmap* GetBitmap(FT_UInt32 c, FTC_Scaler scaler, FT_UInt &gindex,
400 FT_BitmapGlyph &bitmap_glyph);
407 FT_Outline* GetOutline(FT_UInt32 c,
size_t prop_cache_id,
408 int prop_font_size, FT_UInt &gindex,
409 FT_OutlineGlyph &outline_glyph);
410 FT_Outline* GetOutline(FT_UInt32 c, FTC_Scaler scaler, FT_UInt &gindex,
411 FT_OutlineGlyph &outline_glyph);
442 FTC_Manager* GetCacheManager();
443 FTC_ImageCache* GetImageCache();
444 FTC_CMapCache* GetCMapCache();
454 void InitializeCacheManager();
455 void ReleaseCacheManager();
464 template <
typename StringType>
465 bool RenderStringInternal(
vtkTextProperty *tprop,
const StringType &str,
471 template <
typename StringType>
472 bool StringToPathInternal(
vtkTextProperty *tprop,
const StringType &str,
480 bool CalculateBoundingBox(
const vtkStdString& str, MetaData &metaData);
482 template <
typename T>
483 bool CalculateBoundingBox(
const T& str, MetaData &metaData,
const T& defaultHeightString);
491 template <
typename StringType,
typename DataType>
492 bool PopulateData(
const StringType& str, DataType
data, MetaData &metaData);
497 template <
typename IteratorType,
typename DataType>
498 bool RenderLine(IteratorType begin, IteratorType end,
int lineIndex,
499 DataType
data, MetaData &metaData);
505 template <
typename CharType>
506 bool RenderCharacter(CharType character,
int &x,
int &y,
509 template <
typename CharType>
510 bool RenderCharacter(CharType character,
int &x,
int &y,
511 FT_UInt &previousGlyphIndex,
vtkPath *path,
515 void OutlineToPath(
int x,
int y, FT_Outline *outline,
vtkPath *path);
522 template <
typename T>
523 int FitStringToBBox(
const T &str, MetaData &metaData,
int targetWidth,
535 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.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
vtkTypeUInt32 vtkUnicodeStringValueType
String class that stores Unicode text.