28 #ifndef vtkFreeTypeTools_h
29 #define vtkFreeTypeTools_h
42 #include "vtk_freetype.h"
43 #include FT_FREETYPE_H
50 class vtkTextPropertyLookup;
82 vtkSetMacro(DebugTextures,
bool)
83 vtkGetMacro(DebugTextures,
bool)
84 vtkBooleanMacro(DebugTextures,
bool)
88 FT_Library* GetLibrary();
95 vtkGetMacro(MaximumNumberOfFaces,
unsigned int);
96 vtkSetClampMacro(MaximumNumberOfSizes,
unsigned int,1,VTK_UNSIGNED_INT_MAX);
97 vtkGetMacro(MaximumNumberOfSizes,
unsigned int);
99 vtkGetMacro(MaximumNumberOfBytes,
unsigned long);
109 int dpi,
int bbox[4]);
111 int dpi,
int bbox[4]);
154 int dpi,
int targetWidth,
int targetHeight);
157 int targetWidth,
int targetHeight);
162 static vtkTypeUInt16 HashString(const
char *str);
166 static vtkTypeUInt32 HashBuffer(const
void* str,
size_t n, vtkTypeUInt32 hash = 0);
177 void MapTextPropertyToId(
vtkTextProperty *tprop,
size_t *tprop_cache_id);
178 void MapIdToTextProperty(
size_t tprop_cache_id,
vtkTextProperty *tprop);
186 vtkSetMacro(ScaleToPowerTwo,
bool);
187 vtkGetMacro(ScaleToPowerTwo,
bool);
188 vtkBooleanMacro(ScaleToPowerTwo,
bool);
195 vtkSetMacro(ForceCompiledFonts,
bool);
196 vtkGetMacro(ForceCompiledFonts,
bool);
197 vtkBooleanMacro(ForceCompiledFonts,
bool);
204 static
bool LookupFace(
vtkTextProperty *tprop, FT_Library lib, FT_Face *face);
208 virtual FT_Error CreateFTCManager();
215 bool PrepareMetaData(
vtkTextProperty *tprop,
int dpi, MetaData &metaData);
217 ImageMetaData &metaData);
227 ImageMetaData &metaData);
244 bool GetGlyphIndex(
vtkTextProperty *tprop, FT_UInt32 c, FT_UInt *gindex);
259 GLYPH_REQUEST_DEFAULT = 0,
260 GLYPH_REQUEST_BITMAP = 1,
261 GLYPH_REQUEST_OUTLINE = 2
266 int request = GLYPH_REQUEST_DEFAULT);
267 bool GetSize(
size_t tprop_cache_id,
int font_size, FT_Size *
size);
268 bool GetSize(FTC_Scaler scaler, FT_Size *
size);
269 bool GetFace(
size_t tprop_cache_id, FT_Face *face);
270 bool GetGlyphIndex(
size_t tprop_cache_id, FT_UInt32 c,
272 bool GetGlyph(
size_t tprop_cache_id,
276 int request = GLYPH_REQUEST_DEFAULT);
277 bool GetGlyph(FTC_Scaler scaler,
280 int request = GLYPH_REQUEST_DEFAULT);
292 FT_Face &face,
bool &face_has_kerning);
297 FT_Bitmap* GetBitmap(FT_UInt32 c,
size_t prop_cache_id,
298 int prop_font_size, FT_UInt &gindex,
299 FT_BitmapGlyph &bitmap_glyph);
300 FT_Bitmap* GetBitmap(FT_UInt32 c, FTC_Scaler scaler, FT_UInt &gindex,
301 FT_BitmapGlyph &bitmap_glyph);
306 FT_Outline* GetOutline(FT_UInt32 c,
size_t prop_cache_id,
307 int prop_font_size, FT_UInt &gindex,
308 FT_OutlineGlyph &outline_glyph);
309 FT_Outline* GetOutline(FT_UInt32 c, FTC_Scaler scaler, FT_UInt &gindex,
310 FT_OutlineGlyph &outline_glyph);
332 FTC_Manager* GetCacheManager();
333 FTC_ImageCache* GetImageCache();
334 FTC_CMapCache* GetCMapCache();
344 void InitializeCacheManager();
345 void ReleaseCacheManager();
353 template <
typename StringType>
354 bool RenderStringInternal(
vtkTextProperty *tprop,
const StringType &str,
360 template <
typename StringType>
361 bool StringToPathInternal(
vtkTextProperty *tprop,
const StringType &str,
368 template <
typename T>
369 bool CalculateBoundingBox(
const T& str, MetaData &metaData);
376 template <
typename StringType,
typename DataType>
377 bool PopulateData(
const StringType& str, DataType
data, MetaData &metaData);
383 template <
typename IteratorType,
typename DataType>
384 bool RenderLine(IteratorType begin, IteratorType end,
int lineIndex,
385 DataType
data, MetaData &metaData);
391 template <
typename CharType>
392 bool RenderCharacter(CharType character,
int &x,
int &y,
395 template <
typename CharType>
396 bool RenderCharacter(CharType character,
int &x,
int &y,
397 FT_UInt &previousGlyphIndex,
vtkPath *path,
405 template <
typename T>
406 int FitStringToBBox(
const T &str, MetaData &metaData,
int targetWidth,
417 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
concrete dataset representing a path defined by Bezier curves.
#define VTK_UNSIGNED_LONG_MAX
#define VTKRENDERINGFREETYPE_EXPORT
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
topologically and geometrically regular array of data
#define VTK_UNSIGNED_INT_MAX
represent text properties.
Interface for generating images and path data from string data, using multiple backends.
String class that stores Unicode text.