d3dx10/font: Add PreloadTextW().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-09-01 16:09:34 +03:00 committed by Alexandre Julliard
parent 293484af60
commit abbab131b8
2 changed files with 26 additions and 11 deletions

View File

@ -210,9 +210,33 @@ static HRESULT WINAPI d3dx_font_PreloadTextA(ID3DX10Font *iface, const char *str
static HRESULT WINAPI d3dx_font_PreloadTextW(ID3DX10Font *iface, const WCHAR *string, INT count)
{
FIXME("iface %p, string %s, count %d stub!\n", iface, debugstr_wn(string, count), count);
struct d3dx_font *font = impl_from_ID3DX10Font(iface);
WORD *indices;
int i;
return E_NOTIMPL;
TRACE("iface %p, string %s, count %d.\n", iface, debugstr_wn(string, count), count);
if (!string && !count)
return S_OK;
if (!string)
return D3DERR_INVALIDCALL;
if (count < 0)
count = lstrlenW(string);
indices = heap_alloc(count * sizeof(*indices));
if (!indices)
return E_OUTOFMEMORY;
GetGlyphIndicesW(font->hdc, string, count, indices, 0);
for (i = 0; i < count; ++i)
ID3DX10Font_PreloadGlyphs(iface, indices[i], indices[i]);
heap_free(indices);
return S_OK;
}
static INT WINAPI d3dx_font_DrawTextA(ID3DX10Font *iface, ID3DX10Sprite *sprite,

View File

@ -2263,32 +2263,23 @@ static void test_font(void)
hr = ID3DX10Font_PreloadTextA(font, NULL, 1);
ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr);
hr = ID3DX10Font_PreloadTextA(font, "test", -1);
todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = ID3DX10Font_PreloadTextA(font, "", 0);
todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = ID3DX10Font_PreloadTextA(font, "", -1);
todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = ID3DX10Font_PreloadTextW(font, NULL, -1);
todo_wine
ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr);
hr = ID3DX10Font_PreloadTextW(font, NULL, 0);
todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = ID3DX10Font_PreloadTextW(font, NULL, 1);
todo_wine
ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr);
hr = ID3DX10Font_PreloadTextW(font, testW, -1);
todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = ID3DX10Font_PreloadTextW(font, L"", 0);
todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = ID3DX10Font_PreloadTextW(font, L"", -1);
todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ID3DX10Font_Release(font);