From 1d637b8af0f76d7c758db91ee3a196306f861a21 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Sat, 18 Mar 2023 21:01:06 +0100 Subject: [PATCH] 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. --- src/Row.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Row.cpp b/src/Row.cpp index 8c86c7731c..7de4b61d9c 100644 --- a/src/Row.cpp +++ b/src/Row.cpp @@ -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(); }