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

Proposal: Change default leading algorithm #1118

Open
simoncozens opened this issue Jan 4, 2021 · 14 comments
Open

Proposal: Change default leading algorithm #1118

simoncozens opened this issue Jan 4, 2021 · 14 comments
Assignees
Labels
enhancement Software improvement or feature request todo
Milestone

Comments

@simoncozens
Copy link
Member

SILE currently uses the TeX leading algorithm (baselineskip/lineskip). Literally the first thing I do when starting a SILE document is pull in the linespacing package and change it to fixed baseline distance. I'm sure that TeX users will prefer the TeX system rather than the system used by literally every other typesetting package, but I wonder if it's time to prioritise getting-things-done over TeX compatibility.

@alerque
Copy link
Member

alerque commented Jan 7, 2021

Ya I think I'm on board with this. Let's think about how to do it gently though because it will be a huge reflow / breaking change for most documents.

I think starting with a warning whenever the TeX leading algorithm is used would be the right place to start, combined with a notice in the release notes. Once that's had some time to percolate and active users have had some lead time (pun intended) to adjust we can switch the default and include a warning the other direction for all cases where the default is used (i.e. don't warn when the document loads and sets the leading, but only warn when the bare SILE default is unchanged) so that people that missed it realize something changed behind their backs. A later release cycle could completely remove the warnings.

@alerque alerque added the todo label Jan 7, 2021
@alerque alerque self-assigned this Jan 7, 2021
@alerque alerque added this to the v0.10.x milestone Jan 7, 2021
@OlivierNicole
Copy link
Member

Reading this thread, I was curious to learn what TeX’s behaviour was, but it’s the only one not documented in SILE’s manual.

@alerque
Copy link
Member

alerque commented Jan 8, 2021

It's hard enough to keep up with documenting SILE, if documenting how TeX works were to be part of our goals we'd never come up for air. We can probably summarize...

Maybe start here for a rough outline of factors. At the end of the day it's a bit of a fudge and a guess based on the current font with compensations for what happened in the two lines being computed. Descenders in the first line and ascenders in the second line cause compensations in the leading meaning the distance might change from line to line.

@alerque alerque added the documentation Documentation bug or improvement issue label Jan 8, 2021
@simoncozens
Copy link
Member Author

It’s documented here:

\subsection{Line spacing settings}

@OlivierNicole
Copy link
Member

OlivierNicole commented Jan 8, 2021

Sorry, I didn’t mean to sound like saying you should document it. Thanks for the pointer!

Edit: @simoncozens hadn’t spotted that, very nice, thank you.

@alerque
Copy link
Member

alerque commented Sep 29, 2021

When implementing this, cf. comments here about the bs unit and making it useful when other linespacing mechanisms are loaded. At the very least adding an implementation for whatever linespace method we use as default to the dropcaps package will be required here.

@Omikhleia
Copy link
Member

I'll be honest (seeing this is re-prioritized again, now to 0.13) - I don't think this would be a good move yet.

@alerque
Copy link
Member

alerque commented Apr 22, 2022

Well it hasn't landed yet, so the timing is clearly up in the air. I'd be interested in hearing any rational for why to delay / when would be a good time. But also landing this will require extra careful thought to a deprecation warning and probably shimming first and changing the default later.

@Omikhleia
Copy link
Member

Omikhleia commented Apr 22, 2022

I'd be interested in hearing any rational for why to delay / when would be a good time

First, it doesn't fix anything wrong or broken, per se, and is a matter of preference.

A fixed baselineskip (in a broad sense) is even somewhat achievable with the TeX algorithm, just removing elasticity on document.baselineskip and killing document.lineskip. On a "real" text (with vertical skips, plenty of footnotes, PNG and SVG images, etc.) one doesn't get a very nice output when killing all elasticity there, but it's still decent most of the time (when one is lucky not to meet other issues and oddities... So I wouldn't even really recommend doing it).

On the same real text, none of the "linespacing" package alternative method lives up to the expectation. They all have impractical defaults and all fail sooner or later at some point. I gave up trying to tune them. But we cannot deprecate something without a working solution in mind, and they are far from being one in the current state of art. A lot of work would be required there...

I could return the question: what would be the reason to think this absolutely is something to prioritize?

@alerque alerque modified the milestones: v0.13.0, v0.14.0 May 21, 2022
@alerque alerque modified the milestones: v0.14.0, v0.15.0 Jun 29, 2022
@alerque alerque removed this from the v0.15.0 milestone Nov 29, 2022
@alerque alerque added this to the v0.x.0 milestone Nov 29, 2022
@raphCode
Copy link
Contributor

raphCode commented Dec 6, 2022

TeX also has the quirk that the linespacing is calculated at the moment when \par is encountered. With the default baselineskip of 1.2em this means that changing the font size within or before ending a paragraph creates unexpected results:
https://tex.stackexchange.com/a/444494

This can be replicated in sile:

\begin{document}
\use[module=packages.lorem]
% \use[module=packages.linespacing]
% \set[parameter=linespacing.method, value=fixed]
\font[size=30]
abc
\font[size=10]{\lorem}
\end{document}

Here, no \par happens inside the font size 10 block, so the algorithm assumes font size 30 for all lines and spreads them apart too much:
image

This even happens with the linespacing package in fixed mode.
I know that the fit-font or fit-glyph methods perform better, but I think it is not possible to specify the spacing in relation of the baselines with that?

Maybe the fixed linespacing can be enhanced to produce the expected result in cases like this too? Except I am missing some disadvantages or breakages.

In any case, if the default leading algorithm is changed, I would propose that it can handle cases like this too.

@Omikhleia Omikhleia added enhancement Software improvement or feature request and removed documentation Documentation bug or improvement issue labels Mar 26, 2023
@Omikhleia
Copy link
Member

@raphCode Interesting comment!

Swapping labels (it's not only documentation-related, and however addressed at one point, there are interesting topics to discuss and implement.)

@Omikhleia
Copy link
Member

On the same real text, none of the "linespacing" package alternative method lives up to the expectation. They all have impractical defaults and all fail sooner or later at some point.

Actually known issues: #823, #882 ...

@alerque alerque modified the milestones: v0.x.0, v0.15.0 Dec 13, 2023
@alerque
Copy link
Member

alerque commented Dec 13, 2023

I just re-tarteged this at v0.15.0. We're set to break EVERYTHING there, including the default size of spaces (#1371) and indentation (#1722) which is going to reflow everyone's documents if they don't override the settings.

I'm not saying for sure we will change this, but now is a great time to give this a good think and if we do change it doing it when people will have to adjust their documents for basic metrics anyway seems like a better time than any future releases.

@alerque
Copy link
Member

alerque commented Jun 3, 2024

Just a side note, Typst is having some trouble with picking a default leading algorithm too:

typst/typst#4224

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Software improvement or feature request todo
Projects
None yet
Development

No branches or pull requests

5 participants