forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkFontConfigFreeTypeTools.h
75 lines (61 loc) · 2.62 KB
/
vtkFontConfigFreeTypeTools.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*=========================================================================
Program: Visualization Toolkit
Module: vtkFontConfigFreeTypeTools.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkFontConfigFreeTypeTools
* @brief Subclass of vtkFreeTypeTools that uses
* system installed fonts.
*
*
* vtkFontConfigFreeTypeTools defers to vtkFreeTypeTools for rendering and
* rasterization, but sources fonts from a FontConfig system lookup. If the
* lookup fails, the compiled fonts of vtkFreeType are used instead.
*
* @warning
* Do not instantiate this class directly. Rather, call
* vtkFreeTypeTools::GetInstance() to ensure that the singleton design is
* correctly applied.
* Be aware that FontConfig lookup is disabled by default. To enable, call
* vtkFreeTypeTools::GetInstance()->ForceCompiledFontsOff();
*/
#ifndef vtkFontConfigFreeTypeTools_h
#define vtkFontConfigFreeTypeTools_h
#include "vtkFreeTypeTools.h"
#include "vtkRenderingFreeTypeFontConfigModule.h" // For export macro
class VTKRENDERINGFREETYPEFONTCONFIG_EXPORT vtkFontConfigFreeTypeTools : public vtkFreeTypeTools
{
public:
vtkTypeMacro(vtkFontConfigFreeTypeTools, vtkFreeTypeTools);
void PrintSelf(ostream& os, vtkIndent indent) override;
/**
* Creates a new object of this type, but it is not preferred to use this
* method directly. Instead, call vtkFreeTypeTools::GetInstance() and let
* the object factory create a new instance. In this way the singleton
* pattern of vtkFreeTypeTools is preserved.
*/
static vtkFontConfigFreeTypeTools* New();
/**
* Modified version of vtkFreeTypeTools::LookupFace that locates FontConfig
* faces. Falls back to the Superclass method for compiled fonts if the
* FontConfig lookup fails.
*/
static bool LookupFaceFontConfig(vtkTextProperty* tprop, FT_Library lib, FT_Face* face);
protected:
vtkFontConfigFreeTypeTools();
~vtkFontConfigFreeTypeTools() override;
/**
* Reimplemented from Superclass to use the FontConfig face lookup callback.
*/
FT_Error CreateFTCManager() override;
private:
vtkFontConfigFreeTypeTools(const vtkFontConfigFreeTypeTools&) = delete;
void operator=(const vtkFontConfigFreeTypeTools&) = delete;
};
#endif // vtkFontConfigFreeTypeTools_h