Posted 12 July 2014 - 03:56 PM
Every so often someone requests a 'Font API' - the ability to write in any font. So I made this for all you silly people who think that using edit with Comic Sans is a good idea.
Example
The bitmap should be in 16 colour format (bit depth of 4). You can then run BitmapToFont.lua MyFont.bmp MyFont.ftf.
This can then be used:
Screenshots
Bugs, contributing, etc…
Its on GitHub so if you feel the urge to change something, send me a pull request and I'll merge it. If you find a bug please do report it there (or here, I'm not fussed)
Yes I know.
I realise that this is entirely impractical and silly, why else did you think I wrote it? You need about font size 12 for it to be recognisable as a particular font, and that means on a full sized monitor you have a whole 3 lines to write your wonderful content. I guess it can be used as a message board though.
Future plans:
I kinda want to implement non-monospaced fonts, but that would ruin my idea for being able to use the created object as a redirect target. Any ideas?
Download:
ImagesAPI My bitmap API is required to make BitmapToFont.lua work: pastebin get Y3JeZWzV ImagesAPI
FontAPI Obviously you need this! pastebin get ViDkRCyn FontAPI
BitmapToFont.lua If you need to convert (Requires ImagesAPI) pastebin get GTs8VQk9 BitmapToFont.lua
Example
Spoiler
You first need to create a font file. This should be a Bitmap (.bmp). I like to use this but it doens't matter how it looks like as long as the individual glyphs are on a black background.The bitmap should be in 16 colour format (bit depth of 4). You can then run BitmapToFont.lua MyFont.bmp MyFont.ftf.
This can then be used:
term.clear()
local Obj = FontAPI.CreateObject(FontAPI.LoadFont("ComicSans.ftf"))
local Old = term.current()
term.redirect(Obj)
print("We all love Comic Sans")
Screenshot
Spoiler
Bugs, contributing, etc…
Its on GitHub so if you feel the urge to change something, send me a pull request and I'll merge it. If you find a bug please do report it there (or here, I'm not fussed)
Yes I know.
I realise that this is entirely impractical and silly, why else did you think I wrote it? You need about font size 12 for it to be recognisable as a particular font, and that means on a full sized monitor you have a whole 3 lines to write your wonderful content. I guess it can be used as a message board though.
Future plans:
I kinda want to implement non-monospaced fonts, but that would ruin my idea for being able to use the created object as a redirect target. Any ideas?
Download:
ImagesAPI My bitmap API is required to make BitmapToFont.lua work: pastebin get Y3JeZWzV ImagesAPI
FontAPI Obviously you need this! pastebin get ViDkRCyn FontAPI
BitmapToFont.lua If you need to convert (Requires ImagesAPI) pastebin get GTs8VQk9 BitmapToFont.lua
Edited on 12 July 2014 - 02:45 PM