Bodmer / TFT_HX8357

Arduino library for HX8357 TFT display
118 stars 52 forks source link

Stateless textWidth and fontHeight. How to get current font? #23

Closed matiasmorant closed 5 years ago

matiasmorant commented 6 years ago

Hi! Thanks for your work. Some feedback:

textWidth() and fontHeight() depending on the currently set textfont just bited me in the ass. I'm trying to find a workaround. For that, I think I would need: Get and save current font Set current font to whatever font you want to know the size of Call textWidth and fontHeight Restore saved font

But I'm stuck on getting current font because there is no getter and textfont member is protected. How do I do that?

I think it would be better for these two methods to be just pure functions. (As well as color565 and possibly others) What also bited me was that you can create more that one TFT instance (I accidentally created 2 dynamically). You might want to consider making it a namespace instead of a class (I wrapped a namespace around TFT)

All in all, it's been a pleasure. I would appreciate you telling me how to get textfont

Bodmer commented 5 years ago

Hi, Thanks for you feedback.

At them moment there is no function that returns the current font. This would be tricky for the Adafruit fonts and I do not have a solution other than to keep the current font stored within the sketch code.

Other than bug fixes this library will not be developed further as I have migrated projects to use the ESP32.