Determine the width of a character
-
How can I determine the width of a character from the freefonts? I tried: "M5. Lcd.width('W',myfont)
This reported that width is not known. -
I think there's a translation error here: I want to read the width of the characters. (Google translated :-))
I can determine the size of the characters. With FreeFonts, not all characters are the same width. An "i" is narrower than an "M".
Since I want to split my screen into two areas, the left part should not write in the right part. If I can read the width of the characters, I know when to start a new line. -
in the this lib file , you can find the str width return function:
https://github.com/m5stack/M5Stack/blob/master/src/utility/In_eSPI.h
int16_t textWidth(const char *string, uint8_t font), textWidth(const char *string), textWidth(const String& string, uint8_t font), textWidth(const String& string), fontHeight(int16_t font), fontHeight(void);
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login