00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _OSGTEXTFT2BACKEND_H_
00040 #define _OSGTEXTFT2BACKEND_H_
00041
00042 #ifdef _MSC_VER
00043 # pragma once
00044 #endif
00045
00046
00047 #include <OSGConfig.h>
00048 #include <OSGSystemDef.h>
00049
00050
00051 #ifdef FT2_LIB
00052
00053
00054 #include "OSGTextBackend.h"
00055 #ifndef FONTCONFIG_LIB
00056 # include <map>
00057 #endif
00058 #include <ft2build.h>
00059 #include FT_FREETYPE_H
00060 #include <string>
00061
00062
00063 OSG_BEGIN_NAMESPACE
00064
00065
00073 class OSG_SYSTEMLIB_DLLMAPPING TextFT2Backend: public TextBackend
00074 {
00075
00076 public:
00077
00079 TextFT2Backend();
00080
00082 virtual ~TextFT2Backend();
00083
00090 virtual TextVectorFace*
00091 createVectorFace(const std::string &family, TextFace::Style style);
00092
00100 virtual TextPixmapFace*
00101 createPixmapFace(const std::string &family, TextFace::Style style, UInt32 size);
00102
00111 virtual TextTXFFace*
00112 createTXFFace(const std::string &family, TextFace::Style style, const TextTXFParam ¶m);
00113
00119 virtual void getFontFamilies(std::vector<std::string> &families);
00120
00121
00122 private:
00123
00125 TextFT2Backend(const TextFT2Backend &);
00126
00128 const TextFT2Backend &operator=(const TextFT2Backend &);
00129
00131 bool findPath(const std::string &family, TextFace::Style style, std::string &path, int &index);
00132
00134 FT_Face createFace(const std::string &family, TextFace::Style style, FT_UInt size);
00135
00137 FT_Library _library;
00138
00139 #ifndef FONTCONFIG_LIB
00140
00142 std::string _pathList;
00143
00145 bool _scanForFonts;
00146
00148 typedef struct
00149 {
00150 std::string path;
00151 int index;
00152 TextFace::Style style;
00153 }
00154 FontInfo;
00155
00157 typedef std::multimap<std::string, FontInfo> FontMap;
00158
00160 FontMap _fontMap;
00161
00163 void scanForFonts();
00164
00169 void scanDir(const std::string &path);
00170
00175 void checkFile(const std::string &fullname);
00176
00177 #endif // !FONTCONFIG_LIB
00178
00179 };
00180
00181
00182 OSG_END_NAMESPACE
00183
00184
00185 #endif // FT2_LIB
00186
00187
00188 #include <OSGTextFT2Backend.inl>
00189
00190 #define OSGTEXTFT2BACKEND_HEADER_CVSID "@(#)$Id: OSGTextFT2Backend.h,v 1.1 2005/03/03 13:43:06 a-m-z Exp $"
00191
00192 #endif