00001 00003 00004 #ifndef header_resourcetype_font 00005 #define header_resourcetype_font 00006 00007 #include "API/Core/System/clanstring.h" 00008 #include "API/Core/Resources/resource_manager.h" 00009 #include <Display/Font/resource_font_generic.h> 00010 00011 class CL_Font; 00012 class CL_Font_Description; 00013 class CL_Res_Font_Generic; 00014 00015 class CL_Res_Font : public CL_Res_Font_Generic 00016 //: The Pixmap font resource. 00017 // This is the font resource type. It is used load CL_Font resources from 00018 // a datafile. 00019 // <br> 00020 // The resource system in ClanLib understand two types of fonts. An 00021 // deprecated font system orignally developed in 1994 - designed to be used 00022 // with Deluxe Paint IIe .pcx files. This is obsolete, and shouldn't be used 00023 // anymore. We only mention it here so that you won't get confused, if you 00024 // notice how some ClanLib demo application use strange lines using the 00025 // three last colors in the palette to cut out the letters in the font. 00026 // <br> 00027 // The new alpha based font system uses a much easier way to cut out the 00028 // letters in the font. It uses the alpha value in the image to detect where 00029 // a letter ends, and a new one begins. Simply divide the letters by a 00030 // horizontal line of transparent pixels. 00031 // <br> 00032 // Have a look at this address for an example: 00033 // <br> 00034 // http://dark.x.dtu.dk/~mbn/clanlib/gfx/alpha_font.tga 00050 { 00051 public: 00052 CL_Res_Font(); 00053 00054 private: 00055 friend CL_ResourceManager; 00056 virtual CL_Resource *create_from_location( 00057 std::string name, 00058 std::string location, 00059 CL_ResourceOptions *options, 00060 CL_ResourceManager *parent); 00061 00062 virtual CL_Resource *create_from_serialization( 00063 std::string name, 00064 CL_ResourceManager *parent); 00065 }; 00066 00067 class CL_Font_Resource : public CL_Font_Resource_Generic 00068 { 00069 public: 00070 CL_Font_Resource( 00071 std::string name, 00072 std::string location, 00073 CL_ResourceOptions *options, 00074 CL_ResourceManager *parent); 00075 00076 CL_Font_Resource( 00077 std::string name, 00078 CL_ResourceManager *parent); 00079 00080 virtual ~CL_Font_Resource(); 00081 00082 virtual void serialize_save(CL_OutputSource *output); 00083 virtual void load(); 00084 virtual void unload(); 00085 //virtual int get_load_count() { return load_count; } 00086 00087 // CL_Font *get_font(); 00088 // CL_Font_Description *get_font_desc() { return font_desc; } 00089 //Moved to CL_Font_Resource_Generic 00090 00091 private: 00092 void load_from_datafile(); 00093 void load_from_file(); 00094 00095 //CL_Font *font; 00096 //CL_Font_Description *font_desc; 00097 //moved up into protected of CL_Font_Resource_Generic 00098 00099 //CL_String location; 00100 //CL_ResourceOptions *options; 00101 //CL_ResourceManager *parent; 00102 //bool from_datafile; 00103 //int load_count; 00104 }; 00105 00106 #endif
1.2.6 written by Dimitri van Heesch,
© 1997-2001