Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 06-10-2019, 09:29 AM   #121
BloodRagg
Zealot
BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.
 
BloodRagg's Avatar
 
Posts: 128
Karma: 842196
Join Date: Feb 2019
Device: none
Quote:
Originally Posted by NiLuJe View Post
Released v1.16.0!

Mostly minor tweaks here and there, and a few new features as discussed earlier .
I'm back : found that -q is not respected on error.
BloodRagg is offline   Reply With Quote
Old 06-10-2019, 11:54 AM   #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,478
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
@BloodRagg: Which error(s), specifically?

By design, it should only inhibit *non-critical* errors . (By non-critical I mean anything that doesn't lead to an early abort).
NiLuJe is offline   Reply With Quote
Advert
Old 06-10-2019, 04:31 PM   #123
BloodRagg
Zealot
BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.
 
BloodRagg's Avatar
 
Posts: 128
Karma: 842196
Join Date: Feb 2019
Device: none
Quote:
Originally Posted by NiLuJe View Post
@BloodRagg: Which error(s), specifically?

By design, it should only inhibit *non-critical* errors . (By non-critical I mean anything that doesn't lead to an early abort).
command line syntax errors , I have a number of while/for loops running in a script, they call fbink a lot But now and then some fall out of favor depending on the input stream its parsing and then all hell breaks loose. (given that your wonderful tool comes with a shitload of switches and accompanying texts).

My logfile of 100k became like 40mb, its annoying if it happens but nothing critical.
If you have a solution that would be great
BloodRagg is offline   Reply With Quote
Old 06-11-2019, 08:39 AM   #124
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,478
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
What kind of syntax error? The kind you could avoid by flagging the end of your own arguments with a "--" (this is getopt), or the kind where your only hope is to throw stdout & stderr to the void?

(Because yeah, syntax errors would fall into the "critical" category ).
NiLuJe is offline   Reply With Quote
Old 06-12-2019, 04:24 PM   #125
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
Is it possible for fbink --truetype to return an error when there was not enough space to render the text completely? Or for this info to be included in --coordinates?

What I'm actually trying to do is determine an optimal font size to render text to a given rectangle. But I can't do it reliably if fbink won't tell me whether the text fit or not.

It would also be interesting to get feedback on the number of times fbink decided to wrap.

Or maybe I'm going about UI design the wrong way... and I should just hardcode it. ;-)
frostschutz is offline   Reply With Quote
Advert
Old 06-12-2019, 05:43 PM   #126
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: 856
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Quote:
Originally Posted by frostschutz View Post
Is it possible for fbink --truetype to return an error when there was not enough space to render the text completely? Or for this info to be included in --coordinates?

What I'm actually trying to do is determine an optimal font size to render text to a given rectangle. But I can't do it reliably if fbink won't tell me whether the text fit or not.

It would also be interesting to get feedback on the number of times fbink decided to wrap.

Or maybe I'm going about UI design the wrong way... and I should just hardcode it. ;-)
It should be possible.

From memory, there's a measurement pass to test fit, and truncate if necessary. Just a matter of getting that information to the caller. Same with the number of lines.

(It's been a while since I implemented this, then NiLuJe has made changes to the code since, so I'm a bit fuzzy on exactly what's possible...)
sherman is online now   Reply With Quote
Old 06-12-2019, 05:59 PM   #127
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: 856
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
Just had a refresh look over the code. Definitely will be possible. Just a matter of figuring out an implementation. @NiLuJe would be best person to figure it out.

As an aside, Once I started using the OT capability, I've come to regret using margins to determine the printable area. In hindsight, an x,y,w,h system might have been better. (as seen by my arithmetic gymnastics here: https://github.com/shermp/Kobo-UNCaG...uprint/eink.go)
sherman is online now   Reply With Quote
Old 06-13-2019, 03:18 AM   #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,478
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
IIRC, it returns 0 as a top margin when the drawing area is full.
On the CLI, you can get that either as a status code or on stdout, via the linecode/linecount flags.

That's OTOH, so, err, take that with a grain of salt ;p.

That's not exactly what you want, though, because if it happens to fit perfectly without truncation, it can perfectly well return 0 too, it just means there's no room for another line, not necessarily that the last one was truncated...

@sherman : in this case, as that looks fairly specific to the OT codepath, maybe changing the return type to a Struct with everything you need would be less clunky than the "chuck it somewhere, quite possibly a global, and access it via an accessory function" approach taken by the last rect stuff...

Last edited by NiLuJe; 06-13-2019 at 03:23 AM.
NiLuJe is offline   Reply With Quote
Old 06-13-2019, 11:15 AM   #129
BloodRagg
Zealot
BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.
 
BloodRagg's Avatar
 
Posts: 128
Karma: 842196
Join Date: Feb 2019
Device: none
Quote:
Originally Posted by NiLuJe View Post
What kind of syntax error? The kind you could avoid by flagging the end of your own arguments with a "--" (this is getopt), or the kind where your only hope is to throw stdout & stderr to the void?

(Because yeah, syntax errors would fall into the "critical" category ).
When I run into it again, ill debug and post the used syntax. Thanks
BloodRagg is offline   Reply With Quote
Old 06-17-2019, 04:43 PM   #130
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,478
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
@BloodRagg: I went a wee bit overboard on diagnostic messages, so current master will be extra verbose in that regard .

That said, unless the flags themselves (or the values) are dynamic and possibly broken, most of those could be avoided by enforcing the end of option parsing with a double dash, i.e., fbink -x0 -y0 -- ${text} will ensure whatever's in $text will never go through getopt, and will be passed as-is to print .

Last edited by NiLuJe; 06-18-2019 at 01:45 AM.
NiLuJe is offline   Reply With Quote
Old 06-17-2019, 09:27 PM   #131
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,478
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
@frostschutz: Okay, added some various shenanigans, so -l, --linecount is now in an eval-friendly format instead when used with -t, --truetype, and it includes the amount of lines initially computed, the actual amount of lines rendering took, and whether that ended up truncating the string at one time or another.

You can also skip the rendering pass to make that cheaper, but this will *not* catch every possible truncation, especially with broken metrics.

c.f., the API docs for more details ;).

(For example, the same string, at the same size, can return next_top=0;computed_lines=10;rendered_lines=0;trun cated=0; for a compute only run, but next_top=0;computed_lines=10;rendered_lines=9;trun cated=1; for a full run, as truncation could only be detected at rendering time, because of broken font metrics.)

@sherman: I went with an extra optional struct pointer instead of changing the return type, as I figured this would be less annoying to wrap for FFI stuff, and less annoying to update for API users. And, incidentally, less annoying for the internal handling in fbink_printf ;).

Last edited by NiLuJe; 06-17-2019 at 09:29 PM.
NiLuJe is offline   Reply With Quote
Old 06-19-2019, 03:11 AM   #132
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
Thanks a lot, NiLuJe! I will test it and report back. :-)
frostschutz is offline   Reply With Quote
Old 06-19-2019, 11:14 AM   #133
BloodRagg
Zealot
BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.
 
BloodRagg's Avatar
 
Posts: 128
Karma: 842196
Join Date: Feb 2019
Device: none
If I print to a screen on a different Kobo can I assume it prints correctly ?
Does this mean I still gotta compensate for the input coordinates ?
BloodRagg is offline   Reply With Quote
Old 06-20-2019, 01:23 AM   #134
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,478
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
@BloodRagg: Not sure I follow, sorry . More details?
NiLuJe is offline   Reply With Quote
Old 06-20-2019, 03:11 PM   #135
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
@NiLuJe:

everything seems to work great so far (using --linecount --truetype and using that to search for best fit).

There seems to be a problem with starting / trailing newlines though. Well, this occured randomly during testing, I don't expect to be using trailing whitespace normally.

Starting newline (followed by a paragraph of lorem ipsum) causes failure:

Code:
[FBInk] Max allowed line width exceeded!
[FBInk] Curr LW: 1046   Max Allowed: 1044!
Failed to print that string!
Trailing newline causes empty square (as if missing character) to be drawn onto the screen.
frostschutz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Aura HD Small tool for filling book library in Kobo Aura Paxerus Kobo Developer's Corner 2 12-31-2013 07:05 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 08:54 PM.


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