/* * mogltk * Copyright (C) 1999-2004 Nicolas "Pixel" Noble * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id: font.h,v 1.8 2004-07-15 14:21:30 pixel Exp $ */ #ifndef __FONT_H__ #define __FONT_H__ #include #include #include #include #include #include #include namespace mogltk { class font : public Base { public: font(Handle *); virtual ~font(); virtual void drawentry(Uint16, int, int, ColorP = WHITE); void drawtotex(texture *, Uint16, int, int, ColorP = WHITE); void putcursor(int, int); void putentry(Uint16, ColorP = WHITE); void putentryontex(texture *, Uint16, ColorP = WHITE); void drawchar(char, ColorP = WHITE); void drawcharontex(texture *, char, ColorP = WHITE); void newline(void); int printf(const ugly_string &, ...); int printf(const char *, ...); int printf(const ugly_string &, va_list); rect size(const ugly_string &, ...); rect size(const char *, ...); rect size(const ugly_string &, va_list); rect printtotex(texture *, const ugly_string &, ...); rect printtotex(texture *, const char *, ...); rect printtotex(texture *, const ugly_string &, va_list); texture * printtex(rect *, const ugly_string &, ...); texture * printtex(rect *, const char *, ...); texture * printtex(rect *, const ugly_string &, va_list); void setcolor(ColorP); void setshadow(int); void setwspace(int); int findchar(char) const; int singletextsize(const String &) const; protected: Uint8 * sizes; Uint16 nbentries, nbcT, nbT; Uint8 flags, maxX, maxY, nbcU, nbcV, base, inter; int cx, cy, ox; ColorP textcolor; int shadow, wspace; texture * alloctexture(); void Bind(int); private: void checknbind(int, ColorP); texture ** fonttex; texture ** fontcache[16]; Uint16 * corresp; }; extern font * SystemFont; extern font * FixedFont; }; #endif