Text functions - Ambercroft/TFT_eSPI GitHub Wiki

Text functions

drawNumber(long NUM, int32_t X0, int32_t Y0, uint8_t H); == conficting ==

Draw a long integer with height?? font??

  • NUM >> Value to draw.
  • X0,Y0 >> Origin point.
  • H >> Optional. ?? is this font or height ??
  • Return a uint16_t ??

drawChar(uint16_t CHAR, uint32_t X0, uint32_t Y0, uint8_t H); ??

Draw a unicode character onto the screen. Use font/height.

  • CHAR >> Character to draw.
  • X0,Y0 >> Origin point.
  • H >> Optional. Is this font or height? Ref : See setting fonts before use.

drawFloat(float NUM, int32_t X0, int32_t Y0, uint8_t H, FONT); == conficting ==

Draw a float number with height?? font?? Prints seven non zero digits maximum.

  • NUM >> Value to draw.
  • X0,Y0 >> Origin point.
  • H >> Optional.
  • H >> Height optional??
  • F >> font optional ??
  • Return a uint16_t ??
    Ref : See setTextColor()

drawString(STRING, uint32_t X0,uint32_t Y0, uint8_t FONT);

Draw string with padding if defined.

  • STRING >> variable (const String&) or "" (const char*) to draw.
  • X0,Y0 >> position
  • FONT >> Optional ?
    Ref : See setTextColor()

drawCentreString(STRING, uint32_t X0,uint32_t Y0, uint8_t FONT);

Draw string centred on X0.

  • STRING >> variable (const String&) or "" (const char*) to draw.
  • X0,Y0 >> position
  • FONT >> Optional ?
    Ref : See setTextColor()
  • Is it FONT or H?
  • DEPRECATED ?
    Note: Left justified is drawString().

drawRightString(STRING, uint32_t X0,uint32_t Y0, uint8_t FONT);

Draw string right justified to X0.

  • STRING >> variable (const String&) or "" (const char*) to draw.
  • X0,Y0 >> position
  • FONT >> Optional ?
    Ref : See setTextColor()
    Note: Left justified is drawString().
  • DEPRECATED ?

setCursor(uint16_t X0, uint Y0, uint8_t FONT);

Set the text cursor to position

  • X0,Y0 >> Point.
  • FONT >> Set the font at the same time. Note : FONT has to be preset.

getCursorX(void);

Get the text cursor X position.

  • Returns int16_t X.

getCursorY(void);

Get the text cursor Y position.

  • Returns int16_t Y.

setTextColor(uint16_t FOREGROUND, uint16_t BACKGROUND);

Sets the text colour to foreground and background is transparent unless set.

  • FOREGROUND >> Required colour number
  • BACKGROUND >> Optional colour number Note : Foreground colour maybe overridden by individual functions.

setTextSize(uint8_t M);

Allows use of multiple font sizes with out loading extra font sizes. ??

  • M >> Multiplier of font size.

SetTextWrap(bool X, bool Y);

Set text wrap at the end of line.

  • X >> Wrap at the end of line ( screen )??.
  • Y >> Wrap at the bottom of screen.

setTextDatum() KEYWORD2

getTextDatum() KEYWORD2

setTextPadding() KEYWORD2

getTextPadding() KEYWORD2

Print functions

print(TEXT,TYPE);

  • TEXT >> "", *pointer, NUM
  • TYPE >> CHR, HEX, DEC, OCT = Optional, DEFAULT CHR

println(TEXT,TYPE);

  • TEXT >> "", *pointer, NUM
  • TYPE >> CHR, HEX, DEC, OCT = Optional, DEFAULT CHR
  • print(); with the addition of lf & cr

Font functions

setFreeFont(FONT);

Set the GFX free font.

  • FONT >> uint8_t.
  • FONT >> const GFXfont.

setTextFont(uint8_t FONT);

Set the text font.

textWidth(STRING, uint8_t FONT);

Return string width in pixels in a given font. If FONT is not given, use current font. ??

  • STRING >> variable (const String&) or "" (const char*) to calculate.
  • FONT >> Optional. Use current font if not supplied.
  • Returns uint16_t Width.

fontHeight(FONT);

Return the height of a font.

  • FONT >> Optional. Use current font if not supplied.
  • Returns uint16_t Height.

fontLoaded(void);

Return value showing fonts loaded

  • Returns uint16_t FONTS.

SORT ME

Put function here if uncertain the position to be placed on page.