Name
MakeConsoleChr -- merge style and color into character code (V10.0)
Synopsis
ch = MakeConsoleChr(c[, style, pen])
Platforms
Linux, macOS, Windows

Function
This function can be used to create a formatted character code that can be passed to all functions that accepted a numeric character code, e.g. InsertConsoleChr(). MakeConsoleChr() takes the character passed in c and applies the style settings passed in style and the color settings of the pen passed in pen to it.

The character must be passed by its numeric Unicode codepoint, not as a string. So for the character 'A' you would have to pass the value 65 in c. Alternatively, you can also pass one of the following special characters in c:

#CONSOLECHR_BLOCK:
Solid block
#CONSOLECHR_BOARD:
Board of squares
#CONSOLECHR_BTEE:
Bottom "T"
#CONSOLECHR_BULLET:
Bullet
#CONSOLECHR_CKBOARD:
Checkerboard
#CONSOLECHR_DARROW:
Down arrow
#CONSOLECHR_DEGREE:
Degree symbol
#CONSOLECHR_DIAMOND:
Diamond
#CONSOLECHR_GEQUAL:
Greater than or equal
#CONSOLECHR_HLINE:
Horizontal line
#CONSOLECHR_LANTERN:
Lantern symbol
#CONSOLECHR_LARROW:
Left arrow
#CONSOLECHR_LEQUAL:
Less than or equal
#CONSOLECHR_LLCORNER:
Lower left box corner
#CONSOLECHR_LRCORNER:
Lower right box corner
#CONSOLECHR_LTEE:
Left "T"
#CONSOLECHR_NEQUAL:
Not equal
#CONSOLECHR_PI:
Pi
#CONSOLECHR_PLMINUS:
Plus/minus sign
#CONSOLECHR_PLUS:
Plus sign, cross, or four-corner piece
#CONSOLECHR_RARROW:
Right arrow
#CONSOLECHR_RTEE:
Right "T"
#CONSOLECHR_S1:
Scan line 1
#CONSOLECHR_S3:
Scan line 3
#CONSOLECHR_S7:
Scan line 7
#CONSOLECHR_S9:
Scan line 9
#CONSOLECHR_STERLING:
Pounds sterling symbol
#CONSOLECHR_TTEE:
Top "T"
#CONSOLECHR_UARROW:
Up arrow
#CONSOLECHR_ULCORNER:
Upper left box corner
#CONSOLECHR_URCORNER:
Upper right box corner
#CONSOLECHR_VLINE:
Vertical line

The style parameter supports all console styles offered by the SetConsoleStyle() function. See SetConsoleStyle for details. If you don't want to set any style flags, you can pass the special style #CONSOLESTYLE_NONE for style. In that case, MakeConsoleChr() won't apply any styles.

The optional parameter pen can be used to define the pen that should be used to draw the character. Fore- and background colors of that pen can be initialized using the InitConsoleColor() function. See InitConsoleColor for details.

To decompose a character that contains style or color formatting into its constituents, use the DecomposeConsoleChr() function. See DecomposeConsoleChr for details.

You must enable advanced console mode using EnableAdvancedConsole() before you can use this function. See EnableAdvancedConsole for details.

Inputs
c
character as a Unicode codepoint
style
formatting style to apply or #CONSOLESTYLE_NONE to ignore the argument
pen
optional: color pen to use or -1 to skip setting a pen (defaults to -1)
Results
ch
formatted character code

Show TOC