Skip to content

Commit 59a5e05

Browse files
authored
Merge pull request #1776 from WardBrian/feature/1775-character-width-c-api
Add ability to query font character width to led-matrix-c
2 parents 8401dc2 + 5b9ee68 commit 59a5e05

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

include/led-matrix-c.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ int baseline_font(struct LedFont *font);
391391
// Read the height of a font
392392
int height_font(struct LedFont *font);
393393

394+
// Get the width of a specific codepoint in the given font
395+
int character_width_font(struct LedFont *font, uint32_t unicode_codepoint);
396+
394397
// Creates an outline font based on an existing font instance
395398
struct LedFont *create_outline_font(struct LedFont *font);
396399

lib/led-matrix-c.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ int height_font(struct LedFont * font) {
256256
return to_font(font)->height();
257257
}
258258

259+
int character_width_font(struct LedFont *font, uint32_t unicode_codepoint) {
260+
return to_font(font)->CharacterWidth(unicode_codepoint);
261+
}
262+
259263
struct LedFont *create_outline_font(struct LedFont * font) {
260264
rgb_matrix::Font* outlineFont = to_font(font)->CreateOutlineFont();
261265
return from_font(outlineFont);

0 commit comments

Comments
 (0)