Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: lykkedk on October 04, 2021, 02:35:25 AM
-
Hello here...
I succesfully created some luma.core, luma.oled + freind's .tcz's for using my SSD1322 256x64 oled.
I also compiled font-amatic-sc & font-fredoka-one and created .tcz's for them too.
Well i would like to use some other fonts like the truetype one's, but can't seem to find anything about installing such on piCore?
Alsa i can't figure out howto "see" which font's are availible on my Pi.
I use piCorePlayer 8, which is based on piCore 13, and so i have all the v13.tcz's avalible - nothing special about this.
The luma.core + luma.oled is a oled display driver with python, and a silly quistions are, if the font's must be located when installed in sitepackages where all the other python stuff are placed ? ::)
Jesper.
-
Hi lykkedk
... Alsa i can't figure out howto "see" which font's are availible on my Pi. ...
To find which extensions contain truetype fonts ....
From a GUI use the Provides function in the Apps utility and search for:
\.ttf
Or from the command line use the Provides function in the tce utility and search for:
\\.ttf
To search for font extensions, use the Tags/Keywords function in those utilities and search for:
font
Some of the results returned will be font related libraries or programs, so check the extensions .info and .list files
to make sure they contain what you are looking for.
-
Thank's Rich... Will look into this!
Btw: i use this mockup to test the oled for now.
I will use a line simulairto this to use some other font's :
from fonts.ttf import SomeFont-Foo
But nomatter what i try, i got error's about missing font.
The fonts :
from fonts.ttf import AmaticSC
from fonts.ttf import FredokaOne
Are working
import os
import time
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
from fonts.ttf import AmaticSC
from fonts.ttf import FredokaOne
from luma.core.interface.serial import spi
from luma.core.render import canvas
from luma.oled.device import ssd1322
import RPi.GPIO as GPIO
serial = spi(port=0, device=0, gpio_DC=24, gpio_RST=25)
device = ssd1322(serial)
font25 = ImageFont.truetype(FredokaOne, 25)
font16 = ImageFont.truetype(FredokaOne, 16)
oled_volume = int(55)
str_oled_volume = (str(oled_volume))
with canvas(device) as draw:
draw.text((0, 0), "Example Text", font=font16)
draw.text((20, 30), str_oled_volume, font=font16)
time.sleep(4)
Jesper.
-
Hi lykkedk
I'm pretty sure that's python, and I only know C.
This appears to be what you are using:
https://github.com/pimoroni/fonts-python
Maybe some of the test, setup, __init__ scripts can provide you some clue to getting your font recognized.
-
Yes... :)
Installing / creating .tcz and load them at site-packages is the way to go, when only needing a few different font's ...
Thanks man!
fontSSL = ImageFont.truetype(SourceSansPro, 16)
SSPBold12 = ImageFont.truetype('/usr/local/lib/python3.8/site-packages/font_source_sans_pro/files/SourceSansPro-Bold.ttf', 12)
SSPBoldIt12 = ImageFont.truetype('/usr/local/lib/python3.8/site-packages/font_source_sans_pro/files/SourceSansPro-BoldIt.ttf', 12)
SSPBold18 = ImageFont.truetype('/usr/local/lib/python3.8/site-packages/font_source_sans_pro/files/SourceSansPro-Bold.ttf', 18)
SSPBoldIt18 = ImageFont.truetype('/usr/local/lib/python3.8/site-packages/font_source_sans_pro/files/SourceSansPro-BoldIt.ttf', 18)
Jesper.
-
Hi lykkedk
... Thanks man! ...
??? I'm not sure what I did, but you are welcome.
-
??? I'm not sure what I did, but you are welcome
You made me realize that I needed Python fonts, not the system fonts.
Jesper.
-
Hi lykkedk
Well, glad I could help. :)