5

I'm using a system font with fontspec, and I'm using the Scale option when I declare it with \setmainfont.

I've found that whenever I use the Scale option, the line spacing is no longer consistent. If two consecutive lines have no ascenders or descenders, the spacing between them is very tight. If there's even one ascender/descender between two lines, the spacing is adjusted enough so that there's no overlap.

Is there any way to return to a consistent line spacing without having to sacrifice the Scale option?

Here's a visual example, and the code I used to produce it:

enter image description here

\documentclass{article}
\usepackage{lipsum}
\usepackage{fontspec}
\setlength{\parindent}{1cm}
\setmainfont[Scale=1.7]{HoeflerText-Roman}

\begin{document}
This is a test aaaa aaaa aaaa aa a aa aa aa a  a aa a aajaa a aaaaa a aaajaa aaa aaaa a  aaaa aa a  aa  a aaaAAAaaa a aa a  aa  a
\end{document}
  • 2
    You need to make \baselineskip larger than the letters. using Scale=1.7 seems very odd, but \linespread{2} or whatever number you need, should avoid most of the problems. – David Carlisle May 26 '15 at 21:14
  • 3
    it would be much better to change font size. scaling the font at that level is for small adjustments so that (say) a nominal 10pt roman font matches the nominal 10pt font you have chosen for sans serif. using 1.7 means that whenever you ask for a 10pt one you get a 17pt one, so it never fits in the allotted space. – David Carlisle May 26 '15 at 21:24
  • 2
    With that setting, the ascenders are about 11.86pt and the descenders are about 4.74pt, so you need a baselineskip of at least 18.6pt to have 2pt between ascenders and descenders, which means you should do \linespread{1.55} because 18.6/12=1.55 (12pt is the default baseline skip). – egreg May 26 '15 at 21:39
  • 1
    @NickolasPeterO'Malley It depends on what kind of document you're doing; 55 characters per line seems really too short, but there's no hard and fast rule. A font at nominal size of 17pt is big in absolute terms; however, the lectionary we use in the church has a font at 24pt or perhaps more (and large pages, of course): again, it depends on the document you're preparing. – egreg May 26 '15 at 21:51
  • 2
    @NickolasPeterO'Malley I'd suggest using memoir with its 17pt option. – egreg May 26 '15 at 22:07
7

When scaling fonts you need to make sure that the interline spacing is big enough to hold the characters. Using scale in the font loading is intended to make small adjustments to tune different fonts so match in some way, perhaps making two different fonts have the same x-height when loaded at the same nominal size.

As it is every time you ask for a 10pt font (on a default 12pt baseline) you are substituting a 17pt font which does not fit, so tex can not preserve the even spacing at the specified 12pt \baselineskip, so it packs the lines as close as it can, separating them with \lineskip (1pt)

So you could increase the baseline spacing by, say, \linespread{1.6} but it would be more natural to specify a 17pt font.

In the default classes \LARGE is 17pt on a 22pt baseline, so you could just use that, however that just selects a large body font.

If you need a large size for all document elements, better to use a class with such a design option such as memoir or extarticle which have 17pt option, or use the 12pt option with an a5paper option, then scale by a5/a4 at the print/layout stage.

3

TeX will automatically space out a line that has contains excessively ‘high’ material; consider a line that contains maths like

$\frac{\int_0^1 x dx}{\int_0^1 y dy}$

This is what you're seeing here, because your large font scaling has caused even regular letters to become ‘high’. David has already given a number of solutions to avoid this problem.

TeX also allows you to adjust the limit at which it inserts the extra padding using the register \lineskiplimit. As TeX by Topic describes, it is the ‘Distance to be maintained between the bottom and top of neighbouring boxes on a vertical list.’ (default 0pt).

If this is made large and negative, then no extra space is inserted (but material in successive lines may well collide):

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Scale=1.7]{Times}
\lineskiplimit=-999pt\relax
\begin{document}
This is a test aaaa aaaa aaaa aa a aa aa aa a  a aa a  aajaa a aAAAaa a aaajaa aaa aaaa a  aaaa $\frac{\int_0^1 x dx}{\int_0^1 y dy}$ aa a  aa  a aaaAAAaaa a aa a  aa  a
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.