0024386: Provide high-level API to specify font by user-defined path for AIS (Prs3d...
[occt.git] / src / Font / Font_FTLibrary.hxx
1 // Created on: 2013-01-28
2 // Created by: Kirill GAVRILOV
3 // Copyright (c) 2013 OPEN CASCADE SAS
4 //
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
9 //
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 //
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
19
20 #ifndef _Font_FTLibrary_H__
21 #define _Font_FTLibrary_H__
22
23 #include <Standard_DefineHandle.hxx>
24 #include <Standard_Transient.hxx>
25 #include <Handle_Standard_Transient.hxx>
26
27 // inclusion template for FreeType
28 #include <ft2build.h>
29 #include FT_FREETYPE_H
30
31 //! Wrapper over FT_Library. Provides access to FreeType library.
32 class Font_FTLibrary : public Standard_Transient
33 {
34
35 public:
36
37   //! Initialize new FT_Library instance.
38   Standard_EXPORT Font_FTLibrary();
39
40   //! Release FT_Library instance.
41   Standard_EXPORT ~Font_FTLibrary();
42
43   //! This method should always return true.
44   //! @return true if FT_Library instance is valid.
45   bool IsValid() const
46   {
47     return myFTLib != NULL;
48   }
49
50   //! Access FT_Library instance.
51   FT_Library Instance() const
52   {
53     return myFTLib;
54   }
55
56 private:
57
58   FT_Library myFTLib;
59
60 private:
61
62   Font_FTLibrary            (const Font_FTLibrary& );
63   Font_FTLibrary& operator= (const Font_FTLibrary& );
64
65 public:
66
67   DEFINE_STANDARD_RTTI(Font_FTLibrary) // Type definition
68
69 };
70
71 DEFINE_STANDARD_HANDLE(Font_FTLibrary, Standard_Transient)
72
73 #endif // _Font_FTLibrary_H__