On Sat, May 14, 2016 at 09:03:44PM +0200, robin wrote: > So i took up the challenge of making a suckless font rendering library. > The problem: my lvl is barely above noob. > Maybe it will spark some motivation in someone more talented. > > https://github.com/byllgrim/tinyfont >
I have submitted a pull request with random fixes. How about dropping "copyright" field from the file format? It is completely useless, we don't have "copyright" fields in ELF, farbfeld and many other file formats. Copyright should be placed in separate .txt file, if not abolished. Some fonts are in public domain (such as "fixed" X11 font AFAIK) even. Need to state somewhere that it is a vector format, as bitmap fonts are already ok. dwm supported bitmap fonts only before it switched to Xft. Plan 9 font format is bitmap [1], it is used internally for all font rendering, and also it is the only font format supported in Go [2]. There is a FreeType port [3] for Plan 9 to prerender existing vector fonts, but it may be a bad idea to prerender fonts offline instead of caching them in memory due to file size. So tinyfont can complement subfont format in the field of vector fonts. Following subfont file format, but replacing bitmaps with vector glyphs may be a good direction. I wonder if ascent/descent can be removed completely. If you want to draw two words in different fonts, next to each other, they may have different height. In this case line height would be max(height1, height2), but you would need to adjust Y coordinate so baselines of fonts match. If you only know the height, you don't know where baseline is, so you can't adjust their baselines to match. [1] http://plan9.bell-labs.com/magic/man2html/6/font [2] https://godoc.org/golang.org/x/image/font/plan9font [3] http://mirtchovski.com/p9/freetype/