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

feat(packages): New scalebox package for arbitrary box re-scaling #1710

Merged
merged 1 commit into from
Mar 23, 2023

Conversation

Omikhleia
Copy link
Member

@Omikhleia Omikhleia commented Feb 4, 2023

Closes #1178

EDIT: Also Closes #1035 (see comments below)

Box re-scaling via PDF transformation matrix:

\scalebox[xratio=<number>, yratio=<number>]{<content>}

Rationale

Both @ctrlcctrlv and @alerque in the above-mentioned issue said it should be proposed to the core distribution... So here it is, basic logic extracted from textsubsuper.sile and re-vamped as as standalone package.

Caveats

  • It's only tested (see below) in LTR writing direction: Checking RTL and vertical writing directions is left as an exercise to readers who know how to use these.
  • It's using the "hbox stealing trick": When/if Support migrating content in hbox building logic #1702 makes it, it is left as an exercise to adapt the code so that migrating contents are honored.
  • It is also left as an exercise where to include the package documentation in the manual.

image

The first series of lines just demonstrate the basic feature. The second series ensures line stretching/shrinking is correctly applied. The very last line is just for the show.

Example code attached as .txt so it can be uploaded here:
feat-scalebox.txt

@Omikhleia
Copy link
Member Author

Omikhleia commented Feb 4, 2023

Oops wrong file on first push... fixed and rebased. Sorry about it.

(But in case you look at the old commit hash... Yep, the rotate package doesn't like \hfill in content. I was looking at it out of curiosity, but it wasn't a fix, just quick tests... And I am not going to fix it (here), (anyway).)

@Omikhleia
Copy link
Member Author

Omikhleia commented Mar 13, 2023

N.B. #1035 called for a \reflectbox (with also hints to achieve it via PDF matrix transform). This would just be a special case = \scalebox[xratio=-1,yratio=1]

packages/scalebox/init.lua Outdated Show resolved Hide resolved
packages/scalebox/init.lua Outdated Show resolved Hide resolved
@alerque alerque merged commit bad314f into sile-typesetter:master Mar 23, 2023
@Omikhleia Omikhleia deleted the scalebox branch March 25, 2023 09:12
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

Successfully merging this pull request may close these issues.

How do I horizontally squish content? \reflectbox ?
2 participants