#text line height and line numbers

18 messages · Page 1 of 1 (latest)

worn gate
#

How can I set the text line height or the number of text lines? If I want to have a text height of 660 pt, it should be 44 textlines with a line height of 15 pt. But how can I set it?

plush goblet
#

Not sure if I understand the question correctly, but if you run
set text(size: 15pt)

Then every future reference to 1em will be 15pt

#

?r

#set text(size: 15pt)

#let body = [Hello world! `1em` is #style(styles => measure(v(1em), styles).height)]

#body

#set text(size: 50pt)

#body
sage heart
plush goblet
#

?r

#import "@preview/polylux:0.3.1": fit-to-height

#fit-to-height(150pt, prescale-width: 150%)[
  #lorem(1000)
]
plush goblet
#

It will shrink the text to fit in your specified container size, you can optionally set "prescale-width" to determine when the lines wrap

worn gate
#

I do not mean the font size. I mean the distance between two text lines (baseline to baseline) should be 15 pt.

#

If you can set the text height to 660 pt you should got it, Ragaga. You have to be able to set both the line height and the text height.

plush goblet
sage heart
#

Leading is the gap between two lines, not the distance between two baselines. So that alone won't give the desired results. But measure() helps here:

#let thing(body) = style(styles => {
  let size = measure(body, styles)
  [Height of "#body" is #size.height]
})

#thing[Hey] \

Shows you the height of a single line. Then you can use that to apply the desired leading using par() so that the sum is 15.0. Still no idea if one can do this automatically.

sonic breach
#

Maybe something like this:

#

?r ```
#block(width: 100%, height: 660pt, stroke: 1pt + white)[
#style(styles => {
set par(leading: 15pt - measure(text[x], styles).height)
for n in range(44) [#{n+1} \ ]
})
]

worn gate
#

Thank you all. That is very helpful. I may not have been precise enough: I didn't mean line numbers but the number of lines. This makes the for-loop redundant. Is there no other possibility to set the text height, line height or number of lines? In LaTeX I mean you can set the text height; in ConTeXt you can set the text height and the number of lines.