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;
110 vtkSetMacro(DebugTextures,
bool)
111 vtkGetMacro(DebugTextures,
bool)
112 vtkBooleanMacro(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);
262 vtkSetMacro(ScaleToPowerTwo,
bool);
263 vtkGetMacro(ScaleToPowerTwo,
bool);
264 vtkBooleanMacro(ScaleToPowerTwo,
bool);
273 vtkSetMacro(ForceCompiledFonts,
bool);
274 vtkGetMacro(ForceCompiledFonts,
bool);
275 vtkBooleanMacro(ForceCompiledFonts,
bool);
290 virtual FT_Error CreateFTCManager();
300 ImageMetaData &metaData);
313 ImageMetaData &metaData);
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);
364 bool GetFace(
size_t tprop_cache_id, FT_Face *face);
371 int request = GLYPH_REQUEST_DEFAULT);
375 int request = GLYPH_REQUEST_DEFAULT);
390 FT_Face &face,
bool &face_has_kerning);
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);
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);
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,