FIFE  2008.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
abstractfont.h
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2008 by the FIFE team                              *
00003  *   http://www.fifengine.de                                               *
00004  *   This file is part of FIFE.                                            *
00005  *                                                                         *
00006  *   FIFE is free software; you can redistribute it and/or                 *
00007  *   modify it under the terms of the GNU Lesser General Public            *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2.1 of the License, or (at your option) any later version.    *
00010  *                                                                         *
00011  *   This library is distributed in the hope that it will be useful,       *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00014  *   Lesser General Public License for more details.                       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with this library; if not, write to the                 *
00018  *   Free Software Foundation, Inc.,                                       *
00019  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
00020  ***************************************************************************/
00021 
00022 #ifndef FIFE_ABSTRACT_FONT_H
00023 #define FIFE_ABSTRACT_FONT_H
00024 
00025 // Standard C++ library includes
00026 #include <string>
00027 
00028 // Platform specific includes
00029 
00030 // 3rd party library includes
00031 #include <SDL.h>
00032 
00033 // FIFE includes
00034 // These includes are split up in two parts, separated by one empty line
00035 // First block: files included from the FIFE root src directory
00036 // Second block: files included from the same folder
00037 
00038 namespace FIFE {
00039     class Image;
00040 
00043     class AbstractFont {
00044     public:
00045         virtual ~AbstractFont() {}
00046 
00053         virtual void setRowSpacing (int spacing) = 0;
00054 
00060         virtual int getRowSpacing() const = 0;
00061 
00068         virtual void setGlyphSpacing(int spacing) = 0;
00069 
00075         virtual int getGlyphSpacing() const = 0;
00076 
00082         virtual void setAntiAlias(bool antiAlias) = 0;
00083 
00089         virtual bool isAntiAlias() = 0;
00090 
00091         virtual int getStringIndexAt(const std::string &text, int x) const = 0;
00092 
00096         virtual Image* getAsImage(const std::string& text) = 0;
00097 
00101         virtual Image* getAsImageMultiline(const std::string& text) = 0;
00102 
00103         virtual std::string splitTextToWidth (const std::string& text, int render_width) = 0;
00104 
00107         virtual void setColor(uint8_t r,uint8_t g,uint8_t b, uint8_t a = 255) = 0;
00108 
00111         virtual SDL_Color getColor() const = 0;
00112 
00115         virtual int getWidth(const std::string& text) const = 0;
00116 
00119         virtual int getHeight() const = 0;
00120 
00121         virtual void invalidate() = 0;
00122     };
00123 }
00124 
00125 #endif