This function is used to select a character font.

Syntax

int SetFont(
  unsigned int type,
  char *name
);

Parameters

type
[in] Specifies whether a user font or a built-in font is used.
The following constants are defined for this function:
ValueDescription
USER_FONT Select the user font specified by name.
HUGE_FONT Select system font (Huge).
LARGE_FONT Select system font (Large).
MEDIUM_FONT Select system font (Medium).
SMALL_FONT Select system font (Small).
TINY_FONT Select system font (Tiny).
name
[in] When specifying the user font, specify the font table.
If a system font is specified, it will be ignored.

Return value

Returns the success (OK) or failure (ERROR) of the function.

Remarks

This function is used to select the character font type.
With this function, you can specify the defined font.
The maximum bitmap that can be specified is 24 dots x 24 dots.
There is no limit on the number of characters, but the types of characters that can be displayed are limited to 65,535.
In the initial state, MEDIUM_FONT is selected.

Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Sample

#include <stdio.h>
#include "lib.h"

const char charmap[2+7*6] = {// 7 char's * 6 bytes plus 2 header bytes
    0x06, 0x06,
    0x00, 0x38, 0x44, 0x44, 0x38, 0x00, //0
    0x00, 0x7C, 0x14, 0x14, 0x08, 0x00, //1
    0x04, 0x04, 0x7C, 0x04, 0x04, 0x00, //2
    0x00, 0x44, 0x7C, 0x44, 0x00, 0x00, //3
    0x00, 0x38, 0x44, 0x44, 0x44, 0x00, //4
    0x00, 0x38, 0x44, 0x44, 0x38, 0x00, //5
    0x00, 0x7C, 0x08, 0x10, 0x7C, 0x00  //6
};

void main(void)
{
    int x;
    SetFont(USER_FONT, (char *)charmap);
   for(x=0;x<7;x++)
    {
        GotoXY(2+x,3);
        PrintSymbol(x);
    }
    SetFont(MEDIUM_FONT, 0);
    printf("\nPlease any key\r");
    ResetKey();
    for(;;)
        Idle();
}

Last updated: 2022/03/11