06-10-2019, 11:54 AM | #122 |
BLAM!
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). |
Advert | |
|
06-10-2019, 04:31 PM | #123 | |
Zealot
Posts: 128
Karma: 842196
Join Date: Feb 2019
Device: none
|
Quote:
My logfile of 100k became like 40mb, its annoying if it happens but nothing critical. If you have a solution that would be great |
|
06-11-2019, 08:39 AM | #124 |
BLAM!
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 ). |
06-12-2019, 04:24 PM | #125 |
Linux User
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. ;-) |
Advert | |
|
06-12-2019, 05:43 PM | #126 | |
Guru
Posts: 856
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
|
Quote:
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...) |
|
06-12-2019, 05:59 PM | #127 |
Guru
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) |
06-13-2019, 03:18 AM | #128 |
BLAM!
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. |
06-13-2019, 11:15 AM | #129 | |
Zealot
Posts: 128
Karma: 842196
Join Date: Feb 2019
Device: none
|
Quote:
|
|
06-17-2019, 04:43 PM | #130 |
BLAM!
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. |
06-17-2019, 09:27 PM | #131 |
BLAM!
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. |
06-19-2019, 03:11 AM | #132 |
Linux User
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. :-)
|
06-19-2019, 11:14 AM | #133 |
Zealot
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 ? |
06-20-2019, 01:23 AM | #134 |
BLAM!
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?
|
06-20-2019, 03:11 PM | #135 |
Linux User
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! |
|
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 |