dwrite: Implement returning axis values from face reference.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-12-09 11:09:37 +03:00 committed by Alexandre Julliard
parent f7f9339969
commit 0d533dea5b
2 changed files with 19 additions and 2 deletions

View File

@ -6280,9 +6280,16 @@ static UINT32 WINAPI fontfacereference1_GetFontAxisValueCount(IDWriteFontFaceRef
static HRESULT WINAPI fontfacereference1_GetFontAxisValues(IDWriteFontFaceReference1 *iface, static HRESULT WINAPI fontfacereference1_GetFontAxisValues(IDWriteFontFaceReference1 *iface,
DWRITE_FONT_AXIS_VALUE *axis_values, UINT32 value_count) DWRITE_FONT_AXIS_VALUE *axis_values, UINT32 value_count)
{ {
FIXME("%p, %p, %u.\n", iface, axis_values, value_count); struct dwrite_fontfacereference *reference = impl_from_IDWriteFontFaceReference1(iface);
return E_NOTIMPL; TRACE("%p, %p, %u.\n", iface, axis_values, value_count);
if (value_count < reference->axis_values_count)
return E_NOT_SUFFICIENT_BUFFER;
memcpy(axis_values, reference->axis_values, value_count * sizeof(*axis_values));
return S_OK;
} }
static const IDWriteFontFaceReference1Vtbl fontfacereferencevtbl = static const IDWriteFontFaceReference1Vtbl fontfacereferencevtbl =

View File

@ -9408,6 +9408,16 @@ static void test_font_resource(void)
ok(!ret, "Unexpected result.\n"); ok(!ret, "Unexpected result.\n");
IDWriteFontFaceReference1_Release(reference2); IDWriteFontFaceReference1_Release(reference2);
memset(axis_values, 0, sizeof(axis_values));
hr = IDWriteFontFaceReference1_GetFontAxisValues(reference, axis_values, 1);
ok(hr == E_NOT_SUFFICIENT_BUFFER, "Unexpected hr %#x.\n", hr);
ok(!axis_values[0].axisTag, "Unexpected axis tag.\n");
memset(axis_values, 0, sizeof(axis_values));
hr = IDWriteFontFaceReference1_GetFontAxisValues(reference, axis_values, 2);
ok(hr == S_OK, "Failed to get axis values, hr %#x.\n", hr);
ok(axis_values[0].axisTag == DWRITE_FONT_AXIS_TAG_WEIGHT, "Unexpected axis tag.\n");
IDWriteFontFaceReference1_Release(reference); IDWriteFontFaceReference1_Release(reference);
IDWriteFontFile_Release(fontfile); IDWriteFontFile_Release(fontfile);