Andrew R
/
_____testcode_c
This program generates proportional spacing fonts. for use with the SDD1963 driver
main.cpp@0:f207e3c3b773, 2013-11-21 (annotated)
- Committer:
- andrewcrussell
- Date:
- Thu Nov 21 04:13:59 2013 +0000
- Revision:
- 0:f207e3c3b773
Font Generator Program for SDD1963 graphics driver. Written/modified by Tedd Okano
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewcrussell | 0:f207e3c3b773 | 1 | //#include "mbed.h" |
andrewcrussell | 0:f207e3c3b773 | 2 | #include <stdio.h> |
andrewcrussell | 0:f207e3c3b773 | 3 | |
andrewcrussell | 0:f207e3c3b773 | 4 | #include "font_new.h" |
andrewcrussell | 0:f207e3c3b773 | 5 | |
andrewcrussell | 0:f207e3c3b773 | 6 | #ifdef TEST |
andrewcrussell | 0:f207e3c3b773 | 7 | extern unsigned char screen[ SC_WIDTH * SC_HEIGHT ] = { '.' }; |
andrewcrussell | 0:f207e3c3b773 | 8 | #endif |
andrewcrussell | 0:f207e3c3b773 | 9 | |
andrewcrussell | 0:f207e3c3b773 | 10 | void clear_screen( void ); |
andrewcrussell | 0:f207e3c3b773 | 11 | void show_screen( int xs, int width, int ys, int height ); |
andrewcrussell | 0:f207e3c3b773 | 12 | |
andrewcrussell | 0:f207e3c3b773 | 13 | |
andrewcrussell | 0:f207e3c3b773 | 14 | int main() |
andrewcrussell | 0:f207e3c3b773 | 15 | { |
andrewcrussell | 0:f207e3c3b773 | 16 | FontDrawInit(); |
andrewcrussell | 0:f207e3c3b773 | 17 | |
andrewcrussell | 0:f207e3c3b773 | 18 | printf( "\r\n<< font drawing test >>\r\n" ); |
andrewcrussell | 0:f207e3c3b773 | 19 | #ifdef SMALL_TEST |
andrewcrussell | 0:f207e3c3b773 | 20 | clear_screen(); |
andrewcrussell | 0:f207e3c3b773 | 21 | |
andrewcrussell | 0:f207e3c3b773 | 22 | FontDraw_SetInterCharSpace( 0 ); |
andrewcrussell | 0:f207e3c3b773 | 23 | FontDraw_SetForegroundColor( 'Må' ); |
andrewcrussell | 0:f207e3c3b773 | 24 | FontDraw_SetBackgroundColor( ' ' ); |
andrewcrussell | 0:f207e3c3b773 | 25 | FontDraw_SetFont( Calibri14 ); |
andrewcrussell | 0:f207e3c3b773 | 26 | // FontDraw_printf( 0, 0, "Test %d", 0, 9 ); |
andrewcrussell | 0:f207e3c3b773 | 27 | FontDraw_printf( 0, 0, "+012" ); |
andrewcrussell | 0:f207e3c3b773 | 28 | FontDraw_SetAlphaMode( 1 ); |
andrewcrussell | 0:f207e3c3b773 | 29 | FontDrawChar( 'W', 20, 5, '@', '.', &Calibri28 ); |
andrewcrussell | 0:f207e3c3b773 | 30 | |
andrewcrussell | 0:f207e3c3b773 | 31 | FontDrawChar( '@', 0, 0, '*', '.', &Calibri72 ); |
andrewcrussell | 0:f207e3c3b773 | 32 | show_screen( 0, 100, 0, 40 ); |
andrewcrussell | 0:f207e3c3b773 | 33 | |
andrewcrussell | 0:f207e3c3b773 | 34 | #else |
andrewcrussell | 0:f207e3c3b773 | 35 | |
andrewcrussell | 0:f207e3c3b773 | 36 | FontDraw_SetInterCharSpace( 2 ); |
andrewcrussell | 0:f207e3c3b773 | 37 | FontDraw_SetForegroundColor( 'M' ); |
andrewcrussell | 0:f207e3c3b773 | 38 | FontDraw_SetBackgroundColor( ' ' ); |
andrewcrussell | 0:f207e3c3b773 | 39 | FontDraw_SetFont( Calibri14 ); |
andrewcrussell | 0:f207e3c3b773 | 40 | FontDraw_printf( 20, 23, "test %d W1", 9 ); |
andrewcrussell | 0:f207e3c3b773 | 41 | |
andrewcrussell | 0:f207e3c3b773 | 42 | FontDraw_SetInterCharSpace( 10 ); |
andrewcrussell | 0:f207e3c3b773 | 43 | FontDrawString( "Test ABCD", 10, 0, '@', '-', &Calibri14 ); |
andrewcrussell | 0:f207e3c3b773 | 44 | |
andrewcrussell | 0:f207e3c3b773 | 45 | int start = 0; |
andrewcrussell | 0:f207e3c3b773 | 46 | start += FontDrawChar( '@', start, 46, '@', '.', &Calibri28 ); |
andrewcrussell | 0:f207e3c3b773 | 47 | |
andrewcrussell | 0:f207e3c3b773 | 48 | FontDraw_SetAlphaMode( 1 ); |
andrewcrussell | 0:f207e3c3b773 | 49 | start += FontDrawChar( 'W', 50, 15, '@', '.', &Calibri72 ); |
andrewcrussell | 0:f207e3c3b773 | 50 | #ifdef TEST |
andrewcrussell | 0:f207e3c3b773 | 51 | show_screen( 0, 200, 0, 150 ); |
andrewcrussell | 0:f207e3c3b773 | 52 | #endif |
andrewcrussell | 0:f207e3c3b773 | 53 | |
andrewcrussell | 0:f207e3c3b773 | 54 | #endif |
andrewcrussell | 0:f207e3c3b773 | 55 | return ( 0 ); |
andrewcrussell | 0:f207e3c3b773 | 56 | } |
andrewcrussell | 0:f207e3c3b773 | 57 | #ifdef TEST |
andrewcrussell | 0:f207e3c3b773 | 58 | |
andrewcrussell | 0:f207e3c3b773 | 59 | void clear_screen( void ) |
andrewcrussell | 0:f207e3c3b773 | 60 | { |
andrewcrussell | 0:f207e3c3b773 | 61 | for ( int i = 0; i < SC_WIDTH * SC_HEIGHT; i++ ) |
andrewcrussell | 0:f207e3c3b773 | 62 | *(screen + i) = '.'; |
andrewcrussell | 0:f207e3c3b773 | 63 | } |
andrewcrussell | 0:f207e3c3b773 | 64 | |
andrewcrussell | 0:f207e3c3b773 | 65 | |
andrewcrussell | 0:f207e3c3b773 | 66 | void show_screen( int xs, int width, int ys, int height ) |
andrewcrussell | 0:f207e3c3b773 | 67 | { |
andrewcrussell | 0:f207e3c3b773 | 68 | int i; |
andrewcrussell | 0:f207e3c3b773 | 69 | int j; |
andrewcrussell | 0:f207e3c3b773 | 70 | |
andrewcrussell | 0:f207e3c3b773 | 71 | for ( j = (ys + height - 1); j >= 0; j-- ) |
andrewcrussell | 0:f207e3c3b773 | 72 | { |
andrewcrussell | 0:f207e3c3b773 | 73 | printf( "%04d ", j ); |
andrewcrussell | 0:f207e3c3b773 | 74 | |
andrewcrussell | 0:f207e3c3b773 | 75 | for ( i = xs; i < xs + width; i++ ) |
andrewcrussell | 0:f207e3c3b773 | 76 | { |
andrewcrussell | 0:f207e3c3b773 | 77 | printf( "%c", *(screen + (j * SC_WIDTH) + i) & 0xFF ); |
andrewcrussell | 0:f207e3c3b773 | 78 | // printf( "%c", *(screen + (((SC_HEIGHT - 1) - j) * SC_HEIGHT) + i) & 0xFF ); |
andrewcrussell | 0:f207e3c3b773 | 79 | } |
andrewcrussell | 0:f207e3c3b773 | 80 | printf( "\r\n" ); |
andrewcrussell | 0:f207e3c3b773 | 81 | } |
andrewcrussell | 0:f207e3c3b773 | 82 | } |
andrewcrussell | 0:f207e3c3b773 | 83 | #endif |