1.Quick Glance #
Font Functions are GPE based functions used to get data on a font, render it under certain conditions or more.
2.Font Related Functions #
BOOL GPE.font_is_monospaced(int fontId)
Returns whether or not if a font is monospaced( Based on editor information given on export ).
Scope: GPE
Return type : bool
Parameters:
- int fontId– an integer of a FONT(aka fnt_menu). If undefined, null or non-number based this function used returns A BLANK STRING.
STRING GPE.get_font_family(int fontId)
Retrieves the name of the font family the current font is using.
Scope: GPE
Return type : STRING
Parameters:
- int fontId– an integer of a FONT(aka fnt_menu). If undefined, null or non-number based this function used returns A BLANK STRING.
int GPE.get_font_width(int fontId, STRING words)
Retrieves the WIDTH IN PIXELS of a font if it were to render "words".
Scope: GPE
Return type : int
Parameters:
- int fontId– an integer of a FONT(aka fnt_menu). If undefined, null or non-number based this function used returns 0.
- STRING words - The string being calculated.
int GPE.get_font_height(int fontId, STRING words)
Retrieves the HEIGHT IN PIXELS of a font if it were to render "words".
Scope: GPE
Return type : int
Parameters:
- int fontId– an integer of a FONT(aka fnt_menu). If undefined, null or non-number based this function used returns 0.
- STRING words - The string being calculated.
int GPE.get_font_size(int fontId)
Retrieves the name of the size in "pts" of a font. Think of that good ole Times new Roman 12pt required on your school papers.
Scope: GPE
Return type : int
Parameters:
- int fontId– an integer of a FONT(aka fnt_menu). If undefined, null or non-number based this function used returns -1.
void GPE.render_text(int fontId, int xOn, int yOn, String textToRender, Color fontRenderColor, int fontHalign, int fontValign)
Retrieves Renders a text using the assigned font resource.
Scope: GPE
Return type : void
Parameters:
- int fontId– an integer of a FONT(aka fnt_menu). If undefined, null or non-number based this function used 20px Arial FONT.
- int xOn - the x-coordinate to render the text.
- int yOn - the y-coordinate to render the text.
- String textToRender - the string of characters to render. If empty the function does nothing.
- Color fontRenderColor - an RGB or Hex color. i.e: "rgba( 255,255,255) or #FFF.
- int fontHalign- Left- fa_left, Center - fa_center, Right - fa_right. Defaults to fa_left;
- int fontValign- Top- fa_top, Middle - fa_middle, Bottom - fa_bottom. Defaults to fa_top;
void GPE.render_wrapped_text(int fontId, int xOn, int yOn, String textToRender, Color fontRenderColor, maxWidth, lineHeight)
Retrieves Renders a text using the assigned font resource over multiple lines(similar to a paragraph.
Scope: GPE
Return type : void
Parameters:
- int fontId– an integer of a FONT(aka fnt_menu). If undefined, null or non-number based this function used 20px Arial FONT.
- int xOn - the x-coordinate to render the text.
- int yOn - the y-coordinate to render the text.
- String textToRender - the string of characters to render. If empty the function does nothing.
- Color fontRenderColor - an RGB or Hex color. i.e: "rgba( 255,255,255) or #FFF.
- int maxWidth - The max-width of each-line within the wrapped text area.
- int lineHeight- The vertical diffence between each line within the wrapped text. This equates generally to the font-height plus any padding you choose.
3.Related Pages #
- Font Editor – quick overview of managing fonts in GPE’s editor.
- Fonts– quick overview of managing fonts in GPE’s editor.
- Graphics – Information for the graphics side of GPE.
- The Editor – Information on how to utilize GPE’s editor.
- Coding with GPE – A general tutorial on how to code in GPE.
- Function Directory – The directory to learn about functions on a categorical basis.