antiprism / mpd_oled

MPD, Volumio, RuneAudio and Moode OLED status and spectrum display for Raspberry Pi (and similar)
Other
168 stars 45 forks source link

None-English characters display #9

Open starmood opened 6 years ago

starmood commented 6 years ago

This plugin is great, I already made it works.
But seems it does not support none-English song name display, like Chinese/Japanese. Is that possible to support it?

Thanks. Harry

antiprism commented 6 years ago

Hi Harry

Thanks for reporting this.

I currently use an ASCII bitmap font for text, but I found that it does not include a number of European characters/accents, and so I added a conversion utility which maps characters an approximate ASCII alternative. It does a reasonable job at supporting Latin based alphabets, but doesn't help with Chinese or Japanese.

Also, the font is 7x5 pixels, which allows a lot of information to be displayed on the small screen, but is too small for Chinese characters

https://chinese.stackexchange.com/questions/16669/lowest-pixel-resolution-needed-to-support-chinese

However, I would like the display to have better language support, and so I will look into what is involved in adding it in.

Adrian.

riskpw commented 5 years ago

Hi @antiprism

I think @starmood , me too. this plugin is great, none-English not support.

I made in hangul language through python. but, i want to your style ui on the OLED through C language.

So, i wait your source update. when is support it ?

antiprism commented 5 years ago

Hi riskpw

Thanks for your report.

The text field displayed by mpd_oled is not currently high enough to support Hangul. I plan to implement a configurable display layout, which will support a larger text field with enough room to display Hangul. When this is complete (I can't say how long it will take) I will return to looking into support for non-Latin scripts. I will post here with any updates.

Adrian.

MayanKoyote commented 5 years ago

Looks like Japanese is possible in 8x8 pixels as far as i understand it: http://ytkyk.info/blog/2016/06/19/raspberry-pi%E3%81%A7128x64%E3%81%AEoled%E3%81%AB%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%82%92%E8%A1%A8%E7%A4%BA%E7%BE%8E%E5%92%B2%E3%83%95%E3%82%A9%E3%83%B3%E3%83%88/ and font is here: http://www.geocities.jp/littlimi/misaki.htm license is free software, Unlimited permission is granted to use, copy, and distribute them, with or without modification, either commercially or noncommercially.

antiprism commented 5 years ago

Hi MayanKoyote

Thanks for the link to the small Japanese font. I was thinking of bundling the current ASCII font, and a multilingual font like the GNU Unifont, https://en.wikipedia.org/wiki/GNU_Unifont. However, the Unifont glyphs are large (16 pixels high) and it would make sense to support custom fonts for a text field.

Adrian.

riskpw commented 5 years ago

@MayanKoyote , @antiprism we are support koean font on volumio with oled.

Here is https://github.com/rasplay/RAS_HiPi_Project

But recent, your github information find through in the volumio forum.

Your program is used TTF font. So,oled print clear fast and not broken font.

antiprism commented 5 years ago

Hi riskpw

Thanks for the pointer. I found a reference for the font here: https://fonts.google.com/specimen/Nanum+Gothic

mpd_oled currently uses the Adafruit_GFX library for handling fonts. I believe that it only handles bitmapped fonts compiled into the progam https://learn.adafruit.com/adafruit-gfx-graphics-library/using-fonts

I will need to use a different library to support the use of custom font files specified at runtime.

Adrian.

misko903 commented 5 years ago

Hello antiprism, it works great, thank you, but as other wrote, no support for non-english characters. I am in Slovakia, we have those extra letters here: ľščťžýáíéúäô ... so Central European ISO-8859-2

is it hard to add this support? thank you, Michal

antiprism commented 5 years ago

Hi Michal

Thank you for reporting the issue.

mpd_oled should handle accented Latin characters by removing the accent. However, a quick test with your character string shows that this is not working here on Volumio. I have been able to track the issue down to changes I made to use the text values for title and artist supplied by Volumio, rather than MPD, when using Volumio. I didn't add character processing of the Volumio-supplied text values, and so accented characters appear as graphics characters. I will fix this.

Adrian.

misko903 commented 5 years ago

great, thank you :+1:

antiprism commented 5 years ago

I have just pushed a fix for mpd_oled not handling accented Latin characters on Volumio.

misko903 commented 5 years ago

ok

I have just pushed a fix for mpd_oled not handling accented Latin characters on Volumio.

Thank you, that was fast! A simple question from a beginner guy... How can I install it? repeating git pull in the right folder again?

antiprism commented 5 years ago

You should be able to run git pull, and then run

PLAYER=VOLUMIO make
sudo bash install.sh
misko903 commented 5 years ago

You should be able to run git pull, and then run

PLAYER=VOLUMIO make
sudo bash install.sh

works! thank you! 🥇

mecaz commented 5 years ago

Hello,

I installed mpd_oled on volumio and tested today. Everything ok but " ç ğ ı ö ş ü " theese characters dont display on lcd. Is there any fix for it? We are expecting to see it soon.

Regards

antiprism commented 5 years ago

Hi mecaz

For " ç ğ ı ö ş ü ", I get " c g ? o s u", with the accents correctly stripped, except that the "dotless i" doesn't seem to be supported by the conversion library. If this is what you are seeing then this is how these characters are currently handled. If you are seeing graphics characters instead, then check that you are using the latest mpd_oled source.

Adrian.

mecaz commented 5 years ago

Hello,

Thanks for other characters. but "ı" still displayed as "?" How can i make it shown as "i" İs there anyway to add it to conversation library

Regards mecaz

antiprism commented 5 years ago

Hi mecaz

The conversion library is libiconv. It is part of libc6, which is a system package. I checked the latest libiconv source and it includes a mapping from 'dotless i' to 'i'. In which case, some future Volumio update may fix the issue for you. I am not sure if the issue exists on Moode or Runeaudio, but a quick test of the conversion code on Ubuntu 18.04 shows that the 'dotless i' is correctly converted to 'i'.

Adrian.

virginiebjt commented 3 years ago

Hi, I'm having similar issues trying to display french characters (é à è ê). I'm not using Volumio, just mpd and an oled display. I'm not familiar with special characters, what could I do to fix this?

Thanks!

antiprism commented 3 years ago

Hi virginiebjt

Thank you for reporting this.

For the characters you mention the accents should automatically be stripped. I think it is possible that in some circumstances some values are not having the conversion applied. I will review the code, and then post again.

Adrian.

antiprism commented 3 years ago

Hi virginiebjt

I have just updated mpd_oled. Could you please try the updated version and see if it fixes the issue for you.

I found three issues that could cause accented characters to be displayed as '?'

  1. Not all values were converted in mpd_oled. I have fixed this.
  2. The en_US.UTF-8 locale is not available (which is now the case for me on Moode). I have switched this to C.UTF-8, which I hope will be available. If you run locale -a you can see the available locales. If these include en_US.UTF-8 then this was not the issue for you. If they don't include C.UTF-8 then please let me know what system you are on.
  3. Sometimes the metatags appear to have been transliterated in the media, as they contain '?' instead of an accented character. That is to say, the tag itself contains '?'. Check by running mpc status to see what MPD considers the tag to be. E.g.
    mpc clear
    mpc add http://sv3.vestaradio.com:8010/
    mpc play
    mpc status

    prints

    Fr?quence Terre: Stan Getz - O Grande Amor
    [playing] #1/1   0:11/0:00 (0%)

Adrian.

virginiebjt commented 3 years ago

Hi Adrian, thanks for your quick reply! After running mpc status, here's what I get:

pi@raspberrypi:~ $ mpc status Radio Tempête: Emily A. Sprague - Dock [playing] #1/1 0:18/0:00 (0%) volume:100% repeat: off random: off single: off consume: off

After updating mpd_oled, Tempête, originaly printed "Temp?te" is now displaying "Tempete". Not sure I can get the "ê", but the "e" does perfectly the job, thanks!

PS: locale -a prints the following: pi@raspberrypi:~ $ locale -a C C.UTF-8 fr_FR.utf8 POSIX

Thanks again and have a great day, Virginie

Edit: just read above that mpc handles the accents by removing them so I have no further question.

antiprism commented 3 years ago

Hi Virginie

Great! Thanks for letting me know this has fixed the issue.

Adrian.