Andrew Russell / Mbed 2 deprecated _____testcode_c

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers font_new.h Source File

font_new.h

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