]> git.lyx.org Git - features.git/commitdiff
Spaces in typewriter font never expand in justified text
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 18 Mar 2023 20:01:06 +0000 (21:01 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 18 Mar 2023 20:03:42 +0000 (21:03 +0100)
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

index 8c86c7731ce89809b8b2a381a1c91db9c7275698..7de4b61d9c31fb921fb1af592656da57923e9daa 100644 (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();
 }