Rendering fonts in Go

412 views
Skip to first unread message

Yuliana Zigangirova

unread,
Dec 20, 2023, 12:33:15 PM12/20/23
to golang-nuts
Hi everyone!
I am looking for a best way to render fonts like TTF and Type 1 in my Go programm.  I have looked at the Freetype port into Go, but it is incomplete (Type1 are not implemented) and also lacks some feature like setting text matrix (or at least I have not found how to do it).  I have also looked at different graphic libraries  like Gio, but am still not competely sure how fonts are rendered there.  Seems like they are using  github.com/srwiley/rasterx,  am I correct?  Is it a wrapper to Freetype or a completely undependent font renderer?  I am also not sure about the quality of  glyph rendering there, will it be good enough for printing? 
So I will be grateful for any comments about the package named above and also about other possible ways to render fonts in Go.  May be I am missing something obvious.
Thank you very much in advance,
Yuliana

Howard C. Shaw III

unread,
Dec 22, 2023, 5:10:13 PM12/22/23
to golang-nuts
I think Freetype may still be your best bet - but rather than the Freetype port, you would need to use a wrapper that calls the Freetype C library, such as https://github.com/danielgatis/go-freetype

Egon

unread,
Jan 3, 2024, 6:55:47 AM1/3/24
to golang-nuts
There's also https://github.com/go-text/typesetting and github.com/go-text/render.

But, I'm not sure whether it covers your needs.

Yuliana Zigangirova

unread,
Jan 11, 2024, 5:05:56 PM1/11/24
to golang-nuts
Thank you, I will have a look.  I have hoped on finding pure Go,
but may be it is unrealistic.

Brian Candler

unread,
Jan 12, 2024, 6:33:48 AM1/12/24
to golang-nuts

Jan Mercl

unread,
Jan 12, 2024, 1:04:46 PM1/12/24
to Brian Candler, golang-nuts
On Fri, Jan 12, 2024 at 12:34 PM 'Brian Candler' via golang-nuts
<golan...@googlegroups.com> wrote:

> At worst, it may possible to compile C into Go. It sounds mad, but I believe SQLite has been ported to pure Go this way.

Challenge accepted: https://pkg.go.dev/modernc.org/libfreetype
Reply all
Reply to author
Forward
0 new messages