dhrone / pydPiper

A general purpose program to display song metadata on LCD and OLED devices
MIT License
78 stars 36 forks source link

SSD1306 Font Problem #102

Closed rh1017 closed 3 years ago

rh1017 commented 4 years ago

Hi, I am using an SSD1306 128x64 OLED display with moOdeaudio 6.5.2, Pi3B+ with Raspian Buster. Text strings using both small and large fonts display apostrophe ' as ? question marks. All other characters display correctly. Is this a known issue and is there a fix? Thanks, Richard.

dhrone commented 4 years ago

Not that I am aware of. Can you let me know specifically what fonts (by filename) you are using that are displaying the apostrophe as a question mark? If you are using one of the pre-canned pageFiles, let me know which one and you can just let me know what fields are displaying the question marks. If you are using a modified pageFile, please provide it.

rh1017 commented 4 years ago

Thanks for your reply. The plot deepens....! I thought that a picture might have been of assist and much to my surprise (and potential embarrassment)... image

So the problem is probably not with pydPiper but something in the file metadata that tricks MPD or the way pydPiper parses the text? Here is the almost un-modified SSD-1306 page file:

pages_ssd1306.py.txt

I can live with the few tracks that do not display correctly but it would be nice to find a solution. If you have any further thoughts or things to try? Regards, Richard.

dhrone commented 4 years ago

Ok, I think I understand what the problem is. It appears that in some of the metadata for the songs you are playing, they are using the unicode value for 'right single quotation mark' (u+2019) instead of a simple apostrophe (u+0027). The Vintl01_10x16_fixed.fnt does not contained that character. There is a simple fix though. You can add another line to the font file that uses the same data as apostrophe. Try this file as a replacement for your Vintl01_10x16_fixed.fnt file and see if the problem goes away. Keep in mind there are other characters that could also trip you up like 'left single quotation mark'. Solving for these can be handled similarly or since you are using a graphical display (e.g. not a HD44780), you could use a truetype font that contains a broader symbol set. It would also be possible to add new symbols to the Vint01_10x16 but that is a more involved process.

Vintl01_10x16_fixed_test.fnt.txt

rh1017 commented 4 years ago

Unfortunately that did not work. However I edited the metadata for artist and track and simply replaced the meta apostrophe with the Windows apostrophe and both title and track display correctly in pydPiper with the packaged pages_ssd1306.py and font files. I'm not familiar with the workings of fonts and character mapping but for the relatively few (hopefully) files that display incorrectly, the metadata edit is an easy fix. Thanks very much for helping with this question and if there is anything else I can try I would still like to find out why. Regards, Richard.

dhrone commented 3 years ago

I'm going to close this since it is related to the font itself and not the system. Better font handling may be available in a future release.