]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't use StringFormat::GenericTypographic() in MSW wxGraphicsContext.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 9 Sep 2012 00:43:40 +0000 (00:43 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 9 Sep 2012 00:43:40 +0000 (00:43 +0000)
Using this string format results in very condensed strings when using small
fonts. The results of GDI+ font rendering are still pretty bad even without it
but they are at least slightly better.

Closes #14537.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72442 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/graphics.cpp

index eeef95239a3e246314f458da535d10aa0ec73faa..8532760634912eb5193711a1f5085e862f8fc598 100644 (file)
@@ -89,15 +89,23 @@ inline StringFormat* GetDrawTextStringFormat()
 {
     if ( !gs_drawTextStringFormat )
     {
-        gs_drawTextStringFormat = new StringFormat(StringFormat::GenericTypographic());
-
-        // This doesn't make any difference for DrawText() actually but we want
-        // this behaviour when measuring text.
-        gs_drawTextStringFormat->SetFormatFlags
-        (
-            gs_drawTextStringFormat->GetFormatFlags()
-                | StringFormatFlagsMeasureTrailingSpaces
-        );
+        // We create this string format with exactly the same flags as
+        // StringFormat::GenericTypographic() is documented to use in MSDN
+        // except for the last one which doesn't make any difference for
+        // DrawText() but that we do want to use when measuring text.
+        //
+        // The reason for not just using GenericTypographic itself is that it
+        // does something else (what exactly is unfortunately not documented),
+        // which results in string being displayed quite differently from the
+        // default rendering, see #14537.
+        gs_drawTextStringFormat
+            = new StringFormat
+                  (
+                    StringFormatFlagsLineLimit |
+                    StringFormatFlagsNoClip |
+                    StringFormatFlagsNoFitBlackBox |
+                    StringFormatFlagsMeasureTrailingSpaces
+                  );
     }
 
     return gs_drawTextStringFormat;