<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <br>
    <br>
    <div class="moz-cite-prefix">On 1/25/21 5:08 PM, Henri Verbeet
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOsNvwxWerau0Cc5biCAcMDOEzD5x7kmYksrkAWwJVDzR8FQBQ@mail.gmail.com">
      <pre class="moz-quote-pre" wrap="">On Fri, 22 Jan 2021 at 03:21, é™ˆDaxia <a class="moz-txt-link-rfc2396E" href="mailto:chy2009123@gmail.com"><chy2009123@gmail.com></a> wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">@@ -1161,7 +1161,6 @@ static void STDMETHODCALLTYPE d2d_device_context_DrawText(ID2D1DeviceContext *if
    IDWriteTextLayout *text_layout;
    IDWriteFactory *dwrite_factory;
    D2D1_POINT_2F origin;
-    float width, height;
    HRESULT hr;

    TRACE("iface %p, string %s, string_len %u, text_format %p, layout_rect %s, "
@@ -1176,14 +1175,13 @@ static void STDMETHODCALLTYPE d2d_device_context_DrawText(ID2D1DeviceContext *if
        return;
    }

-    width = max(0.0f, layout_rect->right - layout_rect->left);
-    height = max(0.0f, layout_rect->bottom - layout_rect->top);
    if (measuring_mode == DWRITE_MEASURING_MODE_NATURAL)
        hr = IDWriteFactory_CreateTextLayout(dwrite_factory, string, string_len, text_format,
-                width, height, &text_layout);
+                fabs(layout_rect->right - layout_rect->left), fabs(layout_rect->bottom - layout_rect->top), &text_layout);
    else
        hr = IDWriteFactory_CreateGdiCompatibleTextLayout(dwrite_factory, string, string_len, text_format,
-                width, height, render_target->desc.dpiX / 96.0f, (DWRITE_MATRIX *)&render_target->drawing_state.transform,
+                fabs(layout_rect->right - layout_rect->left), fabs(layout_rect->bottom - layout_rect->top),
+                render_target->desc.dpiX / 96.0f, (DWRITE_MATRIX *)&render_target->drawing_state.transform,
                measuring_mode == DWRITE_MEASURING_MODE_GDI_NATURAL, &text_layout);
    IDWriteFactory_Release(dwrite_factory);
    if (FAILED(hr))
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
When Nikolay sent 9521c6a1eb781ff7cb75a83544bf9b78f889a9e2, he said
his (private) tests showed negative width/height behave like zero
width/height. Do you have tests that contradict that? Regardless of
whether this patch is functionally correct, getting rid of the "width"
and "height" variables doesn't seem like an improvement.

</pre>
    </blockquote>
    The evidence I used is that negative or zero width performs the same
    - it triggers default wrapping behavior (<span style="color: rgb(23, 23, 23); font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 250, 250); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">DWRITE_WORD_WRAPPING_WRAP), for example for text without normal breaks like "ABC" it gives three lines, for A, B, and C. Fixing it up with fabs() will obviously be different.

Now, that might be difficult to see now, because of wrapping itself does not work correctly (I filed a bug for that, and am still working on it).
</span>
  </body>
</html>