dwrite: Implement GetMatchingFontsByLOGFONT().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
33208d8a65
commit
88bc8f948e
|
@ -7501,6 +7501,8 @@ static IDWriteLocalizedStrings * fontset_entry_get_property(struct dwrite_fontse
|
|||
opentype_get_font_info_strings(&stream_desc, DWRITE_INFORMATIONAL_STRING_DESIGN_SCRIPT_LANGUAGE_TAG, &value);
|
||||
else if (property == DWRITE_FONT_PROPERTY_ID_SUPPORTED_SCRIPT_LANGUAGE_TAG)
|
||||
opentype_get_font_info_strings(&stream_desc, DWRITE_INFORMATIONAL_STRING_SUPPORTED_SCRIPT_LANGUAGE_TAG, &value);
|
||||
else if (property == DWRITE_FONT_PROPERTY_ID_WIN32_FAMILY_NAME)
|
||||
opentype_get_font_info_strings(&stream_desc, DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, &value);
|
||||
else
|
||||
WARN("Unsupported property %u.\n", property);
|
||||
|
||||
|
@ -7642,6 +7644,7 @@ static BOOL fontset_entry_is_matching(struct dwrite_fontset_entry *entry, DWRITE
|
|||
case DWRITE_FONT_PROPERTY_ID_FULL_NAME:
|
||||
case DWRITE_FONT_PROPERTY_ID_DESIGN_SCRIPT_LANGUAGE_TAG:
|
||||
case DWRITE_FONT_PROPERTY_ID_SUPPORTED_SCRIPT_LANGUAGE_TAG:
|
||||
case DWRITE_FONT_PROPERTY_ID_WIN32_FAMILY_NAME:
|
||||
if (!(value = fontset_entry_get_property(entry, props[i].propertyId)))
|
||||
return FALSE;
|
||||
|
||||
|
@ -7652,7 +7655,6 @@ static BOOL fontset_entry_is_matching(struct dwrite_fontset_entry *entry, DWRITE
|
|||
case DWRITE_FONT_PROPERTY_ID_WEIGHT_STRETCH_STYLE_FAMILY_NAME:
|
||||
case DWRITE_FONT_PROPERTY_ID_TYPOGRAPHIC_FAMILY_NAME:
|
||||
case DWRITE_FONT_PROPERTY_ID_WEIGHT_STRETCH_STYLE_FACE_NAME:
|
||||
case DWRITE_FONT_PROPERTY_ID_WIN32_FAMILY_NAME:
|
||||
case DWRITE_FONT_PROPERTY_ID_SEMANTIC_TAG:
|
||||
case DWRITE_FONT_PROPERTY_ID_WEIGHT:
|
||||
case DWRITE_FONT_PROPERTY_ID_STRETCH:
|
||||
|
|
|
@ -906,11 +906,20 @@ static HRESULT WINAPI gdiinterop1_GetFontSignature(IDWriteGdiInterop1 *iface, ID
|
|||
}
|
||||
|
||||
static HRESULT WINAPI gdiinterop1_GetMatchingFontsByLOGFONT(IDWriteGdiInterop1 *iface, LOGFONTW const *logfont,
|
||||
IDWriteFontSet *fontset, IDWriteFontSet **subset)
|
||||
IDWriteFontSet *fontset, IDWriteFontSet **subset)
|
||||
{
|
||||
FIXME("%p, %p, %p, %p: stub.\n", iface, logfont, fontset, subset);
|
||||
DWRITE_FONT_PROPERTY property;
|
||||
|
||||
return E_NOTIMPL;
|
||||
TRACE("%p, %p, %p, %p.\n", iface, logfont, fontset, subset);
|
||||
|
||||
if (!logfont || !fontset)
|
||||
return E_INVALIDARG;
|
||||
|
||||
property.propertyId = DWRITE_FONT_PROPERTY_ID_WIN32_FAMILY_NAME;
|
||||
property.propertyValue = logfont->lfFaceName;
|
||||
property.localeName = L"";
|
||||
|
||||
return IDWriteFontSet_GetMatchingFonts(fontset, &property, 1, subset);
|
||||
}
|
||||
|
||||
static const IDWriteGdiInterop1Vtbl gdiinteropvtbl =
|
||||
|
|
|
@ -10319,6 +10319,62 @@ if (SUCCEEDED(hr))
|
|||
DELETE_FONTFILE(path);
|
||||
}
|
||||
|
||||
static void test_GetMatchingFontsByLOGFONT(void)
|
||||
{
|
||||
IDWriteFontSet *systemset, *set;
|
||||
IDWriteGdiInterop1 *interop;
|
||||
IDWriteGdiInterop *interop0;
|
||||
IDWriteFactory3 *factory;
|
||||
ULONG refcount, count;
|
||||
LOGFONTW logfont;
|
||||
HRESULT hr;
|
||||
|
||||
factory = create_factory_iid(&IID_IDWriteFactory3);
|
||||
if (!factory)
|
||||
{
|
||||
win_skip("Skipping GetMatchingFontsByLOGFONT() tests.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IDWriteFactory3_GetSystemFontSet(factory, &systemset);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
interop = NULL;
|
||||
hr = IDWriteFactory3_GetGdiInterop(factory, &interop0);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDWriteGdiInterop_QueryInterface(interop0, &IID_IDWriteGdiInterop1, (void **)&interop);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
IDWriteGdiInterop_Release(interop0);
|
||||
|
||||
memset(&logfont, 0, sizeof(logfont));
|
||||
logfont.lfHeight = 12;
|
||||
logfont.lfWidth = 12;
|
||||
logfont.lfWeight = FW_BOLD;
|
||||
logfont.lfItalic = 1;
|
||||
lstrcpyW(logfont.lfFaceName, L"tahoma");
|
||||
|
||||
hr = IDWriteGdiInterop1_GetMatchingFontsByLOGFONT(interop, NULL, systemset, &set);
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDWriteGdiInterop1_GetMatchingFontsByLOGFONT(interop, &logfont, NULL, &set);
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDWriteGdiInterop1_GetMatchingFontsByLOGFONT(interop, &logfont, systemset, &set);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
count = IDWriteFontSet_GetFontCount(set);
|
||||
ok(count > 0, "Unexpected count %u.\n", count);
|
||||
|
||||
IDWriteFontSet_Release(set);
|
||||
|
||||
IDWriteGdiInterop1_Release(interop);
|
||||
IDWriteFontSet_Release(systemset);
|
||||
|
||||
refcount = IDWriteFactory3_Release(factory);
|
||||
ok(!refcount, "Factory wasn't released, %u.\n", refcount);
|
||||
}
|
||||
|
||||
START_TEST(font)
|
||||
{
|
||||
IDWriteFactory *factory;
|
||||
|
@ -10393,6 +10449,7 @@ START_TEST(font)
|
|||
test_family_font_set();
|
||||
test_system_font_set();
|
||||
test_CreateFontCollectionFromFontSet();
|
||||
test_GetMatchingFontsByLOGFONT();
|
||||
|
||||
IDWriteFactory_Release(factory);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue