Andrew R
/
Ovation_Controller_1
Latest version with SSD1963 Graphics Driver
Embed:
(wiki syntax)
Show/hide line numbers
font_new.h
00001 #ifndef FONT_H 00002 00003 00004 00005 //#define TEST 00006 //#define SMALL_TEST 00007 00008 00009 /***************************************************************************/ 00010 00011 extern const unsigned char c14_data_table[]; 00012 extern const unsigned int c14_offset_table[]; 00013 extern const unsigned char c14_index_table[]; 00014 extern const unsigned char c14_width_table[]; 00015 00016 extern const unsigned char c28_data_table[]; 00017 extern const unsigned int c28_offset_table[]; 00018 extern const unsigned char c28_index_table[]; 00019 extern const unsigned char c28_width_table[]; 00020 00021 extern const unsigned char c72_data_table[]; 00022 extern const unsigned int c72_offset_table[]; 00023 extern const unsigned char c72_index_table[]; 00024 extern const unsigned char c72_width_table[]; 00025 00026 extern const unsigned char c78_1_data_table[]; 00027 extern const unsigned int c78_1_offset_table[]; 00028 extern const unsigned char c78_1_index_table[]; 00029 extern const unsigned char c78_1_width_table[]; 00030 00031 typedef struct _font { 00032 int dummy0; 00033 int dummy1; 00034 int dummy2; 00035 int height; 00036 int max_width; 00037 int space_width; 00038 const unsigned char *data_table; 00039 const unsigned int *offset_table; 00040 const unsigned char *index_table; 00041 const unsigned char *width_table; 00042 } 00043 font; 00044 00045 00046 extern font Calibri14; 00047 extern font Calibri28; 00048 extern font Calibri72; 00049 extern font Calibri78_1; 00050 00051 00052 #ifdef TEST 00053 #ifdef SMALL_TEST 00054 #define SC_WIDTH 128 00055 #define SC_HEIGHT 128 00056 #else 00057 #define SC_WIDTH 640 00058 #define SC_HEIGHT 480 00059 #endif 00060 #endif 00061 00062 void FontDrawInit( void ); 00063 00064 /** FontDraw_printf 00065 * 00066 * A "printf" function that takes coodinate values as starting point of the string. 00067 * The coodinate is a point if the left-bottom point of string output area. 00068 * 00069 * Drawing parameters should be set by FontDraw_Set... functions before this function call. 00070 * 00071 * param: x left position of the string 00072 * param: y bottom position of the string 00073 * param: format... followings are normal printf arguments 00074 */ 00075 void FontDraw_printf( int x, int y, char *format, ... ); 00076 00077 00078 /** FontDraw_puts 00079 * 00080 * Similar to "printf" but no format support. It just put a strin on to the screen. 00081 * This may be bit faster than "FontDraw_printf". 00082 * 00083 * Drawing parameters should be set by FontDraw_Set... functions before this function call. 00084 * 00085 * param: x left position of the string 00086 * param: y bottom position of the string 00087 * param: s string 00088 */ 00089 void FontDraw_puts( int x, int y, char *s ); 00090 00091 00092 /** FontDrawString 00093 * 00094 * Similar to "FontDraw_puts" but this function takes several parameters to define its propaty. 00095 * This function will be useful if user want to use other parameter setting temporary. 00096 * 00097 * param: s string 00098 * param: x left position of the string 00099 * param: y bottom position of the string 00100 * param: f_color color value for string itself 00101 * param: b_color color value for rectangle around the string 00102 * param: font_ptr pointer to the font 00103 */ 00104 void FontDrawString( char *s, int xpos, int ypos, int f_color, int b_color, font *font_ptr ); 00105 00106 00107 /** FontDrawChar 00108 * 00109 * Similar to "FontDraw_puts" but this function takes several parameters to define its propaty. 00110 * This function will be useful if user want to use other parameter setting temporary. 00111 * 00112 * param: c character 00113 * param: x left position of the string 00114 * param: y bottom position of the string 00115 * param: f_color color value for character itself 00116 * param: b_color color value for rectangle around the character 00117 * param: font_ptr pointer to the font 00118 * return: the width of the character (including inter-caracter space if user set) 00119 */ 00120 int FontDrawChar( char c, int xpos, int ypos, int f_color, int b_color, font *font_ptr ); 00121 00122 /** FontDrawStringWidth 00123 * 00124 * Returns the string width (span) which will be drawn on the screen. 00125 * This will be useful like case of aligning the string at center or right. 00126 * for instance, if the string needed to be aligned to right and of the screen (ex. pixel=480), the code will be... 00127 * 00128 * code: 00129 * x = 480 - FontDrawStringWidth( "sample string", &Calibri14 ); 00130 * FontDrawString( "sample string", x, y, 0x000000, 0xFFFFFF, &Calibri14 ); 00131 * 00132 * param: s string 00133 * param: font_ptr pointer to the font 00134 * return: string width (including inter-caracter space if user set) 00135 */ 00136 int FontDrawStringWidth( char *s, font *font_ptr ); 00137 00138 00139 /** FontDraw_SetFont 00140 * 00141 * Setting the font to draw 00142 * This will affect to following "FontDraw_printf" and "FontDraw_puts" calls 00143 * 00144 * param: f font (default: Carlibri14) 00145 */ 00146 void FontDraw_SetFont( font f ); 00147 00148 00149 /** FontDraw_SetInterCharSpace 00150 * 00151 * Setting the inter-character space 00152 * When drawing the string, each caracters can have additional space between those (this will not applied to space caracters) 00153 * 00154 * param: space pixels. no ngative number can be specified (default: 0) 00155 */ 00156 void FontDraw_SetInterCharSpace( int space ); 00157 00158 00159 /** FontDraw_SetAlphaMode 00160 * 00161 * If the alphamode is enabled,no background will be written. No rectangle around the charators are drawn. 00162 * 00163 * param: mode zero for disable, non-zero for enable (default: disable) 00164 */ 00165 void FontDraw_SetAlphaMode( int mode ); 00166 00167 00168 /** FontDraw_SetForegroundColor 00169 * 00170 * Settng of the color for character itself. 00171 * 00172 * param: v color (24 bit value) (default: 0x0000FF) 00173 */ 00174 void FontDraw_SetForegroundColor( int v ); 00175 00176 00177 /** FontDraw_SetBackgroundColor 00178 * 00179 * Settng of the color for rectangle around the charators. 00180 * 00181 * param: v color (24 bit value) (default: 0xFFFFFF) 00182 */ 00183 void FontDraw_SetBackgroundColor( int v ); 00184 00185 00186 #endif
Generated on Tue Jul 12 2022 23:07:04 by 1.7.2