brechtm / rinohtype

The Python document processor
http://www.mos6581.org/rinohtype
GNU Affero General Public License v3.0
500 stars 60 forks source link

Hyphenating a word across two pages concatenates the word part to the next one #419

Closed th0mr closed 1 year ago

th0mr commented 1 year ago

Is there an existing issue for this?

PDF produced by rinohtype

I'm getting some unusual PDF output when a word within a paragraph is split over two pages.

When the second half of the word is moved onto the next page, no space is put between that second half of the word and the next word in the paragraph.

image ^ the word absolutely is split in two, the second half of the word gets attached to the next word in the sentence "terribly"

For this to happen, the word has to be the final word of a line and it must be hyphenated onto the next page.

Is there some option I can enable or to avoid this, or is this a bug?

I've attempted looking at the code to propose a solution but I got a bit lost. The closest I got was around typeset_line in ParagraphBase (https://github.com/brechtm/rinohtype/blob/master/src/rinoh/paragraph.py#L843) This looked vaguely like relevant code for hyphenation across a page, but I'm not familiar enough with the code as a whole to know where to go from here.

Source files

Reproduction of the issue - document zip

The built PDF is in the "build" folder

The PDF was generated with: python -m sphinx -M rinoh ./source ./build

Versions

rinohtype 0.5.4 (2022-06-17)
Sphinx 7.1.2
Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
Windows-10-10.0.19045-SP0
brechtm commented 1 year ago

Thanks for the minimal project! You are in luck, since I recently fixed this issue. 😄 Please install the current development version, which should be as stable as the latest release.

th0mr commented 1 year ago

Brilliant! I've just updated to the latest version and its working.

I'll close this issue. Thanks for your hard work! 😄