dhrone / pydPiper

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

extra language library library pack #67

Open lianli34312 opened 5 years ago

lianli34312 commented 5 years ago

I am currently using 0.96" OLED for Moode. But it shows "???" when dealing with japanese/chinese songs. It there any solutions to add extra language library library pack?

dhrone commented 5 years ago

Yes. Just use a Truetype font that contains the glyphs you want to use. Those are specific in the pages file within the TRUETYPE_FONTS section.

lianli34312 commented 5 years ago

Yes. Just use a Truetype font that contains the glyphs you want to use. Those are specific in the pages file within the TRUETYPE_FONTS section.

So I download a font format in .ttf format, how can I upload to pydPiper? After I change the TRUETYPE_FONTS, What I do is just simply reboot and the font will work or I need any extra compile for pydPiper?

Thanks !

dhrone commented 5 years ago

Do you mean upload to the RaspberryPi that you are running pydPiper on or where do you need to place the file within the file system?

If the later, it is distribution dependent. However, you can always specify the complete path and place the file anywhere you want.

Example:

(within pages file)

TRUETYPE_FONTS = { 'DejaVuSans28': { 'file':'/home/pydPiper/fonts/DejaVuSans.ttf', 'size':28 } }

lianli34312 commented 5 years ago

FONTS = { 'small': { 'default':True, 'file':'latin1_5x8.fnt','size':(10,16) },

'large': { 'file':'BigFont_10x16.fnt', 'size':(20,30) },

'large': { 'file':'Vintl01_10x16.fnt', 'size':(20,30) },
'tiny': { 'file':'upperasciiwide_3x5_fixed.fnt', 'size':(5,5) },

}

TRUETYPE_FONTS = { 'iming28': { 'file':'/home/pi/pydPiper/ttf/iming.ttf', 'size':28 } }

Still didn't work. Do I need to change the code inside FONTS also?

dhrone commented 5 years ago

No. Truetype fonts are only specified within the TRUETYPE_FONTS section of the pages file. You do need to make sure that you are specifying the fonts you define within the TRUETYPE_FONTS section within the widgets section as well...

TRUETYPE_FONTS = {
  'ttsmall': { 'file':'/home/pi/pydPiper/ttf/iming.ttf', 'size':8 }
  'ttlarge': { 'file':'/home/pi/pydPiper/ttf/iming.ttf', 'size':12 }
}

WIDGETS {
    'artist': { 'type':'ttext', 'format':'{0}', 'variables':['artist'], 'font':'ttlarge','varwidth':True,'effect':('scroll','left',1,1,20,'onloop',3,125)},
    'title': { 'type':'ttext', 'format':'{0}', 'variables':['title'], 'font':'ttsmall','varwidth':True,'effect':('scroll','left',1,1,20,'onloop',3,125)},
}

Notice that the type for the widgets that are using the truetype font are ttext, not text which is used for the low resolution fonts necessary for typical LCD displays.