Hello folks,
I want to simulate an old school display with this font "DSEG": 7-segment and 14-segment free fonts.
I converted one of the ttf file with GitHub - lowfatcode/alright-fonts: The font format designed for embedded and low resource platforms. with default parameters:
./afinate --font /DSEG14ClassicMini-Regular.ttf myfont.af
All seems good and a “myfont.af” file was generated .
I made a small test py script to check the result but i can’t see anything.
I tried my script with the default “Roboto-Medium.af” and it works but nothing with neither the file i generated nor any example provided in the sample-font folder (alright-fonts/sample-fonts at main · lowfatcode/alright-fonts · GitHub)
Is there any specifc parameters to provide to the afinate tool to work with Pico Vector ?
Just in case you see something dumb in my code…
from picovector import ANTIALIAS_FAST, PicoVector, Polygon, Transform
from presto import Presto
#Font size
SMALL = 14
MEDIUM = 20
LARGE = 30
# Font type
#FONT = "myfont.af"
#FONT = "OpenSans-Medium.af"
FONT = "Roboto-Medium.af"
# Init screen
presto = Presto(ambient_light=False,full_res=True)
display = presto.display
WIDTH, HEIGHT = display.get_bounds()
CX,CY = WIDTH//2,HEIGHT//2
# Pico Vector
vector = PicoVector(display)
vector.set_antialiasing(ANTIALIAS_FAST)
# Define some colors
ON = display.create_pen(0, 0, 0)
OFF = display.create_pen(83, 94, 39)
BG_COLOR = display.create_pen(119, 137, 57)
vector.set_font(FONT, MEDIUM)
display.set_pen(OFF)
string = "Hello"
x, y, w, h = vector.measure_text(string,x=0,y=0,angle=None)
print(x,y,w,h)
vector.text(string, CX-int(w//2), CY)
# Update display
presto.update()
When “measuring” my text, i have this result for Roboto:
1.0 0.0 36.0 12.0
compared to
1.0 2.684783e+08 1.0 1.0
for the fonts generated with “afinate” which i guess prove the generation issue…
Thanks in advance for your feedbacks !