[PATCH v3 5/5] d3dx9: Handle word breaks in ID3DXFont_DrawText.

Matteo Bruni matteo.mystral at gmail.com
Wed Mar 4 04:51:29 CST 2020


On Mon, Mar 2, 2020 at 8:07 PM Sven Baars <sbaars at codeweavers.com> wrote:
>
> diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c
> index 6721bc0765..6dd067f5f1 100644
> --- a/dlls/d3dx9_36/font.c
> +++ b/dlls/d3dx9_36/font.c
> @@ -20,6 +20,10 @@
>
>  #include "d3dx9_private.h"
>
> +#include <assert.h>
> +
> +#include "usp10.h"
> +
>  WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
>
>  struct d3dx_glyph
> @@ -509,13 +513,61 @@ static INT WINAPI ID3DXFontImpl_DrawTextA(ID3DXFont *iface, ID3DXSprite *sprite,
>      return ret;
>  }
>
> +static void TEXT_WordBreak(HDC hdc, const WCHAR *str, unsigned int *len_str,
> +                           int format, unsigned int chars_fit,
> +                           unsigned int *chars_used, SIZE *size)

Same thing as the other patch about picking a better name for the
function. The function parameters are again a bit confusing but I
don't have good suggestions. len_str certainly should be renamed
though.

> +{
> +    SCRIPT_LOGATTR *sla;
> +    SCRIPT_ANALYSIS sa;
> +    int i;

unsigned int i;

> +
> +    assert(format & DT_WORDBREAK);

This one doesn't seem to deserve an assert(), it's not like this is a
required invariant such that the function breaks down if it's not
valid. Actually, the format parameter is otherwise unused at the
moment.

> +    assert(chars_fit < *len_str);
> +
> +    *chars_used = 0;
> +
> +    sla = heap_alloc(*len_str * sizeof(*sla));
> +    if (!sla)
> +        return;
> +
> +    memset(&sa, 0, sizeof(sa));
> +    sa.eScript = SCRIPT_UNDEFINED;

I assume this is okay although I don't know what it entails exactly.



More information about the wine-devel mailing list