ESPHome 2025.5.0
Loading...
Searching...
No Matches
esphome::font::Font Class Reference

#include <font.h>

Inheritance diagram for esphome::font::Font:
esphome::display::BaseFont

Public Member Functions

 Font (const GlyphData *data, int data_nr, int baseline, int height, uint8_t bpp=1)
 Construct the font with the given glyphs.
 
int match_next_glyph (const uint8_t *str, int *match_length)
 
void print (int x_start, int y_start, display::Display *display, Color color, const char *text, Color background) override
 
void measure (const char *str, int *width, int *x_offset, int *baseline, int *height) override
 
int get_baseline ()
 
int get_height ()
 
int get_bpp ()
 
const std::vector< Glyph, ExternalRAMAllocator< Glyph > > & get_glyphs () const
 
- Public Member Functions inherited from esphome::display::BaseFont

Protected Attributes

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

Detailed Description

Definition at line 45 of file font.h.

Constructor & Destructor Documentation

◆ Font()

esphome::font::Font::Font ( const GlyphData * data,
int data_nr,
int baseline,
int height,
uint8_t bpp = 1 )

Construct the font with the given glyphs.

Parameters
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 48 of file font.cpp.

Member Function Documentation

◆ get_baseline()

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

Definition at line 66 of file font.h.

◆ get_bpp()

int esphome::font::Font::get_bpp ( )
inline

Definition at line 68 of file font.h.

◆ get_glyphs()

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

Definition at line 70 of file font.h.

◆ get_height()

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

Definition at line 67 of file font.h.

◆ match_next_glyph()

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

Definition at line 54 of file font.cpp.

◆ measure()

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

Implements esphome::display::BaseFont.

Definition at line 71 of file font.cpp.

◆ print()

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

Implements esphome::display::BaseFont.

Definition at line 103 of file font.cpp.

Field Documentation

◆ baseline_

int esphome::font::Font::baseline_
protected

Definition at line 74 of file font.h.

◆ bpp_

uint8_t esphome::font::Font::bpp_
protected

Definition at line 76 of file font.h.

◆ glyphs_

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

Definition at line 73 of file font.h.

◆ height_

int esphome::font::Font::height_
protected

Definition at line 75 of file font.h.


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