Spaces in typewriter font never expand in justified text

This fixes on-screen appearance of things like code with lines longer
than the window width.

The TeXbook makes it clear by indicating that \fontdimen3 == 0 for
these fonts.
This commit is contained in:
Jean-Marc Lasgouttes 2023-03-18 21:01:06 +01:00
parent f24bb4a919
commit 1d637b8af0

View File

@ -45,7 +45,7 @@ static double const MAX_SPACE_STRETCH = 1.5; //em
int Row::Element::countExpanders() const
{
if (type != STRING)
if (type != STRING || font.fontInfo().family() == TYPEWRITER_FAMILY)
return 0;
return support::countExpanders(str);
}
@ -53,7 +53,7 @@ int Row::Element::countExpanders() const
int Row::Element::expansionAmount() const
{
if (type != STRING)
if (type != STRING || font.fontInfo().family() == TYPEWRITER_FAMILY)
return 0;
return countExpanders() * theFontMetrics(font).em();
}