koreader / crengine

This is the KOReader CREngine fork. It cross-pollinates with the official CoolReader repository at https://github.com/buggins/coolreader, in case you were looking for that one.
70 stars 45 forks source link

Use empty paragraphs to insert a new line #547

Closed dmalinovsky closed 9 months ago

dmalinovsky commented 9 months ago

Some FB2 books incorrectly use <p /> tags to add an empty new lines. Ideally, they should use <empty-line /> instead, but oh well.

KOReader doesn't display any empty vertical space, so there's no break at all.

I've tested this change on my own device, and it worked.

See the images for comparison. ![After](https://github.com/koreader/crengine/assets/483357/e0a35449-8309-416f-85d9-a69447212c76) ![Before](https://github.com/koreader/crengine/assets/483357/de57bc26-5cb5-475d-8c97-40671f8ece4b)

Closes koreader/koreader#11173.


This change is Reviewable

poire-z commented 9 months ago

Some FB2 books incorrectly use

I'm not sure it's a good idea to add p:empty in there, if it's only to fix stuff for some incorrect books, as it will slow down the first opening of ALL fb2 books :/

https://github.com/koreader/crengine/blob/55fa1043532cfae6e318c23ec9f70097cdc8611c/crengine/src/lvstsheet.cpp#L265-L277

dmalinovsky commented 9 months ago

Okay, maybe I'm jumped to the conclusions here. :) In practice, this is pretty common for a book to use paragraphs this way, unless it's professionally prepared.

I understand it will have some drawbacks, but current FB2 book display isn't correct.

dmalinovsky commented 9 months ago

I'm not sure it's a good idea to add p:empty in there, if it's only to fix stuff for some incorrect books, as it will slow down the first opening of ALL fb2 books :/

I've updated the patch to use min-height property instead. This works the same way, but should be faster.