Presto and Alright Fonts issue (PicoVector)

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 !

There have been other users here that are having problems converting fonts with the lowfatcode-utility. And when I read their code, I don’t think it is generic enough to support all kinds of fonts. They do some strange tests if a character is “printable”, but chars of special purpose fonts like the DSEG can fail the printable-test.

I would suggest that you open an issue in the github-repo and ask there for a solution. Presto can’t do much here, they just use the generated font-metrics.

1 Like

Try GitHub - pimoroni/picovector-fonts: A collection of fonts for use with the RP2040/RP2350 PicoVector library. ? I think you need to use a specific branch of alright-fonts for Presto

1 Like

Appreciate your support guys.

Hel, you are totally right. Using the version from Pimoroni works as exepected…

Thanks a lot for you time

1 Like