fb: cfb: add API to set font kerning

Font kerning was used but it was not possible to change it.
Also, font_idx was set to zero twice in init.

Signed-off-by: Simon Frank <simon.frank@lohmega.com>
This commit is contained in:
Simon Frank 2023-02-28 10:00:51 +01:00 committed by Carles Cufí
parent 6d4266a451
commit b50838c66f
2 changed files with 17 additions and 1 deletions

View File

@ -153,6 +153,16 @@ int cfb_get_display_parameter(const struct device *dev,
*/
int cfb_framebuffer_set_font(const struct device *dev, uint8_t idx);
/**
* @brief Set font kerning (spacing between individual letters).
*
* @param dev Pointer to device structure for driver instance
* @param kerning Font kerning
*
* @return 0 on success, negative value otherwise
*/
int cfb_set_kerning(const struct device *dev, int8_t kerning);
/**
* @brief Get font size.
*

View File

@ -316,6 +316,13 @@ int cfb_get_font_size(const struct device *dev, uint8_t idx, uint8_t *width,
return 0;
}
int cfb_set_kerning(const struct device *dev, int8_t kerning)
{
char_fb.kerning = kerning;
return 0;
}
int cfb_get_numof_fonts(const struct device *dev)
{
const struct char_framebuffer *fb = &char_fb;
@ -343,7 +350,6 @@ int cfb_framebuffer_init(const struct device *dev)
fb->pixel_format = cfg.current_pixel_format;
fb->screen_info = cfg.screen_info;
fb->buf = NULL;
fb->font_idx = 0U;
fb->kerning = 0;
fb->inverted = false;