View Single Post
Old 05-19-2012, 02:21 AM   #4
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Quote:
Originally Posted by JoppyFurr View Post
I'm not sure about the licensing / rules around other fonts, so decided that the safest thing to do was to just make up my own and give it the same license as the rest of the program. I used GIMP to draw the font, which supports saving to a .h file, along with .jpg / .png, etc. From that .h file, I removed all code related to looking up colour values, leaving only the array of bytes that make up the image. With only the array of bytes remaining, I re-formatted the whitespace so that the characters line up when viewed in a text editor, and added a few #defines about character size.

As far as using only one bit per byte, I wasn't thinking of that at the time. Perhpas I'll get around to improving that eventually, but now that I have text showing, the next things I'd like to work on are a keyboard, which I've made a start on, and then implementing the terminal itself. Once I have the basics working, then I'll go through and tidy it up, adding extra features as I do.

I have a working font now, so will probably leave that alone until later. But once I've got the terminal working, I may eventually add support for opening a font file and UTF-8.
Thanks for publishing the unfinished code, so we can learn from it. I do the same myself, as you can see from a progression of versions of many of my apps.

The rules that I follow are 1) make it work, 2) make it small, 3) make it fast. Step 2 is where you pack your font bits.

For free liberally licensed fonts, check out the Vera fonts. For vector fonts, check out the Hershey fonts. Also, for C programs, a great simple GUI method is IMGUI: http://sol.gfxile.net/imgui/
Or, if you want a more "professional" GUI that is C compatible, but event driven (to save battery), check out IUP from the lua creators.

Last edited by geekmaster; 05-19-2012 at 02:24 AM.
geekmaster is offline   Reply With Quote