[HN Gopher] Attempting to create an aesthetic global line breaki...
___________________________________________________________________
Attempting to create an aesthetic global line breaking algorithm
Author : ingve
Score : 25 points
Date : 2022-06-14 15:32 UTC (2 days ago)
(HTM) web link (nibblestew.blogspot.com)
(TXT) w3m dump (nibblestew.blogspot.com)
| a-dub wrote:
| > For each line measure the difference between the desired width
| and the actual width and square the value. Then add these values
| together.
|
| seems like you could add something to the loss function like sum
| (over hyphens) k*(1/1+d)^2 where d is the shortest vertical
| distance to the nearest next hyphen and k is a tunable.
| drfuchs wrote:
| Yikes; the author is simply wrong about TeX in the quote about
| squaring the width difference (there is some cubing going on,
| but of space stretch and shrink ratios of the natural space
| width specified per-font). He also seems to imply that TeX
| doesn't take care to try to avoid two hyphenated lines in a
| row, which is also not true ("doublehyphendemerits"). And,
| finally, he implies that TeX doesn't prune its search tree
| while looking for a global optimal set of line breaks, when of
| course it does. So, it's not clear what exactly his algorithmic
| improvement is supposed to be?
| [deleted]
| a-dub wrote:
| now that i read more carefully, looks like they're just
| making an attempt at a line breaking algorithm for their own
| edification and sharing the results.
|
| some parts of it make it sound like they're trying to beat
| tex, but on second read, nah. should probably be clearer (and
| maybe more correct) about paraphrasing how tex works though.
| bradleybuda wrote:
| In the GPT-3 era, why not allow the algorithm to change the
| author's wording (reordering or phrase rewrites) to more nicely
| distribute long and short words and give the line breaker more
| raw material to work with? /s
| ericwaller wrote:
| I like it! I've definitely found myself doing this while
| manually breaking lines in code comments
| pfortuny wrote:
| Notice that the author means "paragraph " when he or she says
| "chapter".
| anyfoo wrote:
| If true, I wonder if that mixup is somehow connected to the
| author's original language. (Probably Finnish, from the name?)
|
| In German, "chapter" has a very direct translation, "Kapitel"
| (English and German are extremely related after all), and
| though "paragraph" in its common text usage has its own word,
| "Absatz", the literal word "Paragraf" also exists and is used
| mostly when referring to laws.
|
| So I wonder whether Finnish, which I know next nothing about,
| is significantly different there.
| pfortuny wrote:
| I am sure that is an honest mistake, it is just confusing to
| the reader.
| anyfoo wrote:
| Oh yeah, I was just curious whether the author's native
| language (assuming it's not English) had interesting
| features that would lead to such a mistake.
| layer8 wrote:
| Apparently "kappale" means "paragraph" in Finnish, and
| "chapter" is a false friend.
| jwilk wrote:
| > he or she
|
| "A gathering of development thoughts of Jussi Pakkanen. Some of
| you may know _him_ as the creator of the Meson build system. "
| pfortuny wrote:
| My bad, sorry. Thanks for the pointer!
| throwaway81523 wrote:
| I would like to see evidence that their thing beats TeX in
| practice, before bothering to check into it further. They
| carefully avoided putting up a comparison pic. TeX occasionally
| gets stuck and requires an intervention but it is rare enough
| that it was never an issue for me.
| pierrebai wrote:
| Note that the author's algorithm allow lines wider than the
| target. (He does not hide this fact.) If you allowed the other
| algorithm this wiggle room (which basically is making the box
| wider) they'd also probably find better layout...
|
| For example the first place the algorithms diverges is exactly on
| such a wider line.
___________________________________________________________________
(page generated 2022-06-16 23:01 UTC)