| 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 <fifechan/font.hpp> |
| 25 |
#include "gui/fifechan/base/gui_font.h" |
| 26 |
#include "video/fonts/ifont.h" |
| 27 |
%} |
| 28 |
|
| 29 |
%include "video/fonts/fonts.i" |
| 30 |
|
| 31 |
namespace fcn { |
| 32 |
class Graphics; |
| 33 |
class Font |
| 34 |
{ |
| 35 |
public: |
| 36 |
virtual ~Font(){ } |
| 37 |
virtual int32_t getWidth(const std::string& text) const = 0; |
| 38 |
virtual int32_t getHeight() const = 0; |
| 39 |
}; |
| 40 |
} |
| 41 |
|
| 42 |
namespace FIFE { |
| 43 |
class Image; |
| 44 |
|
| 45 |
%feature("notabstract") GuiFont; |
| 46 |
class GuiFont : public fcn::Font, public IFont { |
| 47 |
public: |
| 48 |
GuiFont(IFont* font); |
| 49 |
virtual ~GuiFont(); |
| 50 |
|
| 51 |
int32_t getStringIndexAt(const std::string& text, int32_t x); |
| 52 |
void drawString(fcn::Graphics* graphics, const std::string& text, int32_t x, int32_t y); |
| 53 |
|
| 54 |
void setRowSpacing (int32_t spacing); |
| 55 |
int32_t getRowSpacing() const; |
| 56 |
void setGlyphSpacing(int32_t spacing); |
| 57 |
int32_t getGlyphSpacing() const; |
| 58 |
void setAntiAlias(bool antiAlias); |
| 59 |
bool isAntiAlias(); |
| 60 |
void setBoldStyle(bool style); |
| 61 |
bool isBoldStyle() const; |
| 62 |
void setItalicStyle(bool style); |
| 63 |
bool isItalicStyle() const; |
| 64 |
void setUnderlineStyle(bool style); |
| 65 |
bool isUnderlineStyle() const; |
| 66 |
void setStrikethroughStyle(bool style); |
| 67 |
bool isStrikethroughStyle() const; |
| 68 |
void setDynamicColoring(bool coloring); |
| 69 |
bool isDynamicColoring() const; |
| 70 |
Image* getAsImage(const std::string& text); |
| 71 |
void setColor(uint8_t r,uint8_t g,uint8_t b, uint8_t a = 255); |
| 72 |
SDL_Color getColor() const; |
| 73 |
int32_t getWidth(const std::string& text) const; |
| 74 |
int32_t getHeight() const; |
| 75 |
}; |
| 76 |
} |