2015-09-02 15:15:32 +02:00
# define MEMSIZE 0x2EE80
2015-08-27 10:33:51 +02:00
# include "../lib/font.h"
# include "../lib/gui.h"
2015-09-02 15:15:32 +02:00
# define PANELH 30
2015-08-27 10:33:51 +02:00
void main ( )
{
2015-09-02 15:15:32 +02:00
proc_info Form ;
2015-08-27 10:33:51 +02:00
word i , y , btn ;
char line [ 256 ] , title [ 4196 ] ;
font . no_bg_copy = true ;
font . color = 0 ;
font . bg_color = 0xFFFFFF ;
if ( ! param ) strcpy ( # param , " /sys/fonts/Tahoma.kf " ) ;
font . load ( # param ) ;
strcpy ( # title , " Kolibri font preview: " ) ;
strcat ( # title , # param ) ;
loop ( )
{
switch ( WaitEvent ( ) )
{
case evButton :
btn = GetButtonID ( ) ;
if ( btn = = 1 ) ExitProcess ( ) ;
if ( btn = = 2 ) font . weight ^ = 1 ;
if ( btn = = 3 ) font . italic ^ = 1 ;
2015-09-02 15:15:32 +02:00
if ( btn = = 4 ) font . smooth ^ = 1 ;
goto _DRAW_WINDOW_CONTENT ;
2015-08-27 10:33:51 +02:00
case evReDraw :
2015-09-02 15:15:32 +02:00
DefineAndDrawWindow ( 215 , 100 , 500 , 320 , 0x74 , 0xFFFFFF , # title ) ;
GetProcessInfo ( # Form , SelfInfo ) ;
_DRAW_WINDOW_CONTENT :
DrawBar ( 0 , 0 , Form . cwidth , PANELH , 0xCCCccc ) ;
2015-08-27 10:33:51 +02:00
CheckBox2 ( 10 , 8 , 2 , " Bold " , font . weight ) ;
CheckBox2 ( 70 , 8 , 3 , " Italic " , font . italic ) ;
2015-09-02 15:15:32 +02:00
CheckBox2 ( 140 , 8 , 4 , " Smooth " , font . smooth ) ;
font . buffer_size = free ( font . buffer ) ;
2015-08-27 10:33:51 +02:00
if ( ! font . data )
{
2015-09-02 15:15:32 +02:00
DrawBar ( 0 , PANELH , Form . cwidth , Form . cheight - PANELH , 0xFFFfff ) ;
2015-08-27 10:33:51 +02:00
WriteText ( 10 , 50 , 0x82 , 0xFF00FF , " Font is not loaded. " ) ;
2015-09-02 15:15:32 +02:00
}
else for ( i = 10 , y = 5 ; i < 22 ; i + + , y + = font . height ; ) //not flexible, need to calculate font count and max line length
2015-08-27 10:33:51 +02:00
{
font . size . text = i ;
sprintf ( # line , " <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> /size font %d <20> <> <EFBFBD> ᥫ<EFBFBD> <E1A5AB> ." , i ) ;
2015-09-02 15:15:32 +02:00
font . prepare_buf ( 10 , y , Form . cwidth , Form . cheight - PANELH , # line ) ;
2015-08-27 10:33:51 +02:00
}
2015-09-02 15:15:32 +02:00
if ( font . smooth ) SmoothFont ( font . buffer , font . size . width , font . size . height ) ;
font . show ( 0 , PANELH ) ;
2015-08-27 10:33:51 +02:00
}
}
}
void CheckBox2 ( dword x , y , id , text , byte value ) {
CheckBox ( x , y , 14 , 14 , id , text , system . color . work_graph , system . color . work_text , value ) ;
}