00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef FREETYPEFACE_H
00016 #define FREETYPEFACE_H
00017
00018 #include "pandabase.h"
00019
00020 #ifdef HAVE_FREETYPE
00021
00022 #include "typedReferenceCount.h"
00023 #include "namable.h"
00024 #include "pmutex.h"
00025 #include "mutexHolder.h"
00026
00027 #include <ft2build.h>
00028 #include FT_FREETYPE_H
00029
00030
00031
00032
00033
00034
00035
00036
00037 class EXPCL_PANDA_PNMTEXT FreetypeFace : public TypedReferenceCount, public Namable {
00038 public:
00039 FreetypeFace();
00040 ~FreetypeFace();
00041
00042 FT_Face acquire_face(int char_size, int dpi, int pixel_width, int pixel_height);
00043 void release_face(FT_Face face);
00044
00045 void set_face(FT_Face face);
00046
00047 private:
00048 static void initialize_ft_library();
00049
00050 private:
00051
00052
00053 string _font_data;
00054
00055 string _name;
00056 FT_Face _face;
00057 int _char_size;
00058 int _dpi;
00059 int _pixel_width;
00060 int _pixel_height;
00061 Mutex _lock;
00062
00063 static FT_Library _ft_library;
00064 static bool _ft_initialized;
00065 static bool _ft_ok;
00066
00067 public:
00068 static TypeHandle get_class_type() {
00069 return _type_handle;
00070 }
00071 static void init_type() {
00072 TypedReferenceCount::init_type();
00073 register_type(_type_handle, "FreetypeFace",
00074 TypedReferenceCount::get_class_type());
00075 }
00076 virtual TypeHandle get_type() const {
00077 return get_class_type();
00078 }
00079 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00080
00081 private:
00082 static TypeHandle _type_handle;
00083
00084 friend class FreetypeFont;
00085 };
00086
00087
00088 #include "freetypeFace.I"
00089
00090 #endif // HAVE_FREETYPE
00091
00092 #endif