C Language Development Kit/Functions/SetOffset

From OptiWiki

Jump to: navigation, search
Description This function can be used to exactly align a character in the Y-direction on

the screen. The function allows you to print a character a defined number of pixels below the position where it should be printed given the Y-coordinate of its cursor position. This makes it possible to align lines of text with different font sizes.

void set_offset(int offset);
int offset
The offset of the next printed character.
Returns None
Remarks The offset is set back to zero when the display is cleared.
#include "lib.h"
#include <stdio.h>
void main( void )
    systemsetting("WK");    // Key click on
    while( 1 )
        setfont( TINY_FONT, 0);
        printf("\fHello world");
        gotoxy( 0, 0);
        set_offset( 6 );
        setfont( SMALL_FONT, 0);
        printf("Hello world");
        gotoxy( 0, 0);
        set_offset( 8+6 );
        setfont( MEDIUM_FONT, 0);
        printf("Hello world");
        gotoxy( 0, 0);
        set_offset( 8+6+12 );
        setfont( LARGE_FONT, 0);
        printf("Hello world");
        while( !kbhit())

Personal tools