00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024
00025 #ifndef SFML_FONT_HPP
00026 #define SFML_FONT_HPP
00027
00029
00031 #include <SFML/System/Resource.hpp>
00032 #include <SFML/System/Vector2.hpp>
00033 #include <SFML/System/Unicode.hpp>
00034 #include <SFML/Graphics/Glyph.hpp>
00035 #include <SFML/Graphics/Image.hpp>
00036 #include <SFML/Graphics/Rect.hpp>
00037 #include <map>
00038 #include <string>
00039
00040
00041 namespace sf
00042 {
00043 class String;
00044
00045 namespace priv
00046 {
00047 class FontLoader;
00048 }
00054 class SFML_API Font : public Resource<Font>
00055 {
00056 public :
00057
00062 Font();
00063
00074 bool LoadFromFile(const std::string& Filename, unsigned int CharSize = 30, const Unicode::Text& Charset = ourDefaultCharset);
00075
00087 bool LoadFromMemory(const char* Data, std::size_t SizeInBytes, unsigned int CharSize = 30, const Unicode::Text& Charset = ourDefaultCharset);
00088
00096 unsigned int GetCharacterSize() const;
00097
00107 const Glyph& GetGlyph(Uint32 CodePoint) const;
00108
00115 const Image& GetImage() const;
00116
00123 static const Font& GetDefaultFont();
00124
00125 private :
00126
00127 friend class priv::FontLoader;
00128
00130
00132 static Uint32 ourDefaultCharset[];
00133
00135
00137 Image myTexture;
00138 unsigned int myCharSize;
00139 std::map<Uint32, Glyph> myGlyphs;
00140 };
00141
00142 }
00143
00144
00145 #endif // SFML_FONT_HPP