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

Java Pages Sometimes missing words #11

Open
PargonX opened this issue Mar 14, 2024 · 6 comments
Open

Java Pages Sometimes missing words #11

PargonX opened this issue Mar 14, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@PargonX
Copy link

PargonX commented Mar 14, 2024

The program generates the commands correctly, however, java doesnt display some words at the end of pages sometimes, though the same words that arent showing on java show up on bedrock

also if you check my profile i have forked it for 50 page limit so it works with bedrock (this took me a hour to find the simple line XD)

@TheWilley
Copy link
Owner

TheWilley commented Mar 24, 2024

I've tried inputting large amounts of text into the app with many different characters and from what I can gather it seems to work perfectly now. This could be because of a recent bug fix, but I'm not sure. Ideally #10 should be solved before any definite conclusions should be made, so 09cafdb will not be reversed yet. Additionally, #14 can be used as an alternative solution once solved, as users can choose if they want to "risk" word cutoff or not. For now tho, more manual testing may be the best bet.

@TheWilley TheWilley added the bug Something isn't working label Mar 24, 2024
@TheWilley
Copy link
Owner

This is still (kinda) a problem, even with the new dataset from fdf3085. All words now exists, but will not fill the entire page. For example, inserting lorem ipsum I've found that it cuts off exactly one word too early, and inserts it at the start of the next page, but only in some cases.

The word "varius" clearly fits on the first page... ...but wraps to the other page

@TheWilley
Copy link
Owner

I think I've figured some things out:

  1. The one pixel added between every character does not apply to the space for some reason
  2. The width may be larger than 114, possibly 122 according to the minecraft wiki

The first point explains why the space seems to be able to "not occupy space", it simply takes up less space, thus not causing a wrap.

A space of width 5 can be added... ...but a character of the same width cannot

The second point may explain why some words get cut off to early. Unless there is anything else I've been missing, these two issues should be the last part of the puzzle.

@TheWilley
Copy link
Owner

After further testing it seems like the 122 width limit is incorrect. In fact, the wiki used to say 114 pixels, but was updated to 122 pixels in an edit: https://minecraft.wiki/w/Book_and_Quill?diff=prev&oldid=2488727. The author does not provide an explanation for this change, the entire edit message being: "Updated line width.".

This can be proved with a simple test like this:
image

The "a" has a width of 5 pixels, and the "." has a width of 1 pixels. The spacing between each character is 1 pixel. We can calculate the amount of pixels on the first row as such: 5 pixels * 19 characters + 19 spacings = 114 pixels. The dot only takes up two pixels (its width + spacing) yet wraps to the the next line. Thus, it is impossible that the width limit is 122 pixels.

@TheWilley
Copy link
Owner

The pixel width seems to be generally debated within the wiki. Here's a timeline:

Date Event Message Revision Diff
11 April 2020 The pixel width is first added as 113 Specified width in pixels of each line in book link link
10 June 2021 The pixel width is changed from 113 to 57 the character and pixel limits where wrong for java, I went into the game and found the correct ones link link
20 May 2022 The pixel width is changed from 57 to 114 Books can have up to 114 pixels per line, rather than 57 as previously written. Also line breaks do not count as characters. I tested ingame on Java edition. link link
16 March 2024 The pixel widith is changed from 114 to 122 Updated line width link link

There is no question however that the pixel width is 114, and as such the wiki is incorrect.

@TheWilley
Copy link
Owner

Things seem to work now, as lorem ipsum is rendered correctly. I see no reason any other characters would be incorrectly handled either, as all character widths have been measured in the MGD project. We should resolve #10 before closing this issue however, just to be sure everything is fine. I'll continue working on some other issues in the meantime (which do not rely on this one).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants