Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3dx10_43/font.c | 26 ++++++++++++++++++++++---- dlls/d3dx10_43/tests/d3dx10.c | 6 +----- 2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/dlls/d3dx10_43/font.c b/dlls/d3dx10_43/font.c index 7b2295cc414..77604895903 100644 --- a/dlls/d3dx10_43/font.c +++ b/dlls/d3dx10_43/font.c @@ -32,6 +32,7 @@ struct d3dx_font ID3DX10Font ID3DX10Font_iface; LONG refcount;
+ D3DX10_FONT_DESCW desc; ID3D10Device *device; };
@@ -97,16 +98,32 @@ static HRESULT WINAPI d3dx_font_GetDevice(ID3DX10Font *iface, ID3D10Device **dev
static HRESULT WINAPI d3dx_font_GetDescA(ID3DX10Font *iface, D3DX10_FONT_DESCA *desc) { - FIXME("iface %p, desc %p stub!\n", iface, desc); + struct d3dx_font *font = impl_from_ID3DX10Font(iface);
- return E_NOTIMPL; + TRACE("iface %p, desc %p.\n", iface, desc); + + if (!desc) + return D3DERR_INVALIDCALL; + + memcpy(desc, &font->desc, FIELD_OFFSET(D3DX10_FONT_DESCA, FaceName)); + WideCharToMultiByte(CP_ACP, 0, font->desc.FaceName, -1, desc->FaceName, + ARRAY_SIZE(desc->FaceName), NULL, NULL); + + return S_OK; }
static HRESULT WINAPI d3dx_font_GetDescW(ID3DX10Font *iface, D3DX10_FONT_DESCW *desc) { - FIXME("iface %p, desc %p stub!\n", iface, desc); + struct d3dx_font *font = impl_from_ID3DX10Font(iface);
- return E_NOTIMPL; + TRACE("iface %p, desc %p.\n", iface, desc); + + if (!desc) + return D3DERR_INVALIDCALL; + + *desc = font->desc; + + return S_OK; }
static BOOL WINAPI d3dx_font_GetTextMetricsA(ID3DX10Font *iface, TEXTMETRICA *metrics) @@ -345,6 +362,7 @@ HRESULT WINAPI D3DX10CreateFontIndirectW(ID3D10Device *device, const D3DX10_FONT object->ID3DX10Font_iface.lpVtbl = &d3dx_font_vtbl; object->refcount = 1; object->device = device; + object->desc = *desc; ID3D10Device_AddRef(device);
*font = &object->ID3DX10Font_iface; diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c index 1b875e4fc09..eec2bfd3206 100644 --- a/dlls/d3dx10_43/tests/d3dx10.c +++ b/dlls/d3dx10_43/tests/d3dx10.c @@ -2176,15 +2176,11 @@ static void test_font(void) ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = ID3DX10Font_GetDescA(font, NULL); -todo_wine ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr);
hr = ID3DX10Font_GetDescA(font, &desc); -todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-if (SUCCEEDED(hr)) -{ ok(desc.Height == 12, "Unexpected height %d.\n", desc.Height); ok(desc.Width == 8, "Unexpected width %u.\n", desc.Width); ok(desc.Weight == FW_BOLD, "Unexpected weight %u.\n", desc.Weight); @@ -2195,7 +2191,7 @@ if (SUCCEEDED(hr)) ok(desc.Quality == ANTIALIASED_QUALITY, "Unexpected quality %u.\n", desc.Quality); ok(desc.PitchAndFamily == VARIABLE_PITCH, "Unexpected pitch and family %#x.\n", desc.PitchAndFamily); ok(!strcmp(desc.FaceName, "Tahoma"), "Unexpected facename %s.\n", debugstr_a(desc.FaceName)); -} + ID3DX10Font_Release(font);
/* GetDC + GetTextMetrics */