How to mix fonts in a way that doesn't change line spacing?
I'm trying to use Pages to write a technical document. The text has mix of normal font and a fixed width font (aka "monospaced") to represent computer code. For example:
The problem is that when there are multiple lines I can see that the fixed width font pushes the line height out and makes the text look bad. It does this even though both the fonts are the same point size. It even does it when I reduce the fixed width font size a little. Here is a larger screenshot to show what I mean.
Some fonts are worse than others. Courier for example, moves the line, but barely. I don't like the looks of it though – its letters appear significantly shorter than the surrounding Helvetica. I like the Fira Code font, but it moves the line a lot. I had to shrink the Fira Code all the way to 7pt before it stopped disrupting the line spacing.
Shouldn't fonts with same point size have the same line height? If not, is there some way to choose fonts that do? Is there a certain kind of font, or property of the font, that I should be looking for?
There are two problems here. The first is that the 'point size' metric refers the total height from the top of an ascender to the bottom of a descender (and a little bit of space beyond that): in traditional metal type, 12pt was the size of the lead block that the letter was 'carved' out of. So when you put each row of letters down, they line up in multiples of 12pt. So 6 lines of 12pt text uses 1 inch of the page. .
.
Different typefaces have different x-heights -- the height of letters like a o e, so that some appear to be much larger than others on the page. Also, digital typefaces have complicated things, making the measurement slightly more arbitrary.
The second problem is Page's typography. The default line Spacing is set to use '1 Line'. If you change that to use Exactly 14pt (or whatever), then the problem will go away.
.