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

Some questions #30

Open
NicolasPineau opened this issue Dec 13, 2020 · 2 comments
Open

Some questions #30

NicolasPineau opened this issue Dec 13, 2020 · 2 comments

Comments

@NicolasPineau
Copy link

NicolasPineau commented Dec 13, 2020

Hi,

This is not an issue, I apologize if this is an abuse of issue tracker.
I'm currently using your work (great job !) in a little project of canvas text editor.
I've some questions, I keep trying to find answers from my own but in case you have some clues...

  • When the paragraph of your example has a line width of "80" it works if align is "center", but for getting breaks calculated when align is "left" I have to increase tolerance. Is this normal ?
  • Does it make sense to change the algorithm slightly so that it adds a break even if there is no penalty when the length of a box node is greater than the row in which it should be displayed ? (i.e. non hyphenable strings like "aaaaaaaaaaaaaa").

Thanks in advance,
Nicolas.

@NicolasPineau NicolasPineau changed the title Carriage return Line feed Dec 13, 2020
@NicolasPineau NicolasPineau changed the title Line feed Some questions Dec 18, 2020
@PhilterPaper
Copy link

Regarding the second issue, if an unbreakable "word" is longer than the entire line I think it would be reasonable to arbitrarily break it (to fit), otherwise it can never be fitted. It might first try condensing (squeezing) the text a reasonable amount to cram it into the line. I may have run into this problem with #31 when I tried very short line lengths -- typeset (actually, Perl Text::KnuthPlass, translated from typeset) quit very early and produced no output. Until I get the issue of line lengths resolved, I can't be sure of what's going on here.

@PhilterPaper
Copy link

PhilterPaper commented Jun 4, 2022

Regarding the first issue, notice in examples/article the "left" justified example is done with a higher tolerance (4) than the other four examples (tolerance of 3). I don't see any explanation for this, but the author apparently saw it.

Add: In the code, there is a "tolerance" setting that defaults to 30. I haven't looked at it in detail to see if it's the same tolerance used in the setting. It seems odd that 30 is quite a bit different than something in the 1..4 range. According to a comment in linebreak.js, tolerance seems to be the maximum acceptable ratio value for a trial layout to be further considered. Anything beyond that is discarded without further consideration. So in examples/article, there was apparently a ratio in excess of 3 (very, very loose) in one case, that the author wanted to be considered. The first try is with 1, and if that ratio is exceeded, try 2 and then 3 (and in one sample, 4).

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

No branches or pull requests

2 participants