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);
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);
217 vtkGetMacro(ScaleToPowerTwo,
bool);
228 vtkGetMacro(ForceCompiledFonts,
bool);
244 virtual FT_Error CreateFTCManager();
254 ImageMetaData &metaData);
267 ImageMetaData &metaData);
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);
318 bool GetFace(
size_t tprop_cache_id, FT_Face *face);
325 int request = GLYPH_REQUEST_DEFAULT);
329 int request = GLYPH_REQUEST_DEFAULT);
344 FT_Face &face,
bool &face_has_kerning);
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);
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);
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,