The text display supports ASCII characters as shown in Figure 3.1.
3.1.2 Text Display API The main text display API is as follows:
l void Gui_dispchar (U16 c): Displays a character using the current font in the current text position of the current window, and does not appear if the font is not supported;
l void Gui_dispcharat (U16 C, i16p x, i16p y): Displays one character using the current font at the specified text position in the current window, or not if the font is not supported. The coordinates specified for the upper-left corner of the displayed character;
l void Gui_dispchars (U16 c, int Cnt): uses the current font to display Cnt characters in the current text position of the current window, and does not appear if the font is not supported;
l void Gui_dispnextline (void): Moves the cursor to the beginning of the next line, equivalent to line break;
l void gui_dispstring (const char Gui_far *s): Displays a string using the current font in the current text position of the current window, which supports ' \ n ' control characters, and is not displayed if the font is not supported;
l void Gui_dispstringlen (const char gui_far *s, int Len); Displays a character using the current font in the current text position of the current window, or not if the font is not supported. If the string length is shorter, it is filled with spaces, otherwise it will only show part;
l void Gui_dispstringat (const char Gui_far *s, int x, int y): Displays a string using the current font at the specified text position in the current window, supports ' \ n ' control characters, and is not displayed if the font is not supported;
L Gui_dispstringatceol (): Displays the string, and clears the display to the end of the corresponding line;
l void Gui_dispstringhcenterat (const char Gui_far *s, int x, int y): Displays a string with the current font in the current window centered in (x, y) (text centered), or not if the font is not supported will be displayed;
l void Gui_dispstringinrect (const char Gui_far *s, const gui_rect *prect, int Align): Displays a string in the current font in the rectangle specified in the current window ... The datum of the coordinate is the middle position of the string. The alignment align optional values are:
U gui_ta_top, Gui_ta_bottom, gui_ta_vcenter for vertical alignment.;
U gui_ta_left, Gui_ta_right, gui_ta_hcenter for horizontal alignment.
Select the alignment within the rectangle box. If the rectangle is too small, you may not be able to display all of the content.
l void Gui_dispstringinrectex (const char gui_uni_ptr *s,gui_rect* prect,int textalign,int maxlen,const GUI_ROTATION * PLC D_API); Displays a string in the current font in the rectangle specified in the current window. maxlen-the maximum string length. Plcd_api value GUI_ROTATE_0,GUI_ROTATE_CCW rotates 90 degrees clockwise.
Note: The above API functions can be divided into several categories: single character display, line wrapping, normal display of string, string display in Rectangle box. The additional feature is the design display alignment, Text style. 3.1.3 Selection of text mode 1. Supports four types of text modes
L Gui_textmode_normal: Normal text mode, the writing text will overwrite the point on the original LCD;
L Gui_textmode_reverse: Invert mode, display text color will be reversed; foreground color and background color invert;
Note: This is not clear how the function.
L Gui_textmode_trans: Transparent mode, writing text will be displayed at the top of the original graph;
L Gui_textmode_xor: XOR mode.
Note: This is not clear how the function. 2. Text-mode-related APIs
l int Gui_gettextmode (void): Gets the displayed text pattern;
l int gui_settextmode (int textmode): Sets the text mode of the display;
L Char Gui_settextstyle (char style): Sets the text style of the display, the main styles are:
n Gui_ts_normal;
n Gui_ts_underline;
n Gui_ts_strikethru;
N Gui_ts_overline.
Note: Text style, interesting. 3.1.4 Text alignment:
l int gui_gettextalign (void): Gets the text alignment;
l int gui_settextalign (int TextAlign): Sets the alignment of text, main alignment:
n Gui_ta_left-gui_ta_hcenter-gui_ta_right;
N Gui_ta_top-gui_ta_vcenter-gui_ta_bottom.
l void Gui_setlborder (int x): Sets the left margin of the display.
Note: This should be a variable that is set and then used when the display function is called. The alignment should be a function that shows that the function parameter contains the specified coordinates, such as Gui_dispstringat (). The corresponding coordinates specify the datum coordinates to display for alignment. See left-aligned and Center-aligned effects in listing 3.1. 3.1.5 Current text position:
Each task corresponds to a text position relative to the window's (0,0) coordinates. Used to determine the current position of the output text.
L char gui_gotoxy (int x, int y);
L char Gui_gotox (int x);
L char gui_gotoy (int y);
l int gui_getdispposx (void);
l int gui_getdispposy (void).
Note: I think the text shown here should be relative to the active window, not to the entire LCD screen. When you enter a character, the starting position of the display corresponds to the coordinates of the upper-left corner of the font image. 3.1.6 Full and partial cleanup of Windows
l void Gui_clear (void): Clears the current window. If the current window is not specified, the entire screen is cleared;
l void Gui_dispceol (void): Clears the text from the current position of the current window to the end of the current line at the height of the current font.