Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 11-02-2018, 04:40 PM   #121
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: 875
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:43 PM.
sherman is offline   Reply With Quote
Old 11-02-2018, 05:16 PM   #122
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,506
Karma: 26047202
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Just my luck that the second font I'd try would blow up in fun and interesting ways .
NiLuJe is offline   Reply With Quote
Advert
Old 11-03-2018, 09:07 AM   #123
PoP
 curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 3,018
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
Yet another...

Click image for larger version

Name:	FUNtastic.png
Views:	250
Size:	12.2 KB
ID:	167414

Spoiler:
Code:
#!/bin/sh
#FUNtastic.sh:
# Play with OpenType fonts and transparencies to write an appreciation message

cd /mnt/us
#expects PATH=$PATH:.:..

#Fill a background of karma
fbink -c  -C gray8 -t regular=/mnt/us/pantspatrol.ttf,size=8 "K2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2uK2Uk2u"

#Write over "FUNtastic"
fbink -t regular=/mnt/us/poplarstd.otf,size=86 "FUN" -M --bgless
fbink -t regular=/mnt/us/pantspatrol.ttf,size=48,left=280 "tastic"  -M --bgless

#Add text 3D Shadow effect showing « yet another fbink evolution »
fbink -O -y 20 -S 1 -m -C gray5 -F block EVOLUTION
fbink -O -y 20 -S 1 -m          -F block evolution
                                                                                                            
#save for posting
screenshot
PoP is offline   Reply With Quote
Old 11-03-2018, 02:41 PM   #124
codex-hex
Member
codex-hex began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Aug 2018
Device: kobo aura edition 2
hi folks, could you post simple working OT/TT command?ı'm so idiot and cannot run the OT/TT examples on the fbink 1.8 manual page.
By the way sorry for my fcking freaking bad english.
codex-hex is offline   Reply With Quote
Old 11-03-2018, 02:59 PM   #125
PoP
 curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 3,018
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
@codex-hex see in the FUNtastic spoiler 2 posts above.
PoP is offline   Reply With Quote
Advert
Old 11-03-2018, 03:10 PM   #126
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,506
Karma: 26047202
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
The example is using custom fonts, with a fixed Kobo path. In hindsight, that was probably not a fantastic idea .

EDIT: On Kindle, using this instead should actually do something:

Code:
fbink -t regular=/usr/java/lib/fonts/Caecilia_LT_65_Medium.ttf,bold=/usr/java/lib/fonts/Caecilia_LT_75_Bold.ttf,size=24,top=100,bottom=500,left=25,right=50,format "Hello **world**!"

Last edited by NiLuJe; 11-03-2018 at 03:16 PM.
NiLuJe is offline   Reply With Quote
Old 11-03-2018, 03:16 PM   #127
PoP
 curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 3,018
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
What am I missing?

I am trying
Code:
fd=/mnt/us/fonts/
fbink -c -t regular="$fd"unscii-8.otf,size=60 -m -M "        "
#\uEC2B \uEC2D \uEC2E \uEC2F \uEC30 \uEC31 \uEC32 \uEC35 \uEC36
accessing the unscii-8.otf Private Area Click image for larger version

Name:	unscii-8.png
Views:	235
Size:	5.0 KB
ID:	167422

fbink prints the 9 characters:
Code:
[root@kindle us]# fd=/mnt/us/fonts/
[root@kindle us]# fbink -c -t regular="$fd"unscii-8.otf,size=60 -m -M "? ? ? ? ? ? ? ? ?"
[FBInk] Clock tick frequency appears to be 100 Hz
[FBInk] Screen density set to 300 dpi
[FBInk] Variable fb info: 1072x1448, 8bpp @ rotation: 3 (Counter Clockwise, 270°)
[FBInk] Fontsize set to 32x32 (IBM base glyph size: 8x8)
[FBInk] Line length: 33 cols, Page size: 45 rows
[FBInk] Vertical fit isn't perfect, shifting rows down by 4 pixels
[FBInk] Fixed fb info: ID is "mxc_epdc_fb", length of fb mem: 6782976 bytes & line length: 1088 bytes
[FBInk] Pen colors set to #000000 for the foreground and #FFFFFF for the background
Loading font '/mnt/us/fonts/unscii-8.otf' for the Regular style
[FBInk] Font '/mnt/us/fonts/unscii-8.otf' loaded
Printing string '        ' @ 60pt, honoring the following margins { top: 0px, bottom: 0px, left: 0px, right: 0px } (formatted: false, overlay: false, backgroundless: false, foregroundless: false, inverted: false, flashing: false, centered: true, halign: 0, halfway: true, valign: 0, clear screen: true)
[root@kindle us]#
But only the first 5 aliens show up:

Click image for larger version

Name:	screenshot_2018_11_03T14_52_55-0400.png
Views:	222
Size:	5.5 KB
ID:	167423
PoP is offline   Reply With Quote
Old 11-03-2018, 03:18 PM   #128
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,506
Karma: 26047202
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
@PoP: That's probably #21 .

Will be fixed in the next release .

(For now, you can add bogus padding characters at the end of your string to get stuff to show up).
NiLuJe is offline   Reply With Quote
Old 11-03-2018, 03:31 PM   #129
PoP
 curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 3,018
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
^ Yep
Click image for larger version

Name:	screenshot_2018_11_03T15_25_34-0400.png
Views:	217
Size:	13.2 KB
ID:	167424

Code:
fdsys=/usr/java/lib/fonts/
#Qapla'
fbink -c -t regular="$fdsys"code2000.ttf,size=60 -m -M "          "
screenshot
PoP is offline   Reply With Quote
Old 11-04-2018, 08:28 AM   #130
codex-hex
Member
codex-hex began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Aug 2018
Device: kobo aura edition 2
Please help me to show on my kobo
İ need simple universal command to show OT/TT fonts.
İ must know What i am missing.
Your funtastic script parts doesnt show anything on my screen and fbink doesnt give me any error message interestingly.
codex-hex is offline   Reply With Quote
Old 11-04-2018, 09:08 AM   #131
PoP
 curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 3,018
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
@codex-hex

The example you refer to reads
Code:
        fbink -t regular=/mnt/onboard/fonts/NotoSans-Regular.ttf,bold=/mnt/onboard/fonts/NotoSans-Bold.ttf,size=24,top=100,bottom=500,left=25,right=50,format "Hello **world**!"
                Will use NotoSans to print 'Hello world!' at 24pt in a display area starting from 100px down the top of the screen to 500px before the bottom of the screen,
                from 25px of the left edge of the screen until 50px before the right edge.
                Honoring the MarkDown syntax, 'Hello' will be printed with the Regular font style, while 'world' will use the Bold font style.
Meaning that you must have the NotoSans-Regular.ttf and NotoSans-Bold.ttf fonts in your /mnt/onboard/fonts/ directory.

Can you verify this on your device.

Otherwise, if the font files are located in another path, change the command to use that one.

Please post the session log if that still doesn't work.
PoP is offline   Reply With Quote
Old 11-04-2018, 09:46 AM   #132
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,506
Karma: 26047202
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
@codex-hex: what PoP said, plus your exact device and FW version, and the full fbink output (with the -v flag).

The paths on Kobo should be something like...
Code:
fbink -t regular=/usr/local/Trolltech/QtEmbedded-4.6.2-arm/lib/fonts/Caecilia.ttf,bold=/usr/local/Trolltech/QtEmbedded-4.6.2-arm/lib/fonts/Caecilia-Bold.ttf,size=24,top=100,bottom=500,left=25,right=50,format "Hello **world**!"
EDIT: Except, yeah, that segfaults .
EDIT²: Because they're encrypted or obfuscated or something. Yaaaaaay. -_-".

TL;DR: Can't use system fonts on Kobo!

Last edited by NiLuJe; 11-04-2018 at 01:44 PM.
NiLuJe is offline   Reply With Quote
Old 11-04-2018, 06:41 PM   #133
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,506
Karma: 26047202
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Released v1.8.1!

Mainly bugfixes, among which the UTF-8 issue discussed above .
The OT/TTF renderer now also honors AA when using bgless/fgless/overlay rendering mode (... even on 4bpp devices, which I hate with a renewed fiery passion. I nearly threw the K3 out the window ).

It also fixes a regression in the fixed-cell font rendering, which happened to choose a smaller scaling multiplier than it should have on devices with a non-HD screen...

Last edited by NiLuJe; 11-04-2018 at 06:45 PM.
NiLuJe is offline   Reply With Quote
Old 11-04-2018, 07:15 PM   #134
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: 875
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Quote:
Originally Posted by NiLuJe View Post
I nearly threw the K3 out the window ).
I'm sure it would have been no great loss if you had

*Runs and hides back in Kobo land*
sherman is offline   Reply With Quote
Old 11-04-2018, 09:05 PM   #135
PoP
 curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 3,018
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
Quote:
Originally Posted by NiLuJe View Post
Released v1.8.1!

Mainly bugfixes...
Indeed, no more padding spaces needed:

Remember?
Click image for larger version

Name:	SpaceInvaders.png
Views:	229
Size:	65.6 KB
ID:	167448

Now revived on my K3!
Click image for larger version

Name:	SpaceInvaders.sh.png
Views:	260
Size:	2.6 KB
ID:	167449

(Which *will* be a great loss when it dies )
Attached Files
File Type: zip 2018-11-04 SpaceInvaders.sh.zip (976 Bytes, 222 views)

Last edited by PoP; 11-04-2018 at 09:13 PM.
PoP is offline   Reply With Quote
Reply

Tags
eips, fbink


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
FBInk: A small tool/library to print crap on your screen! NiLuJe Kobo Developer's Corner 311 06-20-2025 01:19 PM
Small print Broadback Conversion 12 12-12-2011 02:31 PM
Small Tool to change book order (PRS-x50) goaspy Sony Reader 113 10-14-2011 03:28 PM
small print breezeman Introduce Yourself 13 07-03-2011 09:02 AM


All times are GMT -4. The time now is 12:29 AM.


MobileRead.com is a privately owned, operated and funded community.