orontee / taranis

Local weather data on your PocketBook e-book reader.
GNU General Public License v3.0
24 stars 0 forks source link

Adapt font size to screen dpi or size #89

Closed orontee closed 9 months ago

orontee commented 9 months ago

Context

Cf. #86

Analysis

Font size is currently hard-coded, see https://github.com/orontee/taranis/blob/main/src/fonts.h#L7.

It could be automatically selected, may be depending on display dpi? Or, since there is a limited number of possible screen sizes, there could be fixed font size for each screen size:

#define HWC_DISPLAY_6INCH (HWC_DISPLAY == 0)
#define HWC_DISPLAY_5INCH (HWC_DISPLAY == 1)
#define HWC_DISPLAY_8INCH (HWC_DISPLAY == 2)
#define HWC_DISPLAY_9INCH (HWC_DISPLAY == 3)
#define HWC_DISPLAY_6INCH_758 (HWC_DISPLAY == 4) // display 1024x758 6" HD
#define HWC_DISPLAY_8TRITON (HWC_DISPLAY == 5) // display 1800x800 8"
#define HWC_DISPLAY_8INCH_1200 (HWC_DISPLAY == 6) // display 1600x1200 8"
#define HWC_DISPLAY_4INCH_480_800 (HWC_DISPLAY == 8) // display 480x800 4.3"
#define HWC_DISPLAY_6INCH_1072_1448 (HWC_DISPLAY == 9) // display 1448x1072 6"

Even more simpler, there are "themes". Maybe using current theme fonts would solve our problem?

orontee commented 9 months ago

On my e-reader the default font from the theme is really tiny, thus I applied a scale factor arbitrarily computed from the screen DPI. On my device, this computation leads to slightly smaller font than what we used to have; It improves readability. I like it.

But it must be tested on other devices! The pre-release 1.8.0-rc2 is available for people to test.

Two other changes related to readability:

orontee commented 9 months ago

No news is good news!