Fonts and Text


Functions

void text (int x, int y, struct Font *ptr_font, char *sz_text, int, color_t color)
void textC (int x, int y, struct Font *ptr_font, char *sz_text, int width, color_t color, color_t bk_color)
int draw_bounded_text (struct Graphics *ptr_gfx, int x, int y, int width, char *sz_text)


Compounds

     struct   FontProvides functions for manipulating the appearance of text characters


Detailed Description

Some structures for work with text (please pay attention to Font structure).


Function Documentation

int draw_bounded_text ( struct Graphics * ptr_gfx,
int x,
int y,
int width,
char * sz_text )
 

Draws bounded text with trailing dots if text is cut.

Parameters:
ptr_gfx   a pointer to the graphics context.
x   the x-coordinate of a text block.
y   the y-coordinate of a text block.
width   the width of a text block (in symbols).
sz_text   a pointer to the text to be drawn.
Returns:
The number of characters actually drawn, not including dots.
        #include <cywin.h>
        ...
        struct module_t  main_module;
        ...
        init_module( &main_module );
        ...
        draw_bounded_text( main_module.m_gfx, 10, 10, 4, "Any text" );
        ...

void text ( int x,
int y,
struct Font * ptr_font,
char * sz_text,
int,
color_t color )
 

Draws text in the specified color.

Parameters:
x   the x-coordinate of the upper-left corner.
y   the y-coordinate of the upper-left corner.
ptr_font   the pointer to the initialized font structure.
sz_text   a pointer to the string of a text to be drawn.
width   the width of a text block (in symbols).
color   the text color.
Returns:
None.
        #include <cywin.h>
        ...
        text( 10, 10, cool_normal_font, "Any text", 6, CLR_DKGRAY );
        ...

void textC ( int x,
int y,
struct Font * ptr_font,
char * sz_text,
int width,
color_t color,
color_t bk_color )
 

Draws text with specified colors for the text and the background.

Parameters:
x   the x-coordinate of the upper-left corner.
y   the y-coordinate of the upper-left corner.
ptr_font   a pointer to the initialized font structure.
sz_text   a pointer to the string of a text to be drawn.
width   the width of a text block (in symbols).
color   the text color.
bk_color   the background color.
Returns:
None.
        #include <cywin.h>
        ...
        textC( 10, 10, cool_normal_font, "Any text", 3, CLR_WHITE, CLR_BLACK );
        ...