View Single Post
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,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
@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