Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly deal with Furigana #360

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

BMagnu
Copy link

@BMagnu BMagnu commented Apr 17, 2024

Closes #283.

Properly handles <ruby> and underlying <rt> tags.
This is accomplished by putting parsed overset data into the rendering style of the main text.
When splitting the main text into individual boxes, ruby characters are distributed as well as possible.
The boxes being rendered can potentially expand in width if the overset text is wider as the main text.

Example:
ksnip_20240417-161255
Of which, for the first phase, the epub looked as follows:

<p> <ruby><rt>そら</rt></ruby><ruby><rt>あお</rt></ruby>くて、<ruby><rt>たい</rt><rt>よう</rt></ruby>がじりじりと<ruby><rt></rt></ruby>りつける。</p>

@baskerville
Copy link
Owner

Also, it would seem that you don't have to do the splitting, because it shouldn't occur. You just have to prevent the splitting of the base characters.

@BMagnu
Copy link
Author

BMagnu commented Apr 22, 2024

Yes, the ideal solution would be to push everything in the ruby block (which should be always the entirety of the InlineMaterial::Text) into a single ParagraphElement::Text. I wasn't entirely sure how the renderer deals with that though, in case that this element gets too wide for the remaining line, or in the worst case, wider than an entire line.
Is it sensible to have an if at the start of the InlineMaterial::Text handler, and say that if it has ruby, then just ignore everything and push the entirety of the text as a ParagraphElement::Text?

Edit: Testing it, this seems to work. If you agree that this is the way to do it, I'll push that change

Instead, always push inline-blocks with ruby as one paragraph box.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ruby/overset text
2 participants