OSDN Git Service

Avoid excessive inter-word spaces in adjusted text.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Thu, 1 Nov 2012 21:11:40 +0000 (21:11 +0000)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Thu, 1 Nov 2012 21:11:40 +0000 (21:11 +0000)
ChangeLog
src/pkgdata.cpp

index 4f6d959..2d0c6cc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2012-11-01  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
+       Avoid excessive inter-word spaces in adjusted text.
+
+       * src/pkgdata.cpp (pkgTroffLayoutEngine::WriteLn): Check extent of
+       padding to be added at each inter-word space, when adjusting text; do
+       not adjust, if it exceeds 5% of available display pane width.
+
+2012-11-01  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
        Elide unbreakable text which will not fit within display width.
 
        * src/pkgdata.cpp (pkgTroffLayoutEngine::WriteLn): Add logic to detect
index 590a7d7..1ee54a1 100644 (file)
@@ -221,10 +221,22 @@ bool pkgTroffLayoutEngine::WriteLn( HDC canvas, RECT *bounds )
          else
            SetTextCharacterExtra( canvas, 0 );
        }
-       /* Now, distribute the padding pixels among the remaining
-        * inter-word (fold) spaces within the output line...
+       /* Now, provided the padding pixels will not increase the
+        * inter-word (fold) spacing to more than 5% of the total
+        * line length at each potential fold point...
         */
-       SetTextJustification( canvas, padding, fold );
+       if( ((padding * 100) / (max_width * fold)) < 5 )
+         /* 
+          * ...distribute the padding pixels among the remaining
+          * inter-word spaces within the output line...
+          */
+         SetTextJustification( canvas, padding, fold );
+
+       else
+         /* ...otherwise, we decline to adjust the output line,
+          * and we prefer to also preserve natural tracking.
+          */
+         SetTextCharacterExtra( canvas, 0 );
       }
       else
       { /* If we get to here, then the first item in the output