ESPHome  2024.2.1
Public Member Functions | Protected Attributes
esphome::font::Font Class Reference

#include <font.h>

Inheritance diagram for esphome::font::Font:

Public Member Functions

 Font (const GlyphData *data, int data_nr, int baseline, int height)
 Construct the font with the given glyphs. More...
int match_next_glyph (const char *str, int *match_length)
void print (int x_start, int y_start, display::Display *display, Color color, const char *text) override
void measure (const char *str, int *width, int *x_offset, int *baseline, int *height) override
int get_baseline ()
int get_height ()
const std::vector< Glyph, ExternalRAMAllocator< Glyph > > & get_glyphs () const

Protected Attributes

std::vector< Glyph, ExternalRAMAllocator< Glyph > > glyphs_
int baseline_
int height_

Detailed Description

Definition at line 41 of file font.h.

Constructor & Destructor Documentation

◆ Font()

esphome::font::Font::Font ( const GlyphData data,
int  data_nr,
int  baseline,
int  height 

Construct the font with the given glyphs.

glyphsA vector of glyphs, must be sorted lexicographically.
baselineThe y-offset from the top of the text to the baseline.
bottomThe y-offset from the top of the text to the bottom (i.e. height).

Definition at line 68 of file font.cpp.

Member Function Documentation

◆ get_baseline()

int esphome::font::Font::get_baseline ( )

Definition at line 55 of file font.h.

◆ get_glyphs()

const std::vector<Glyph, ExternalRAMAllocator<Glyph> >& esphome::font::Font::get_glyphs ( ) const

Definition at line 58 of file font.h.

◆ get_height()

int esphome::font::Font::get_height ( )

Definition at line 56 of file font.h.

◆ match_next_glyph()

int esphome::font::Font::match_next_glyph ( const char *  str,
int *  match_length 

Definition at line 73 of file font.cpp.

◆ measure()

void esphome::font::Font::measure ( const char *  str,
int *  width,
int *  x_offset,
int *  baseline,
int *  height 

Implements esphome::display::BaseFont.

Definition at line 89 of file font.cpp.

◆ print()

void esphome::font::Font::print ( int  x_start,
int  y_start,
display::Display display,
Color  color,
const char *  text 

Implements esphome::display::BaseFont.

Definition at line 121 of file font.cpp.

Field Documentation

◆ baseline_

int esphome::font::Font::baseline_

Definition at line 62 of file font.h.

◆ glyphs_

std::vector<Glyph, ExternalRAMAllocator<Glyph> > esphome::font::Font::glyphs_

Definition at line 61 of file font.h.

◆ height_

int esphome::font::Font::height_

Definition at line 63 of file font.h.

The documentation for this class was generated from the following files: