Skip to content

Also accept char* pointer for fonts #393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/OLEDDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,10 @@ void OLEDDisplay::setFont(const uint8_t *fontData) {
this->fontData = fontData;
}

void OLEDDisplay::setFont(const char *fontData) {
setFont(static_cast<const uint8_t*>(reinterpret_cast<const void*>(fontData)));
}

void OLEDDisplay::displayOn(void) {
sendCommand(DISPLAYON);
}
Expand Down
3 changes: 3 additions & 0 deletions src/OLEDDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ class OLEDDisplay : public Stream {
// ArialMT_Plain_10, ArialMT_Plain_16, ArialMT_Plain_24
void setFont(const uint8_t *fontData);

// Set the current font when supplied as a char* instead of a uint8_t*
void setFont(const char *fontData);

// Set the function that will convert utf-8 to font table index
void setFontTableLookupFunction(FontTableLookupFunction function);

Expand Down