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

font_description.h

Go to the documentation of this file.
00001 /*
00002         $Id: font_description.h,v 1.1 2001/03/06 15:09:10 mbn 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                 Simple font support.
00016 */
00017 
00019 
00020 #ifndef header_font_description
00021 #define header_font_description
00022 
00023 #include <vector>
00024 #include <string>
00025 
00026 class CL_SurfaceProvider;
00027 class CL_InputSource;
00028 
00029 class CL_Font_Description
00030 //: Font provider interface.
00031 // <p>The font description class is used by the <a class="CL_Font">font
00032 // class</a> to load the font.</p>
00033 //
00034 // <p>Currently ClanLib support two types of fonts:</p>
00035 //
00036 // <p><b>The old method.</b></p>
00037 //
00038 // <p>You may find some 256 color indexed fonts with some of ClanLib's
00039 // example applications. They use the three last colors in the palette to
00040 // seperate the letters, break the line, and to determine the size of the
00041 // font. The method is deprecated.</p>
00042 //
00043 // <p><b>The new method.</b></p>
00044 //
00045 // <p>The font description class constructs the font letters from an image
00046 // with alpha values. Each letter is seperated with transparent lines and
00047 // the font description class uses this information to determine where it so
00048 // seperate the letters.</p>
00049 //
00050 // <p>CL_Font_Description allows you to adjust how much transparent a line
00051 // must be before it consideres it as a letter seperator line. The
00052 // trans_limit parameter handles this.</p>
00053 //
00054 // <p>If your font is italic you can use the subtract_width parameter to
00055 // move the printed letters "closer to each other". This is, with a fine
00056 // word, called the kerning of the font.</p>
00057 {
00058 public:
00059         std::vector<CL_SurfaceProvider*> letter_providers;
00060         int space_len;
00061         int subtract_width;
00062         std::string letters;
00063         
00064         CL_Font_Description(CL_InputSource *input);
00065         // <p>This constructor is used to load the font from an input source.
00066         // Usually this from a resource datafile.</p>
00067         //
00068         // <p>Normally you do not use this constructor directly. It is much
00069         // easier to use CL_Font::load() when retrieving a font from a
00070         // datafile.</p>
00071         
00072         CL_Font_Description(
00073                 CL_SurfaceProvider *p,
00074                 int x, int y,
00075                 int *tcols, int num_tcols,
00076                 int spacelen,
00077                 int subtract_width,
00078                 const char *letters);
00087         // <p>This constructs a font description using the old font method. It
00088         // is obsolete and only provided for backward compatibility. Please
00089         // don't use it.</p>
00090 
00091         CL_Font_Description(
00092                 CL_SurfaceProvider *source,
00093                 float trans_limit,
00094                 int space_len,
00095                 int subtract_width,
00096                 const char *letters);
00102         // <p>This constructs a font description using the new alpha cutter
00103         // method.</p>
00104         // <p>Please have a look on the class overview reference page for more
00105         // information.</p>
00106 
00107   CL_Font_Description(
00108     std::vector<CL_SurfaceProvider*> letter_provider,
00109           int space_len,
00110           int subtract_width,
00111           std::string letters);
00116   // <p>This is primarily used by the TTF resource loader to handle fonts
00117 
00118         void lock();
00119         void unlock();
00120 
00121 private:
00122         CL_SurfaceProvider *source;
00123 };
00124 
00125 #endif

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