dwrite: Added stub EUDC font collection.
This commit is contained in:
parent
cacc9ae888
commit
00ea0b72b6
|
@ -103,6 +103,7 @@ extern HRESULT create_localizedstrings(IDWriteLocalizedStrings**) DECLSPEC_HIDDE
|
|||
extern HRESULT add_localizedstring(IDWriteLocalizedStrings*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
|
||||
extern HRESULT clone_localizedstring(IDWriteLocalizedStrings *iface, IDWriteLocalizedStrings **strings) DECLSPEC_HIDDEN;
|
||||
extern HRESULT get_system_fontcollection(IDWriteFactory2*,IDWriteFontCollection**) DECLSPEC_HIDDEN;
|
||||
extern HRESULT get_eudc_fontcollection(IDWriteFactory2*,IDWriteFontCollection**) DECLSPEC_HIDDEN;
|
||||
extern HRESULT get_textanalyzer(IDWriteTextAnalyzer**) DECLSPEC_HIDDEN;
|
||||
extern HRESULT create_font_file(IDWriteFontFileLoader *loader, const void *reference_key, UINT32 key_size, IDWriteFontFile **font_file) DECLSPEC_HIDDEN;
|
||||
extern HRESULT create_localfontfileloader(IDWriteLocalFontFileLoader** iface) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -1968,6 +1968,58 @@ HRESULT get_system_fontcollection(IDWriteFactory2 *factory, IDWriteFontCollectio
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI eudcfontfileenumerator_QueryInterface(IDWriteFontFileEnumerator *iface, REFIID riid, void **obj)
|
||||
{
|
||||
*obj = NULL;
|
||||
|
||||
if (IsEqualIID(riid, &IID_IDWriteFontFileEnumerator) || IsEqualIID(riid, &IID_IUnknown)) {
|
||||
IDWriteFontFileEnumerator_AddRef(iface);
|
||||
*obj = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI eudcfontfileenumerator_AddRef(IDWriteFontFileEnumerator *iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI eudcfontfileenumerator_Release(IDWriteFontFileEnumerator *iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI eudcfontfileenumerator_GetCurrentFontFile(IDWriteFontFileEnumerator *iface, IDWriteFontFile **file)
|
||||
{
|
||||
*file = NULL;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI eudcfontfileenumerator_MoveNext(IDWriteFontFileEnumerator *iface, BOOL *current)
|
||||
{
|
||||
*current = FALSE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const struct IDWriteFontFileEnumeratorVtbl eudcfontfileenumeratorvtbl =
|
||||
{
|
||||
eudcfontfileenumerator_QueryInterface,
|
||||
eudcfontfileenumerator_AddRef,
|
||||
eudcfontfileenumerator_Release,
|
||||
eudcfontfileenumerator_MoveNext,
|
||||
eudcfontfileenumerator_GetCurrentFontFile
|
||||
};
|
||||
|
||||
static IDWriteFontFileEnumerator eudc_fontfile_enumerator = { &eudcfontfileenumeratorvtbl };
|
||||
|
||||
HRESULT get_eudc_fontcollection(IDWriteFactory2 *factory, IDWriteFontCollection **collection)
|
||||
{
|
||||
TRACE("building EUDC font collection for factory %p\n", factory);
|
||||
return create_font_collection(factory, &eudc_fontfile_enumerator, FALSE, collection);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI dwritefontfile_QueryInterface(IDWriteFontFile *iface, REFIID riid, void **obj)
|
||||
{
|
||||
struct dwrite_fontfile *This = impl_from_IDWriteFontFile(iface);
|
||||
|
|
|
@ -453,6 +453,7 @@ struct dwritefactory {
|
|||
LONG ref;
|
||||
|
||||
IDWriteFontCollection *system_collection;
|
||||
IDWriteFontCollection *eudc_collection;
|
||||
IDWriteGdiInterop *gdiinterop;
|
||||
|
||||
IDWriteLocalFontFileLoader* localfontfileloader;
|
||||
|
@ -505,6 +506,8 @@ static void release_dwritefactory(struct dwritefactory *factory)
|
|||
|
||||
if (factory->system_collection)
|
||||
IDWriteFontCollection_Release(factory->system_collection);
|
||||
if (factory->eudc_collection)
|
||||
IDWriteFontCollection_Release(factory->eudc_collection);
|
||||
if (factory->gdiinterop)
|
||||
release_gdiinterop(factory->gdiinterop);
|
||||
heap_free(factory);
|
||||
|
@ -1025,8 +1028,22 @@ static HRESULT WINAPI dwritefactory1_GetEudcFontCollection(IDWriteFactory2 *ifac
|
|||
BOOL check_for_updates)
|
||||
{
|
||||
struct dwritefactory *This = impl_from_IDWriteFactory2(iface);
|
||||
FIXME("(%p)->(%p %d): stub\n", This, collection, check_for_updates);
|
||||
return E_NOTIMPL;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE("(%p)->(%p %d)\n", This, collection, check_for_updates);
|
||||
|
||||
if (check_for_updates)
|
||||
FIXME("checking for eudc updates not implemented\n");
|
||||
|
||||
if (!This->eudc_collection)
|
||||
hr = get_eudc_fontcollection(iface, &This->eudc_collection);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
IDWriteFontCollection_AddRef(This->eudc_collection);
|
||||
|
||||
*collection = This->eudc_collection;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI dwritefactory1_CreateCustomRenderingParams(IDWriteFactory2 *iface, FLOAT gamma,
|
||||
|
@ -1172,6 +1189,7 @@ static void init_dwritefactory(struct dwritefactory *factory, DWRITE_FACTORY_TYP
|
|||
factory->ref = 1;
|
||||
factory->localfontfileloader = NULL;
|
||||
factory->system_collection = NULL;
|
||||
factory->eudc_collection = NULL;
|
||||
factory->gdiinterop = NULL;
|
||||
|
||||
list_init(&factory->collection_loaders);
|
||||
|
|
|
@ -2928,6 +2928,33 @@ static void test_GetGlyphRunOutline(void)
|
|||
DeleteFileW(test_fontfile);
|
||||
}
|
||||
|
||||
static void test_GetEudcFontCollection(void)
|
||||
{
|
||||
IDWriteFontCollection *coll, *coll2;
|
||||
IDWriteFactory1 *factory1;
|
||||
IDWriteFactory *factory;
|
||||
HRESULT hr;
|
||||
|
||||
factory = create_factory();
|
||||
|
||||
hr = IDWriteFactory_QueryInterface(factory, &IID_IDWriteFactory1, (void**)&factory1);
|
||||
IDWriteFactory_Release(factory);
|
||||
if (hr != S_OK) {
|
||||
win_skip("GetEudcFontCollection() is not supported.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IDWriteFactory1_GetEudcFontCollection(factory1, &coll, FALSE);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
hr = IDWriteFactory1_GetEudcFontCollection(factory1, &coll2, FALSE);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(coll == coll2, "got %p, %p\n", coll, coll2);
|
||||
IDWriteFontCollection_Release(coll);
|
||||
IDWriteFontCollection_Release(coll2);
|
||||
|
||||
IDWriteFactory1_Release(factory1);
|
||||
}
|
||||
|
||||
START_TEST(font)
|
||||
{
|
||||
IDWriteFactory *factory;
|
||||
|
@ -2965,6 +2992,7 @@ START_TEST(font)
|
|||
test_GetDesignGlyphAdvances();
|
||||
test_IsMonospacedFont();
|
||||
test_GetGlyphRunOutline();
|
||||
test_GetEudcFontCollection();
|
||||
|
||||
IDWriteFactory_Release(factory);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue