MiniGUI API Reference (MiniGUI-Threads)  v3.2.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Macros | Functions
System charset and font operations

Macros

#define SYSLOGFONT_DEFAULT   0
 
#define SYSLOGFONT_WCHAR_DEF   1
 
#define SYSLOGFONT_FIXED   2
 
#define SYSLOGFONT_CAPTION   3
 
#define SYSLOGFONT_MENU   4
 
#define SYSLOGFONT_CONTROL   5
 

Functions

static PLOGFONT GUIAPI GetSystemFont (int font_id)
 Gets the system logical font through an font identifier. More...
 
MG_EXPORT int GUIAPI GetSysFontMaxWidth (int font_id)
 Gets the maximal width of a single-byte character of a system font. More...
 
MG_EXPORT int GUIAPI GetSysFontAveWidth (int font_id)
 Gets the average width of a single-byte character of a system font. More...
 
MG_EXPORT int GUIAPI GetSysFontHeight (int font_id)
 Gets the height of a single-byte character of a system font. More...
 
MG_EXPORT const char *GUIAPI GetSysCharset (BOOL wchar)
 Gets the current system charset. More...
 
MG_EXPORT int GUIAPI GetSysCharHeight (void)
 Gets the height of a character of the default system font. More...
 
MG_EXPORT int GUIAPI GetSysCharWidth (void)
 Gets the width of a single-byte character of the default system font. More...
 
MG_EXPORT int GUIAPI GetSysCCharWidth (void)
 Gets the width of a multi-byte character of the default system font. More...
 

Detailed Description

MiniGUI creates a few system fonts to draw menu text, window caption, or other general items. MiniGUI at least creates two system fonts: one mono-space logical font for single-byte charset, and one mono-space logical font for multi-byte charset. For the multi-byte charset, the width of one multi-byte character should be equal to the width of two single-byte characters.

Macro Definition Documentation

#define SYSLOGFONT_CAPTION   3
See also
GetSystemFont

Definition at line 6279 of file gdi.h.

#define SYSLOGFONT_CONTROL   5
See also
GetSystemFont

Definition at line 6291 of file gdi.h.

#define SYSLOGFONT_DEFAULT   0
See also
GetSystemFont

Definition at line 6261 of file gdi.h.

#define SYSLOGFONT_FIXED   2
See also
GetSystemFont

Definition at line 6273 of file gdi.h.

#define SYSLOGFONT_MENU   4
See also
GetSystemFont

Definition at line 6285 of file gdi.h.

#define SYSLOGFONT_WCHAR_DEF   1
See also
GetSystemFont

Definition at line 6267 of file gdi.h.

Function Documentation

int GUIAPI GetSysCCharWidth ( void  )

Gets the width of a multi-byte character of the default system font.

This function returns the width of a multi-byte character of the default system font. MiniGUI uses mono-space font as the system default font.

Returns
The width of multi-byte character of the default system font.
See also
GetSysCharHeight, GetSysCharWidth

Referenced by GetSystemFont().

int GUIAPI GetSysCharHeight ( void  )

Gets the height of a character of the default system font.

This function returns the height of a character of the system default font. MiniGUI uses mono-space font as the default system font.

Normally, the width of one multi-byte character is equal to the width of two single-byte character when using the default system font.

Returns
The character height of the default system font.
See also
GetSysCharWidth, GetSysCCharWidth

Referenced by GetSystemFont().

const char *GUIAPI GetSysCharset ( BOOL  wchar)

Gets the current system charset.

This function gets the current system charset and returns the charset name. By default, the system charset is ISO8859-1 (for single-byte charset) or GB2312.1980-0 (for wide charset), but you can change it by modifying MiniGUI.cfg.

Parameters
wcharWhether to retrieve the wide charset supported currently.
Returns
The read-only buffer of charset name. If you pass wchar TRUE, This function may return NULL, if there is not any wide charset supported.

Referenced by GetSystemFont().

int GUIAPI GetSysCharWidth ( void  )

Gets the width of a single-byte character of the default system font.

This function returns the width of a single-byte character of the default system font. MiniGUI uses mono-space font as the default system font, but you can specify a different font to output text in windows of MiniGUI.

Returns
The width of single-byte character of the default system font.
See also
GetSysCharHeight, GetSysCCharWidth, SelectFont, CreateLogFont

Referenced by GetSystemFont().

int GUIAPI GetSysFontAveWidth ( int  font_id)

Gets the average width of a single-byte character of a system font.

This function returns the average width of a single-byte character of one system font.

Parameters
font_idThe identifier of a system font.
Returns
The average width of single-byte character of the default system font.
See also
GetSystemFont

Referenced by GetSystemFont().

int GUIAPI GetSysFontHeight ( int  font_id)

Gets the height of a single-byte character of a system font.

This function returns the height of a single-byte character of one system font.

Parameters
font_idThe identifier of a system font.
Returns
The height of single-byte character of the default system font.
See also
GetSystemFont

Referenced by GetSystemFont().

int GUIAPI GetSysFontMaxWidth ( int  font_id)

Gets the maximal width of a single-byte character of a system font.

This function returns the maximal width of a single-byte character of one system font.

Parameters
font_idThe identifier of a system font.
Returns
The maximal width of single-byte character of the default system font.
See also
GetSystemFont

Referenced by GetSystemFont().

PLOGFONT GUIAPI GetSystemFont ( int  font_id)
inlinestatic

Gets the system logical font through an font identifier.

This function returns the system logical font through the font identifier font_id.

Parameters
font_idThe identifier of a system font, can be one of the following values:
  • SYSLOGFONT_DEFAULT
    The default system logical font in single-byte charset, must be rbf.
  • SYSLOGFONT_WCHAR_DEF
    The default system logical font in multi-byte charset, must be rbf.
  • SYSLOGFONT_FIXED
    The fixed space system logical font.
  • SYSLOGFONT_CAPTION
    The system logical font used to draw caption text.
  • SYSLOGFONT_MENU
    The system logical font used to draw menu items.
  • SYSLOGFONT_CONTROL
    The system logical font used to draw controls.
Returns
The pointer to the system logical font. NULL on error.

Definition at line 6321 of file gdi.h.

References GetSysCCharWidth(), GetSysCharHeight(), GetSysCharset(), GetSysCharWidth(), GetSysFontAveWidth(), GetSysFontHeight(), GetSysFontMaxWidth(), and NULL.