Skip to content

Feature: fit-to-width#96

Open
ntjess wants to merge 4 commits intopolylux-typ:mainfrom
ntjess:fit-to-width
Open

Feature: fit-to-width#96
ntjess wants to merge 4 commits intopolylux-typ:mainfrom
ntjess:fit-to-width

Conversation

@ntjess
Copy link
Contributor

@ntjess ntjess commented Sep 2, 2023

Use case: I want my slide header to always take up one line, regardless of how long that line is. This function solves the problem by allowing text to shrink to it's requested width

show heading.where(level: 2): it => {
  layout(layout-size => {
    fit-to-width(width: layout-size.width, it)
  })
}

#set page(height: auto)
#slide[
  == Lorem
]

#slide[
  == #lorem(10)
]

#slide[
  == #lorem(15)
]

Results in:

image

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.

1 participant