Pixel operator fonts added and tested -> 2025-01-26 18:18:56

This commit is contained in:
pepev-nrt 2025-01-26 18:19:27 +01:00
parent dc3337d22b
commit c0ad5f0302
28 changed files with 232 additions and 6 deletions

View file

@ -13,7 +13,6 @@ import os
import sys
from display.display import DisplayHelper
import json
import logging
from PIL import Image,ImageDraw,ImageFont
@ -45,21 +44,26 @@ def main():
# Drawing on the image
font15 = ImageFont.truetype(os.path.join(assets, 'wavesharefont.ttc'), 15)
font24 = ImageFont.truetype(os.path.join(assets, 'wavesharefont.ttc'), 24)
font8 = ImageFont.truetype(os.path.join(os.path.join(assets, 'pixel_operator'), 'PixelOperator8.ttf'), 8)
font16 = ImageFont.truetype(os.path.join(os.path.join(assets, 'pixel_operator'), 'PixelOperator.ttf'), 16)
font16_bold = ImageFont.truetype(os.path.join(os.path.join(assets, 'pixel_operator'), 'PixelOperator-Bold.ttf'), 16)
#image = Image.open('assets/test4.bmp')
image = Image.new('1', (imageWidth, imageHeight), 255) # 255: clear the frame
draw = ImageDraw.Draw(image)
draw.text((0, 0), time, font = font15, fill = 0) # draw the current time in the top left corner
draw.text((0, 0), time, font = font16_bold, fill = 0) # draw the current time in the top left corner
draw.line([(0,20),(250,20)], fill = 0,width = 2)
draw.line([(125,20),(125,122)], fill = 0,width = 2)
draw.line([(0,16),(250,16)], fill = 0,width = 2)
draw.line([(125,16),(125,122)], fill = 0,width = 2)
cal_icon = Image.open(os.path.join(assets, "cal-icon.bmp"))
image.paste(cal_icon, (129,24))
draw.text((160, 26), 'Agenda', font = font15, fill = 0)
draw.text((160, 26), 'Agenda', font = font16_bold, fill = 0)
# draw.line([(0,50),(50,0)], fill = 0,width = 1)
# draw.chord((10, 60, 50, 100), 0, 360, fill = 0)