View Single Post
Old 11-02-2018, 04:39 PM   #44
sherman
Guru
sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.sherman ought to be getting tired of karma fortunes by now.
 
Posts: 865
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Hi

Just a couple of notes for those using the new OpenType/TrueType functionality, as there are some differences compared to the traditional FBInk printing methods.

Unicode linebreaking is used for wrapping lines. This means, that when printing OT/TT, the line will try to avoid breaking mid-word.

OT support uses margins, instead of cells, for positioning. That means you can set a printable area with top, bottom, left and right margins. The margins are specified in pixels, so at the moment API users may want to use the fbink_get_state() function to get the current screen resolution.

You can also align text WITHIN the printable area defined by the margins. This allows for both horizontal and vertical alignment. With the combination of alignment and margins, some creative positioning can be obtained...

Bold and Italics support is enabled via a simple markdown syntax (eg *italic*, **bold**, ***bold italic***). This is a very simplistic parser, so I would advise doing anything to complicated with it. EDIT: and it will abort if you don't have the appropriate bold and/or italic font loaded, so beware!

Other than that, have fun!

Huge thanks to NiLuJe for letting me play in the FBInk sandbox, and for graciously polishing my code.

(Also, if NiLuJe ever offers you a copy of Bookerly, run far far away. It is an evil version of the font, which made my code blow up...)

Last edited by sherman; 11-02-2018 at 04:42 PM.
sherman is offline   Reply With Quote