sile-typesetter / sile

The SILE Typesetter — Simon’s Improved Layout Engine
https://sile-typesetter.org
MIT License
1.62k stars 97 forks source link

feat: option to make folio on left if even and on right if odd #1952

Open jodros opened 6 months ago

jodros commented 6 months ago

There's another type of folio mirroring that isn't being covered here.

изображение

What if the user make a folio this way, and instead of just switch from left to right, since in this case the mirroring would be handled by mirrorMaster(), the folio.mirror could align to the top or to the bottom according to given parameters...

alerque commented 6 months ago

I think we've opened a can of worms here (in a good way). We have a frame property for direction already, but TTB/BTT/LTR/RTL all have to do with writing system orientations. We also have those things in relation to the typesetter itself and font shaping.

We also have typesetter features for handling alignment (ragged, vfill, hfill, etc). The missing piece os some hint in frame properties about alignment that can be (optionally) used by the typesetter to align things. These hints could be used to set various properties to fulfill the goals of the layout without baking the bits into the content. In other words in place of having to add various layout artifacts to the content (thing prefixing some content with a \vfill to get a vertically centered block) a layout could be designed with frame alignment properties:

With a special caveat that the values would be reversed by TTB/RTL frame types, these values attached to the frame could be referenced in, for example, the enter-frame and leave-frame hooks to add appropriate spaces and the typesetter to pick starting margins.

Then when we mirror frames, the properties can be reversed and all the layout will adjust. We might also need a boolean property for whether to mirror the alignment properties of a frame or not (for example the main content frame would probably not be mirrored while the folio frame or running headers might be mirrored by default).

Does this sound sane to anyone else?

Sorry if this is pushing a simple PR into "fix the world" territory, but I think it may be worth fixing this for real instead of just barely getting by for some select scenarios.

jodros commented 6 months ago

Indeed, there are more things to be done here than I thought when created the PR so we must keep discussing this point to have a full solution, maybe I should've created a discussion instead of a PR first.

@alerque By the way I'd like to know what you think about the other proposals I wrote there recently, mostly that about frame declaration, which I already have a PR ready to be made...