00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef TRUETYPEFONT_H
00023 #define TRUETYPEFONT_H
00024
00025 #include <list>
00026 #include <string>
00027
00028 #include <guichan/font.hpp>
00029 #ifdef __APPLE__
00030 #include <SDL_ttf/SDL_ttf.h>
00031 #else
00032 #ifdef __WIN32__
00033 #include <SDL/SDL_ttf.h>
00034 #else
00035 #include <SDL_ttf.h>
00036 #endif
00037 #endif
00038
00039 class TextChunk;
00040
00046 class TrueTypeFont : public gcn::Font
00047 {
00048 public:
00055 TrueTypeFont(const std::string &filename, int size, int style = 0);
00056
00060 ~TrueTypeFont();
00061
00062 virtual int getWidth(const std::string &text) const;
00063
00064 virtual int getHeight() const;
00065
00069 void drawString(gcn::Graphics *graphics,
00070 const std::string &text,
00071 int x, int y);
00072
00073 private:
00074 TTF_Font *mFont;
00075
00076
00077 std::list<TextChunk> mCache;
00078 };
00079
00080 #endif