Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GNASH_FREETYPE_H
00021 #define GNASH_FREETYPE_H
00022
00023 #include <string>
00024 #include <memory>
00025 #include <boost/thread/mutex.hpp>
00026 #include <boost/cstdint.hpp>
00027
00028 #ifdef USE_FREETYPE
00029 # include <ft2build.h>
00030 # include FT_FREETYPE_H
00031 # include FT_GLYPH_H
00032 #endif
00033
00034
00035 namespace gnash {
00036 namespace SWF {
00037 class ShapeRecord;
00038 }
00039 }
00040
00041
00042 namespace gnash {
00043
00045
00056 class FreetypeGlyphsProvider
00057 {
00058
00059 public:
00060
00062
00076 static std::auto_ptr<FreetypeGlyphsProvider> createFace(
00077 const std::string& name, bool bold, bool italic);
00078
00080
00083 ~FreetypeGlyphsProvider();
00084
00085
00089
00104 std::auto_ptr<SWF::ShapeRecord> getGlyph(boost::uint16_t code,
00105 float& advance);
00106
00108 float ascent() const;
00109
00111 float descent() const;
00112
00114
00118 unsigned short unitsPerEM() const;
00119
00120 private:
00121
00123
00126 FreetypeGlyphsProvider(const std::string& fontname, bool bold, bool italic);
00127
00128 #ifdef USE_FREETYPE
00129
00134 float scale;
00135
00137
00155 bool getFontFilename(const std::string& name, bool bold, bool italic,
00156 std::string& filename);
00157
00159 static void init();
00160
00161 static void close();
00162
00164 static boost::mutex m_lib_mutex;
00165
00167 static FT_Library m_lib;
00168
00169 FT_Face _face;
00170
00171 #endif // USE_FREETYPE
00172
00173 };
00174
00175 }
00176
00177
00178 #endif // GNASH_FREETYPE_H