Virtual U.org
Get Personal Training on VU Today
    
Top shadow
 
 register/help
User Name:

Password:

Ofont.h Source File
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Ofont.h

Go to the documentation of this file.
00001 //Filename    : OFONT.H
00002 //Description : Header file of Object Font
00003 
00004 #ifndef __OFONT_H
00005 #define __OFONT_H
00006 
00007 #ifndef __ALL_H
00008 #include <ALL.H>
00009 #endif
00010 
00011 #ifndef __OVGABUF_H
00012 #include <OVGABUF.H>
00013 #endif
00014 
00015 #ifndef __OTRANSL_H
00016 #include <OTRANSL.H>
00017 #endif
00018 
00019 //------- Define constant ------------//
00020 
00021 #define DEFAULT_LINE_SPACE  2                     // 2 pixels space between lines
00022 
00023 //#define FIRST_NATION_COLOR_CODE_IN_TEXT  0x80
00024 //#define LAST_NATION_COLOR_CODE_IN_TEXT   0x8F
00025 #define NATION_COLOR_BAR_WIDTH        13
00026 #define NATION_COLOR_BAR_HEIGHT       13
00027 
00028 //------ Define struct HyperField ------//
00029 
00030 #define MAX_HYPER_FIELD 30                        // Maximum no. of hyper-text fields in a single page
00031 
00035 struct HyperField {
00036     short x1, y1, x2, y2;
00037     char* text_ptr;                                 // pointer to the hyper-field name in the text
00038     short text_len;                                 // length of the hyper-field name
00039 };
00040 
00041 //--------- Define class Font ----------//
00042 
00043 struct FontInfo;
00044 
00048 class Font {
00049 public:
00050     char    init_flag;
00051 
00052     char*   next_text_ptr;                        // these 3 vars are used for storing
00053     short   next_text_y;                          // the result parameters after calling
00054     short   line_count;                           // put_paragraph(). Refer to put_paragraph()
00055 
00056     short   font_height;                          // height of a character
00057     short   std_font_height;
00058     short   max_font_height;
00059     short   max_font_width;                       // width of the widest character in the font
00060     short   space_width;                          // width of the space character
00061     short   inter_char_space;                     // inter-character space
00062 
00063     unsigned short first_char;                    // the starting available character
00064     unsigned short last_char;                     // the ending available character
00065 
00066     FontInfo* font_info_array;
00067     char*    font_bitmap_buf;                     // pointer to the buffer of the font
00068 
00069 public:
00070     static short      hyper_field_count;
00071     static HyperField hyper_field_array[MAX_HYPER_FIELD];
00072 
00073     //---------------------------------------//
00074 
00075 public:
00076     Font(char* =NULL);
00077     ~Font();
00078 
00079     void init(char* fontName, int interCharSpace=1, int italicShift=0);
00080     void deinit();
00081 
00082     int  height()                    { return font_height; }
00083     int  width()                     { return space_width; }
00084 
00085     void use_std_height()   { font_height = std_font_height; }
00086     void use_max_height()   { font_height = max_font_height; }
00087 
00088     int  text_width(char*, int= -1, int=0);
00089     int  text_height(int=DEFAULT_LINE_SPACE);
00090 
00091     int  put(int,int,char*,char=0,int= -1);
00092 
00093     int  put(int x, int y, int value, char clearBack=0, int x2= -1)
00094         { return put( x, y, m.format(value), clearBack, x2 ); }
00095 
00096     void put_char(int,int,unsigned short);
00097     void right_put(int,int,char*);
00098 
00099     int  d3_put(int,int,char*);
00100     void d3_put(int,int,int,int,char*);
00101     int  center_put(int,int,int,int,char*,char clearBack=0);
00102 
00103     void put_paragraph(int,int,int,int,char*,int=DEFAULT_LINE_SPACE,int=1,char=1);
00104 
00105     char* Font::get_line(int area_width, int line, char *textPtr);
00106     int  find_splitter(int,int,char*);
00107     void count_line(int x1, int y1, int x2, int y2, char *text,
00108                     int lineSpace, int& totalLines, int& dispLines);
00109     int count_line(int area_width, char *textPtr);
00110     void put_char_to_buffer(char* dest, int destPitch, int x1, int y1, unsigned short text);
00111     void put_to_buffer(char* dest, int destPitch, int x1, int y1, char *text);
00112     void center_put_to_buffer(char* dest, int destPitch, int x1, int y1, int x2, int y2, char *text);
00113 
00114     void put_char_to_bufferW(short* dest, int destPitch, int x1, int y1, unsigned short text);
00115     void put_to_bufferW(short* dest, int destPitch, int x1, int y1, char *text);
00116     void center_put_to_bufferW(short* dest, int destPitch, int x1, int y1, int x2, int y2, char *text);
00117 
00118     short translate_german_char(short textChar);
00119 
00120     //----------- <int> version -------------//
00121 
00122     void put_field(int,int,char*,int,int,int=1);
00123     void update_field(int,int,int,int,int);
00124     void field(int,int,char*,int,int,int,int,int,char* helpCode=NULL);
00125     int  disp(int,int,int,int,int);
00126 
00127     //----- <short> version, call <int> version directly -----//
00128 
00129     void put_field(int a,int b,char* c,int d,short e,int f=1)
00130         { put_field(a,b,c,d,(int)e,f); }
00131 
00132     void update_field(int a,int b,short c,int d,int e)
00133         { update_field(a,b,(int)c,d,e); }
00134 
00135     void field(int a,int b,char* c,int d,short e,int f,int g,int h,char* helpCode=NULL)
00136         { field(a,b,c,d,(int)e,f,g,h); }
00137 
00138     int  disp(int a,int b,short c,int d,int e)
00139         { return disp(a,b,(int)c,d,e); }
00140 
00141     //---- <long> version, call <int> version directly ------//
00142 
00143     void put_field(int a,int b,char* c,int d,long e,int f=1)
00144         { put_field(a,b,c,d,(int)e,f); }
00145 
00146     void update_field(int a,int b,long c,int d,int e)
00147         { update_field(a,b,(int)c,d,e); }
00148 
00149     void field(int a,int b,char* c,int d,long e,int f,int g,int h,char* helpCode=NULL)
00150         { field(a,b,c,d,(int)e,f,g,h); }
00151 
00152     int  disp(int a,int b,long c,int d,int e)
00153         { return disp(a,b,(int)c,d,e); }
00154 
00155     //------------- <double> version ---------------//
00156 
00157     void put_field(int,int,char*,int,double,int=1);
00158     void update_field(int,int,double,int,int);
00159     void field(int,int,char*,int,double,int,int,int,char* helpCode=NULL);
00160     int  disp(int,int,double,int,int);
00161 
00162     //-------------- <char*> version ---------------//
00163 
00164     void put_field(int,int,char*,int,char*);
00165     void update_field(int,int,char*,int);
00166     void field(int,int,char*,int,char*,int,int,char* helpCode=NULL);
00167     int  disp(int,int,char*,int);
00168 };
00169 
00170 extern Font font_san, font_std, font_small, font_mid, font_news, font_casa;
00171 extern Font font_red_san;
00172 extern Font font_green_san;
00173 extern Font font_blue_san;
00174 extern Font font_small_san;
00175 extern Font font_fblack;
00176 extern Font font_fdiamond;
00177 extern Font font_stone;
00178 extern Font font_charts;
00179 extern Font font_chartsm;
00180 
00181 extern Font font_chart_blue_sm;
00182 extern Font font_chart_orange_sm;
00183 extern Font font_chart_red_sm;
00184 extern Font font_chart_green_sm;
00185 extern Font font_chart_purple_sm;
00186 
00187 extern Font font_numbers;
00188 extern Font font_redcharts;
00189 extern Font font_barcharts;
00190 extern Font font_hstone;
00191 extern Font font_yellow_diamond;
00192 extern Font font_letter;
00193 extern Font font_fscore;
00194 extern Font font_pgold;
00195 extern Font font_psilver;
00196 extern Font font_pbronze;
00197 
00198 //------------------------------------------------//
00199 #endif

Generated on Fri Aug 23 01:37:41 2002 for VirtualU by doxygen1.2.17