Skip to content

Commit b50838c

Browse files
Simon Frankcarlescufi
authored andcommitted
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 <[email protected]>
1 parent 6d4266a commit b50838c

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

include/zephyr/display/cfb.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,16 @@ int cfb_get_display_parameter(const struct device *dev,
153153
*/
154154
int cfb_framebuffer_set_font(const struct device *dev, uint8_t idx);
155155

156+
/**
157+
* @brief Set font kerning (spacing between individual letters).
158+
*
159+
* @param dev Pointer to device structure for driver instance
160+
* @param kerning Font kerning
161+
*
162+
* @return 0 on success, negative value otherwise
163+
*/
164+
int cfb_set_kerning(const struct device *dev, int8_t kerning);
165+
156166
/**
157167
* @brief Get font size.
158168
*

subsys/fb/cfb.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,13 @@ int cfb_get_font_size(const struct device *dev, uint8_t idx, uint8_t *width,
316316
return 0;
317317
}
318318

319+
int cfb_set_kerning(const struct device *dev, int8_t kerning)
320+
{
321+
char_fb.kerning = kerning;
322+
323+
return 0;
324+
}
325+
319326
int cfb_get_numof_fonts(const struct device *dev)
320327
{
321328
const struct char_framebuffer *fb = &char_fb;
@@ -343,7 +350,6 @@ int cfb_framebuffer_init(const struct device *dev)
343350
fb->pixel_format = cfg.current_pixel_format;
344351
fb->screen_info = cfg.screen_info;
345352
fb->buf = NULL;
346-
fb->font_idx = 0U;
347353
fb->kerning = 0;
348354
fb->inverted = false;
349355

0 commit comments

Comments
 (0)