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

Typesetting issues in sile-0.10.15.pdf #1174

Closed
zavislak opened this issue Jun 3, 2021 · 4 comments
Closed

Typesetting issues in sile-0.10.15.pdf #1174

zavislak opened this issue Jun 3, 2021 · 4 comments
Labels
bug Software bug issue documentation Documentation bug or improvement issue

Comments

@zavislak
Copy link
Contributor

zavislak commented Jun 3, 2021

I'm new to SILE so I can't debug, but I wanted to note the following oddities:

On page 4 the spacing between two paragraphs is insufficient, probably due to the placement of the figure:

image

On page 74 in the two column demo, the left column has a vertical offset that takes the text out of the frame:

image

@alerque
Copy link
Member

alerque commented Jun 16, 2021

Thanks for taking the time to report these @zavislak! (And welcome to SILE. Don't be afraid to post about any trouble you run into here even if it's a question about how to accomplish X and not strictly a bug report).

The first issue here is a duplicate of #394. Drop-caps (floats) and everything to do with them are a long-standing disaster situation. Lets leave that out of this issue and comment on the old tracking issue if needed.

The second issue I don't remember seeing reported before. Lets make this issue about tracking down that problem.

@Omikhleia
Copy link
Member

Omikhleia commented Jul 3, 2022

"A one-year old unaddressed issues...", thinks Omikhleia. "Hey, it's time to pinpoint it!" 🤣

Let's recap:
image

Problem (2), i.e. some small frame overflow at the bottom, is easy to understand - it's a mix of two things (fixed baseline skip from very early in sile.sil, aggravated by #1404). "I am not going to investigate it further."

But problem (1), i.e. some extra vertical space in the columns, is much more interesting.
If one looks closely, the issue is not only on the first column (where it is indeed very visible), but also on the second one. Erm. Wait! Looking even more closely, it's actually all the frames top which are affected, from a certain point in the document. Let's use our eyes:
image

We just need to track where this weird thing started occurring... Omikhleia puts on his spectacles... "Gotcha!".

And the culprit is.... That good old grid package, via its package documentation.

When grid typesetting is enabled (\grid[...]), the code overrides a few typesetter methods. When grid typesetting is disabled (\no-grid), it restores these typesetter methods. We should be safe and expect having returned to the previous state... But wait, there's one thing still active! That frame hook we registered: SILE.typesetter:registerNewFrameHook(startGridInFrame)... It is still doing its own things far after we left the grid...

A workaround is actually doable here:

local function startGridInFrame (typesetter)
  if not SILE.typesetter.state.grid then return end -- EEK! HACK! HOOK!
  local queue = typesetter.state.outputQueue
  ...

Problem solved. Er. Root cause identified, with a way to work around it, rather...

Still, there are other bits of code smell... E.g. SILE.defaultTypesetter:pushBack actually tests this grid state variable. Where is our neat separation of concern, if the standard default typesetter has a dependency on some intimate workings of a package, that also had its overridden methods?

Also, this may raise an interesting question for those interested in idempotent things (hi there, @alerque)... We have ways to register hooks, but not to unregister them...

@alerque
Copy link
Member

alerque commented Jul 4, 2022

Re-unregistering stuff. Yup the idempotent overhauls knew that was coming! Everything that is done should have an undo. The most obvious one being a bulk :unloadPackage() to go along with :loadPackage(). There are not so many documents in the wild where this becomes necessary, but while working on package management stuff for v0.14.0 I've been thinking the most useful case is going to be when two or more 3rd party packages want to muck with the same internals but conflict with each-other. A case in point is the color-fonts package and font-fallback package. I hacked together some tradoffs so you can switch back and forth, but all the refactoring I'm doing has an eventual unloader in mind.

The manual is a pretty good stress test for this in core packages, but we're had to hack around it being problematic in lots of places. We should be able to load a package, demo it's use, then move on with everything back the way it was. We're not there yet but much closer than 2 releases ago.

Omikhleia added a commit to Omikhleia/resilient-types that referenced this issue Jul 31, 2022
See sile-typesetter#1174 (comment)

Not a true fix perhaps (we'd need the ability to unregister hooks,
but at least make it ineffective when grid is off. Bonus, the SILE
manual gets some vertical spacing issue fixed.
alerque pushed a commit to Omikhleia/resilient-types that referenced this issue Aug 3, 2022
See sile-typesetter#1174 (comment)

Not a true fix perhaps (we'd need the ability to unregister hooks,
but at least make it ineffective when grid is off. Bonus, the SILE
manual gets some vertical spacing issue fixed.
@Omikhleia
Copy link
Member

For the sake of backlog cleaning, I think we could close this issue:

@alerque alerque closed this as completed Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Software bug issue documentation Documentation bug or improvement issue
Projects
None yet
Development

No branches or pull requests

3 participants