| 1 |
/*************************************************************************** |
| 2 |
* Copyright (C) 2005-2019 by the FIFE team * |
| 3 |
* http://www.fifengine.net * |
| 4 |
* This file is part of FIFE. * |
| 5 |
* * |
| 6 |
* FIFE is free software; you can redistribute it and/or * |
| 7 |
* modify it under the terms of the GNU Lesser General Public * |
| 8 |
* License as published by the Free Software Foundation; either * |
| 9 |
* version 2.1 of the License, or (at your option) any later version. * |
| 10 |
* * |
| 11 |
* This library is distributed in the hope that it will be useful, * |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
| 14 |
* Lesser General Public License for more details. * |
| 15 |
* * |
| 16 |
* You should have received a copy of the GNU Lesser General Public * |
| 17 |
* License along with this library; if not, write to the * |
| 18 |
* Free Software Foundation, Inc., * |
| 19 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * |
| 20 |
***************************************************************************/ |
| 21 |
|
| 22 |
%module fife |
| 23 |
%{ |
| 24 |
#include "video/fonts/ifont.h" |
| 25 |
#include "video/fonts/fontbase.h" |
| 26 |
#include "video/fonts/truetypefont.h" |
| 27 |
#include "video/fonts/subimagefont.h" |
| 28 |
|
| 29 |
%} |
| 30 |
typedef uint8_t Uint8; |
| 31 |
|
| 32 |
namespace FIFE { |
| 33 |
class IFont { |
| 34 |
public: |
| 35 |
virtual ~IFont(); |
| 36 |
virtual void setRowSpacing (int32_t spacing) = 0; |
| 37 |
virtual int32_t getRowSpacing() const = 0; |
| 38 |
virtual void setGlyphSpacing(int32_t spacing) = 0; |
| 39 |
virtual int32_t getGlyphSpacing() const = 0; |
| 40 |
virtual void setAntiAlias(bool antiAlias) = 0; |
| 41 |
virtual bool isAntiAlias() = 0; |
| 42 |
virtual void setColor(uint8_t r,uint8_t g,uint8_t b, uint8_t a = 255) = 0; |
| 43 |
virtual SDL_Color getColor() const = 0; |
| 44 |
virtual int32_t getWidth(const std::string& text) const = 0; |
| 45 |
virtual int32_t getHeight() const = 0; |
| 46 |
}; |
| 47 |
|
| 48 |
class FontBase: public IFont { |
| 49 |
public: |
| 50 |
virtual ~FontBase(){ } |
| 51 |
}; |
| 52 |
|
| 53 |
%feature("notabstract") TrueTypeFont; |
| 54 |
%rename(TTFont) TrueTypeFont; |
| 55 |
class TrueTypeFont: public FontBase { |
| 56 |
public: |
| 57 |
TrueTypeFont(const std::string& filename, int32_t size); |
| 58 |
virtual ~TrueTypeFont(); |
| 59 |
virtual void setColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a = 255); |
| 60 |
virtual int32_t getWidth(const std::string& text) const; |
| 61 |
virtual int32_t getHeight() const; |
| 62 |
}; |
| 63 |
|
| 64 |
%feature("notabstract") SubImageFont; |
| 65 |
class SubImageFont: public FontBase { |
| 66 |
public: |
| 67 |
SubImageFont(const std::string& filename, const std::string& glyphs); |
| 68 |
virtual ~SubImageFont(); |
| 69 |
virtual void setColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a = 255); |
| 70 |
virtual int32_t getWidth(const std::string& text) const; |
| 71 |
virtual int32_t getHeight() const; |
| 72 |
}; |
| 73 |
} |