Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

font_ttf.h

Go to the documentation of this file.
00001 /*
00002         $Id: font_ttf.h,v 1.11 2001/03/08 04:09:55 plasmoid Exp $
00003 
00004         ------------------------------------------------------------------------
00005         ClanLib, the platform independent game SDK.
00006 
00007         This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
00008         version 2. See COPYING for details.
00009 
00010         For a total list of contributers see CREDITS.
00011 
00012         ------------------------------------------------------------------------
00013 
00014         File purpose:
00015                 TrueType Font support through the FreeType library
00016 */
00017 
00018 #ifndef header_font_tt
00019 #define header_font_tt
00020 
00021 #include <Display/Font/font_generic.h>
00022 
00023 struct font_adj
00024 {
00025         int top;
00026         int left;
00027 };
00028 
00029 class CL_InputSourceProvider;
00030 class CL_InputSource;
00031 class CL_String;
00032 class CL_Canvas;
00033 class CL_Surface;
00034 class CL_Font_Generic;
00035 
00036 class CL_Font_TTF : public CL_Font_Generic
00037 {
00038  public:
00039   CL_Font_TTF(CL_String name, CL_InputSourceProvider* provider);
00040   virtual ~CL_Font_TTF();
00041 
00042   virtual int get_height() {return height;}
00043   virtual int get_text_width(const char *text);
00044   virtual int get_char_width(const char character);
00045 
00046   virtual void print_left(int x, int y, const char *text, int n_height=1);
00047   virtual void print_left(int x, int y, float scale_x, float scale_y, const char *text);
00048   virtual void print_center(int x, int y, const char *text);
00049   virtual void print_right(int x, int y, const char *text);
00050 
00051   virtual void put_target(int x, int y, const char *text, CL_Target *target, int alignment);
00052   int change_size(int size);
00053   unsigned int change_colour(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
00054 
00055  protected:
00056 
00057   void generate_font();
00058 
00059   int num_faces; //How many font faces in this font pkg
00060   int num_glyphs; //How many character images in this face
00061   unsigned int flags; //Describes Font_face properties
00062   int num_fixed_sizes; //The number of unique sizes for the font face
00063 
00064   CL_InputSourceProvider *input_provider;
00065   CL_InputSource *input_source;
00066   CL_String filename;
00067 
00068   CL_Surface *chars[256];
00069   font_adj adjust[256]; //One for each letter
00070   bool chars_init;
00071 
00072   int width;
00073   int height;
00074   int space_len;
00075   int subtract_width;
00076 
00077   unsigned char* font_mem;
00078   int *font_sizes;
00079   int size;
00080 
00081   unsigned char r,g,b,a;
00082 
00083 };
00084 
00085 #endif

Generated at Wed Apr 4 19:54:00 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001