Skip to content

Set text size #669

Answered by fenjalien
memeplex asked this question in Q&A
Discussion options

You must be logged in to vote

You can set text outside of the canvas but if you want to change it within the canvas you would have to set it for each content function due to how scopes work in Typst.

To save a bit of time you could write a wrapper function that applies the styling you want:

#import "@preview/cetz:0.2.2"

#cetz.canvas({
  import cetz.draw: *

  let my-content(a, b, ..rest) = {
    content(
      a,
      {
        set text(size: 20pt)
        b
      },
      ..rest
    )
  }

  content((), [hello])
  my-content((rel: (2,0)), [hello])
})

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by memeplex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants