rjkroege/edwood

bad height or ascent in font file

Closed this issue · 4 comments

+(1) pechkin ~ % PLAN9=/usr/lib/plan9 PATH=$PLAN9/bin:$PATH edwood -f /usr/share/fonts/TTF/DejaVuSans.ttf
imageinit: can't open default font /usr/share/fonts/TTF/DejaVuSans.ttf: bad height or ascent in font file
2020/06/07 17:17:15 can't open display: bad height or ascent in font file

Tried 4 more fonts with the exact same error - TerminusTTF, Input-Mono, Roboto-Mono and SF-Mono. Tried relative and absolute paths.

edwood starts fine if no font arg is given (using default Go font).

fhs commented

If you're use plan9port, you need to use fontsrv(4) for TTF fonts. It'll automatically get started if you provide the right path:

PLAN9=/usr/lib/plan9 PATH=$PLAN9/bin:$PATH edwood -f /mnt/font/DejaVuSans/16a/font

It's a different story if you build edwood with -tags 'duitdraw mux9p', in which case you can use the TTF font directly:

edwood -f /usr/share/fonts/TTF/DejaVuSans.ttf@16pt
fhs commented

The error is from libdraw. I guess we can trap it and provide a hint on how to resolve the issue for this common case. The error could also be due to a bad/corrupt font file, but that's unlikely.

@fhs ah right, I got my wires crossed with the readme example.

sorry for the noise.