Revert "user32: Changes in the word breaking algorithm for DrawTextExW (eterbug ...
authorIlya Shpigor <shpigor@etersoft.ru>
Thu, 22 Oct 2009 07:13:54 +0000 (11:13 +0400)
committerVitaly Lipatov <lav@etersoft.ru>
Sun, 25 Oct 2009 15:44:04 +0000 (18:44 +0300)
This reverts commit 6aa516a4dba31224c9eacceca6a4b80bd86f9116.

dlls/user32/text.c

index 14c72e924720c31c57ce8350e3131f292e513c7e..3259dfc0c818828471f9b6c25f8687ec3778f457 100644 (file)
@@ -333,8 +333,10 @@ static void TEXT_PathEllipsify (HDC hdc, WCHAR *str, unsigned int max_len,
  * Work back from the last character that did fit to either a space or the last
  * character of a word, whichever is met first.
  * If there was one or the first character didn't fit then
- *     break the line before that character
- *     and if this is a space then discard it.
+ *     If the text is centred or right justified and that one character was a
+ *     space then break the line before that character
+ *     Otherwise break the line after that character
+ *     and if the next character is a space then discard it.
  * Suppose there was none (and the first character did fit).
  *     If Break Within Word is permitted
  *         break the word after the last character that fits (there must be
@@ -372,13 +374,15 @@ static void TEXT_WordBreak (HDC hdc, WCHAR *str, unsigned int max_str,
     {
         while (p > str && *(--p) != SPACE)
             ;
-        word_fits = (p == str || *p == SPACE);
+        word_fits = (p != str || *p == SPACE);
     }
     /* If there was one or the first character didn't fit then */
     if (word_fits)
     {
         int next_is_space;
-
+        /* break the line before/after that character */
+        if (!(format & (DT_RIGHT | DT_CENTER)) || *p != SPACE)
+            p++;
         next_is_space = (p - str) < *len_str && *p == SPACE;
         *len_str = p - str;
         /* and if the next character is a space then discard it. */