28 #ifndef vtkFreeTypeTools_h
29 #define vtkFreeTypeTools_h
42 #include "vtk_freetype.h"
43 #include FT_FREETYPE_H
50 class vtkTextPropertyLookup;
79 vtkSetMacro(DebugTextures,
bool)
80 vtkGetMacro(DebugTextures,
bool)
81 vtkBooleanMacro(DebugTextures,
bool)
85 FT_Library* GetLibrary();
92 vtkGetMacro(MaximumNumberOfFaces,
unsigned int);
93 vtkSetClampMacro(MaximumNumberOfSizes,
unsigned int,1,VTK_UNSIGNED_INT_MAX);
94 vtkGetMacro(MaximumNumberOfSizes,
unsigned int);
96 vtkGetMacro(MaximumNumberOfBytes,
unsigned long);
106 int dpi,
int bbox[4]);
108 int dpi,
int bbox[4]);
151 int dpi,
int targetWidth,
int targetHeight);
154 int targetWidth,
int targetHeight);
159 static vtkTypeUInt16 HashString(const
char *str);
170 void MapTextPropertyToId(
vtkTextProperty *tprop,
size_t *tprop_cache_id);
171 void MapIdToTextProperty(
size_t tprop_cache_id,
vtkTextProperty *tprop);
179 vtkSetMacro(ScaleToPowerTwo,
bool);
180 vtkGetMacro(ScaleToPowerTwo,
bool);
181 vtkBooleanMacro(ScaleToPowerTwo,
bool);
188 vtkSetMacro(ForceCompiledFonts,
bool);
189 vtkGetMacro(ForceCompiledFonts,
bool);
190 vtkBooleanMacro(ForceCompiledFonts,
bool);
197 static
bool LookupFace(
vtkTextProperty *tprop, FT_Library lib, FT_Face *face);
201 virtual FT_Error CreateFTCManager();
208 bool PrepareMetaData(
vtkTextProperty *tprop,
int dpi, MetaData &metaData);
210 ImageMetaData &metaData);
220 ImageMetaData &metaData);
237 bool GetGlyphIndex(
vtkTextProperty *tprop, FT_UInt32 c, FT_UInt *gindex);
252 GLYPH_REQUEST_DEFAULT = 0,
253 GLYPH_REQUEST_BITMAP = 1,
254 GLYPH_REQUEST_OUTLINE = 2
259 int request = GLYPH_REQUEST_DEFAULT);
260 bool GetSize(
size_t tprop_cache_id,
int font_size, FT_Size *
size);
261 bool GetSize(FTC_Scaler scaler, FT_Size *
size);
262 bool GetFace(
size_t tprop_cache_id, FT_Face *face);
263 bool GetGlyphIndex(
size_t tprop_cache_id, FT_UInt32 c,
265 bool GetGlyph(
size_t tprop_cache_id,
269 int request = GLYPH_REQUEST_DEFAULT);
270 bool GetGlyph(FTC_Scaler scaler,
273 int request = GLYPH_REQUEST_DEFAULT);
285 FT_Face &face,
bool &face_has_kerning);
290 FT_Bitmap* GetBitmap(FT_UInt32 c,
size_t prop_cache_id,
291 int prop_font_size, FT_UInt &gindex,
292 FT_BitmapGlyph &bitmap_glyph);
293 FT_Bitmap* GetBitmap(FT_UInt32 c, FTC_Scaler scaler, FT_UInt &gindex,
294 FT_BitmapGlyph &bitmap_glyph);
299 FT_Outline* GetOutline(FT_UInt32 c,
size_t prop_cache_id,
300 int prop_font_size, FT_UInt &gindex,
301 FT_OutlineGlyph &outline_glyph);
302 FT_Outline* GetOutline(FT_UInt32 c, FTC_Scaler scaler, FT_UInt &gindex,
303 FT_OutlineGlyph &outline_glyph);
325 FTC_Manager* GetCacheManager();
326 FTC_ImageCache* GetImageCache();
327 FTC_CMapCache* GetCMapCache();
337 void InitializeCacheManager();
338 void ReleaseCacheManager();
346 template <
typename StringType>
347 bool RenderStringInternal(
vtkTextProperty *tprop,
const StringType &str,
353 template <
typename StringType>
354 bool StringToPathInternal(
vtkTextProperty *tprop,
const StringType &str,
361 template <
typename T>
362 bool CalculateBoundingBox(
const T& str, MetaData &metaData);
369 template <
typename StringType,
typename DataType>
370 bool PopulateData(
const StringType& str, DataType
data, MetaData &metaData);
376 template <
typename IteratorType,
typename DataType>
377 bool RenderLine(IteratorType begin, IteratorType end,
int lineIndex,
378 DataType
data, MetaData &metaData);
384 template <
typename CharType>
385 bool RenderCharacter(CharType character,
int &x,
int &y,
388 template <
typename CharType>
389 bool RenderCharacter(CharType character,
int &x,
int &y,
390 FT_UInt &previousGlyphIndex,
vtkPath *path,
398 template <
typename T>
399 int FitStringToBBox(
const T &str, MetaData &metaData,
int targetWidth,
410 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.