FBInk: A small tool/library to print crap on your screen!
#1  NiLuJe 06-10-2018, 09:50 PM
The lack of a small utility to print messages and images on screen (àla eips on Kindles) has been bugging me (and others, hi @frostschutz! ) for *quite* a while... So, I finally caved, and spent a few days working on this...

So here comes FBInk.
Basically, you feed it a string & a position on screen (row/column), and it'll print it there. Voilà.
There's a few helper flags if you want automagic padding, centering, or both, and it should break long strings over multiple-lines automatically (albeit in the dumbest fashion possible, no hyphenation, that's way out of scope here).

It has zero dependency besides the libc, since it's basically drawing monospaced monochrome glyphs straight to the framebuffer.

It's available as a standalone utility, which includes some of eips's more obscure features (like the ability to trigger specific mxcfb refresh calls without touching the fb at all), and as a C library, which is how I'm using it in KFMon.

Bindings are also available in Go, LuaJIT & Python .

Since v1.2.0, it can also display images, in the most common range of formats, with or without transparency .

Since v1.8.0, thanks to @sherman, it can also render OpenType/TrueType fonts .

NOTE: Up to date binaries (as well as Python bindings) are also always available in KoboStuff.
[zip] (513.8 KB, 32 views)

#2  NiLuJe 06-10-2018, 09:51 PM
See the KFMon announcement for a few possible caveats in the beta releases.

Basically, I'm throwing this in the wild and asking people to try and break it, to see if I squished all the bugs .

It's currently somewhat verbose, because I suck at basic maths & geometry .

EDIT: Also, no multibyte support right now. I'm vaguely looking into it, but the locales look fairly broken on Kobo, so that's going to be tricky at best...

EDIT²: "fairly broken" was an understatement. Please fix your damn libc, Kobo.

EDIT³: Worked around that shitstorm in 0.9.5. No validation of any kind possible, but we now "speak" UTF-8.

#3  OfficerAction 06-11-2018, 06:50 AM
Thanks for sharing!
I'm sure it will come in handy at some point

#4  Python Master 06-13-2018, 10:45 AM
Works amazing, fun for drawing some ascii art. Tested on the Kobo Aura One and it works

#5  NiLuJe 06-13-2018, 12:58 PM
@Python Master: I've got UTF-8 handled, so the next version should give you even more possibilities . (There's a few box drawing characters, since the font is basically IBM's venerable VGA font).

With a bit of tinkering, one *might* also be able to use Unscii, since it ships an 8x8 version in Unifont's hex format, which I *think* basically matches the C structures I'm using.

EDIT: Yes, it does, it just needs some massaging to format it as an actual C array, but the actual data is in the same format .

EDIT²: Okay, make that "almost" the same format. I'm rendering glyphs mirrored on the vertical axis at the end of my experiment... (Or mirrored on the horizontal axis with a bit of tweaking)... Or I can do a 90° angle with a code tweak... .
Because of course I initially did my manual test on the single glyph 'A', which happens to be symmetrical... .

Maths is hard. >_<".

#6  NiLuJe 06-13-2018, 05:40 PM
Because that was bugging me, got the situation under control.

It's not particularly pretty, I'm not sure it's correct, and there's a (minor) code change that makes it incompatible with the default font, but, FOR SCIENCE!

unscii-fantasy .

EDIT: And a few of the other unscii variants, because I'm having fun, and that's an excuse to road test the conversion script .

EDIT²: Got the conversion issue fixed. No need for code tweaks anymore :}.
unscii-fantasy.png unscii-mcr.png unscii-thin.png 

#7  NiLuJe 06-13-2018, 06:01 PM
I'm having some massive Amiga feels, guys. Don't mind me.

#8  NiLuJe 06-13-2018, 07:10 PM
There, pushed a new build (0.9.5-28).

This one handles UTF-8 input, correctly honors LF characters (NOT the escape sequence, the actual 0x0A character), and a few minor bugfixes (mainly around padding, and passing multiple long string to the commandline utility).

The LF thing is mainly aimed at being able to tail logs at it and having them flood your screen ;D.

#9  cramoisi 06-14-2018, 03:27 AM
@NiLuJe : can I use it to print crap on KSM or KOReader screen ?

(love the font)

#10  NiLuJe 06-14-2018, 11:40 AM
@cramoisi: Generally, yes, with some caveats if the software rotation doesn't match the hardware rotation. (i.e., it'll be printing at a 90° angle in KOReader's landscape mode) .

I'd be glad to know how well that actually works, though ^^. And since you still have a 16bpp FW, if the colors are indeed inverted by default .

  Next »  Last »  (1/22)
Today's Posts | Search this Thread | Login | Register