wustho / epy

CLI Ebook (epub2, epub3, fb2, mobi) Reader
GNU General Public License v3.0
962 stars 52 forks source link

Text justification #34

Open aris-sk opened 2 years ago

aris-sk commented 2 years ago

First of all i wanna say that i m grateful for that amazing program. I love doing as much as possible in terminal. But is it possible to justify text? Is there any way to this? Thx in advance, keep up the good job!

wustho commented 2 years ago

Hello there, thanks, mate.

That's good question! Actually I've been considering text justification for so long. And I kinda thought it can be easily implemented using amazing https://github.com/willmcgugan/rich library. But the difficult part is adjusting search feature with justified text, although it is still manageable, I currently don't think it's worth the effort. Because what rich currently do is forcing the justification by stretching the space irregularly like this:

Lorem   ipsum   dolor   sit   amet, consectetur adipiscing elit.
Aenean venenatis a lectus in suscipit. Proin non felis pulvinar,
tristique  sapien  id,  viverra  ipsum.  Donec  nec dictum nisl,
id faucibus nulla.

What I actually want is text justification like this (look at the space and hyphen), like kindle does:

Lorem ipsum dolor sit amet, consectetur adipiscing el-
it. Aenean venenatis a lectus in suscipit. Proin nonse
felis pulvinar, tristique sapien id, viverra ipsum. D-
onec nec dictum nisl, id faucibus nulla.

With current rich library justification by stretching the spaces will create irregularity/inconsistency which will tire the reader's eyes for long reads. So, I don't think this will be implemented in short time, sorry. But, like you, I also would love this text justification.

wustho commented 1 year ago

@aris-sk Hey there been so long, but you can checkout this epy sister: https://github.com/wustho/baca It has justify text feature.