ThingPulse / esp8266-weather-station-color

ESP8266 Weather Station in Color using ILI9341 TFT 240x320 display
https://thingpulse.com/product/esp8266-wifi-color-display-kit-2-4/
MIT License
574 stars 222 forks source link

Additional Unicode Blocks in Oleddisplay tool #38

Closed LaurisGale closed 5 years ago

LaurisGale commented 7 years ago

Would it be possible to have additional Unicode Blocks (e.g. Latin Extended-A/B, Arabic, Cyrillic, etc. subsets) in your oleddisplay.squix.ch tool? I understand that not all fonts have all subsets, but at least the ones that have (Roboto, opensans, Noto, etc have full subsets) would help to localize the weather tool. Thanks!

Luc3as commented 7 years ago

Hello, I just pushed updated code to "fool" international characters, https://github.com/squix78/esp8266-weather-station-color/pull/43

LaurisGale commented 7 years ago

That is great! I reused your translit code - works like a charm, but real characters would be even better :)

Luc3as commented 7 years ago

I definitelly agree, but making extended font is something way beyond my skill now and as the author is currently not having time I guess the only way was like that. By the way If you have some additional translation files with strings translated you can post it somewhere and I can add it to the pull request.

LaurisGale commented 7 years ago

Attached is the language_LT.h (Lithuanian translation).

Letter replacement string:

String Translit(String str) { String lat_up[] = {"Ą" , "Č" , "Ę" , "Ė" , "Į" , "Š" , "Ų" , "Ū" , "Ž"}; String lat_low[] = {"ą" , "č" , "ę" , "ė" , "į" , "š" , "ų" , "ū" , "ž"}; String trans_up[] = {"A" , "C" , "E" , "E" , "I" , "S" , "U" , "U" , "Z"}; String trans_low[] = {"a" , "c" , "e" , "e" , "i" , "s" , "u" , "u" , "z"}; for (int i = 0; i < 9 ; i++) { str.replace(lat_up[i],trans_up[i]); str.replace(lat_low[i],trans_low[i]); } return str; }

language_LT.h.txt

LaurisGale commented 7 years ago

There is also one thing that does not want to translit. The helper for forecast columns where weekdays are truncated to 3 chars and I cannot correctly transliterate it. Tried differently but here's the latest code:

// helper for the forecast columns void drawForecastDetail(uint16_t x, uint16_t y, uint8_t dayIndex) { gfx.setColor(MINI_YELLOW); gfx.setFont(Roboto_Medium_14); gfx.setTextAlignment(TEXT_ALIGN_CENTER); String day = Translit(forecasts[dayIndex].forecastTitle.substring(0, 3)); day.toUpperCase(); gfx.drawString(x + 25, y - 15, Translit(day));

Any thoughts?

Luc3as commented 7 years ago

I have similar problem with Thursday, I think it is because In special characters there are more bits used to store the letter and If it clip it at 3 first letters (or bits or something) it is moved beyond. Maybe using transliteration first and then clipping to 3 letters would help. Have to try

Dňa 21. 9. 2017 6:16 odpoludnia používateľ "LaurisGale" < notifications@github.com> napísal:

There is also one thing that does not want to translit. The helper for forecast columns where weekdays are truncated to 3 chars and I cannot correctly transliterate it. Tried differently but here's the latest code:

// helper for the forecast columns void drawForecastDetail(uint16_t x, uint16_t y, uint8_t dayIndex) { gfx.setColor(MINI_YELLOW); gfx.setFont(Roboto_Medium_14); gfx.setTextAlignment(TEXT_ALIGN_CENTER); String day = Translit(forecasts[dayIndex].forecastTitle.substring(0, 3)); day.toUpperCase(); gfx.drawString(x + 25, y - 15, Translit(day));

Any thoughts?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/squix78/esp8266-weather-station-color/issues/38#issuecomment-331207141, or mute the thread https://github.com/notifications/unsubscribe-auth/AGFfnLcjxwBoYhcnnChUXwh7tB9hwqbAks5skovzgaJpZM4PF7GN .

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.