[LyX/master] Spaces in typewriter font never expand in justified text

Jean-Marc Lasgouttes lasgouttes at lyx.org
Sat Mar 18 19:03:17 UTC 2023


commit 1d637b8af0f76d7c758db91ee3a196306f861a21
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Sat Mar 18 21:01:06 2023 +0100

    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 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Row.cpp b/src/Row.cpp
index 8c86c77..7de4b61 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();
 }


More information about the lyx-cvs mailing list