Expected line height no matter the font

Assuming, that you are using a single font, you can get consistent line heights* by specifying top-edge “ascender” and bottom-edge “descender”, find the difference to the wanted font size or the ratio between “real” and “expected” font height and then change leading accordingly.

#let myFont = "Fira Sans"
// TypoRatio = realHeight / expectedHeight
// outcomment the context part when defined, redo for other fonts
#context {
  measure(
    text(
      font: myFont,
      top-edge: "ascender",
      bottom-edge: "descender",
      size: 10pt
    )[x]
  ).height / 10pt
}
#let typoRatio = 1.2

#let lineHeight = 1.4em
#let lineSpacing = lineHeight - typoRatio * 1em
#set par(leading: lineSpacing)
#set text(font: myFont, 11pt, top-edge: "ascender", bottom-edge: "descender")

Other examples are Liberation Sans with a typoRatio of 0.938
or Lato with 1.0.


* As “measured”/given by Adobe Acrobat Pro. I took it as a reference, because when I tried Inkscape and InDesign, I got the line height that I expected/entered when I was checking in Acrobat.