Gnash  0.8.11dev
FreetypeGlyphsProvider.h
Go to the documentation of this file.
1 // FreetypeGlyphsProvider.h: Freetype glyphs manager
2 //
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 
20 #ifndef GNASH_FREETYPE_H
21 #define GNASH_FREETYPE_H
22 
23 #include <string>
24 #include <memory> // for unique_ptr
25 #include <mutex>
26 #include <cstdint>
27 
28 #ifdef USE_FREETYPE
29 # include <ft2build.h>
30 # include FT_FREETYPE_H
31 # include FT_GLYPH_H
32 #endif
33 
34 // Forward declarations
35 namespace gnash {
36  namespace SWF {
37  class ShapeRecord;
38  }
39 }
40 
41 
42 namespace gnash {
43 
45 //
57 {
58 
59 public:
60 
62  //
76  static std::unique_ptr<FreetypeGlyphsProvider> createFace(
77  const std::string& name, bool bold, bool italic);
78 
80  //
84 
85 
89  //
104  std::unique_ptr<SWF::ShapeRecord> getGlyph(std::uint16_t code,
105  float& advance);
106 
108  float ascent() const;
109 
111  float descent() const;
112 
114  //
118  unsigned short unitsPerEM() const;
119 
120 private:
121 
123  //
126  FreetypeGlyphsProvider(const std::string& fontname, bool bold, bool italic);
127 
128 #ifdef USE_FREETYPE
129 
134  float scale;
135 
137  //
155  bool getFontFilename(const std::string& name, bool bold, bool italic,
156  std::string& filename);
157 
159  static void init();
160 
161  static void close();
162 
164  static std::mutex m_lib_mutex;
165 
167  static FT_Library m_lib;
168 
169  FT_Face _face;
170 
171 #endif // USE_FREETYPE
172 
173 };
174 
175 } // namespace gnash
176 
177 
178 #endif // GNASH_FREETYPE_H
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
code
Definition: GnashKey.h:43
Truetype font rasterizer/converter based on freetype library.
Definition: FreetypeGlyphsProvider.h:56
std::string name
Definition: LocalConnection_as.cpp:149
Definition: GnashKey.h:331