| TGX 1.0.5 A tiny 2D/3D graphics library optimized for 32 bits microcontrollers.

Loading...
Searching...
No Matches
Classes | Functions
Fonts.h File Reference

Define the GFXFont anf ILI9341_t3 font format if needed. More...

`#include <stdint.h>`
`#include "Misc.h"`
`#include "Vec2.h"`
`#include "Box2.h"`

Go to the source code of this file.

## Classes
struct | GFXfont
| GFXFont font format. More...
struct | ILI9341_t3_font_t
| ILI9341_t3 PJRC font format. More...

## Functions
int | tgx::fontHeight (const GFXfont &font)
| Query the height of a font. More...
int | tgx::fontHeight (const ILI9341_t3_font_t &font)
| Query the height of a font. More...
iBox2 | tgx::measureChar (char c, iVec2 pos, const GFXfont &font, Anchor anchor=DEFAULT_TEXT_ANCHOR, int *xadvance=nullptr)
| Compute the bounding box of a character. More...
iBox2 | tgx::measureChar (char c, iVec2 pos, const ILI9341_t3_font_t &font, Anchor anchor=DEFAULT_TEXT_ANCHOR, int *xadvance=nullptr)
| Compute the bounding box of a character. More...

## Detailed Description

Define the GFXFont anf ILI9341_t3 font format if needed.

Warning
  If used, the Adafruit and GFX library should be included before including this header !

## Function Documentation

## ◆ fontHeight() [1/2]

int tgx::fontHeight | ( | const GFXfont & | font | ) |

Query the height of a font.

overload for GFXfont.

Parameters

  font | The font.

Returns
  The number of vertical pixels between two lines of text with this font.

## ◆ fontHeight() [2/2]

int tgx::fontHeight | ( | const ILI9341_t3_font_t & | font | ) |

Query the height of a font.

overload for ILI9341_t3_font_t.

Parameters

  font | The font.

Returns
  The number of vertical pixels between two lines of text with this font.

## ◆ measureChar() [1/2]

iBox2 tgx::measureChar | ( | char | c,
|  | iVec2 | pos,
|  | const GFXfont & | font,
|  | Anchor | anchor = `DEFAULT_TEXT_ANCHOR`,
|  | int * | xadvance = `nullptr`
| ) |  |

Compute the bounding box of a character.

overload for GFXfont.

Parameters

  | c | The character.
  | pos | position of the anchor point.
  | font | The font to use.
  | anchor | location of the anchor with respect to the char bounding box. (by default, this is the BASELINE|LEFT).
  [in,out] | xadvance | If non-null, the number of pixel to advance horizontally after drawing the char is stored here.

Returns
  the bounding box of pixels occupied by char `c` when draw with `font` when its chosen `anchor` is at `pos`.

## ◆ measureChar() [2/2]

iBox2 tgx::measureChar | ( | char | c,
|  | iVec2 | pos,
|  | const ILI9341_t3_font_t & | font,
|  | Anchor | anchor = `DEFAULT_TEXT_ANCHOR`,
|  | int * | xadvance = `nullptr`
| ) |  |

Compute the bounding box of a character.

overload for ILI9341_t3_font_t.

Parameters

  | c | The character.
  | pos | position of the anchor point.
  | font | The font to use.
  | anchor | location of the anchor with respect to the char bounding box. (by default, this is the BASELINE|LEFT).
  [in,out] | xadvance | If non-null, the number of pixel to advance horizontally after drawing the char is stored here.

Returns
  the bounding box of pixels occupied by char `c` when draw with `font` when its chosen `anchor` is at `pos`.