dwrite: Implement AnalyzeContainerType().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
344a41a6ca
commit
9bf92459d3
|
@ -243,6 +243,7 @@ extern UINT32 opentype_get_cpal_paletteentrycount(const void*) DECLSPEC_HIDDEN;
|
||||||
extern HRESULT opentype_get_cpal_entries(const void*,UINT32,UINT32,UINT32,DWRITE_COLOR_F*) DECLSPEC_HIDDEN;
|
extern HRESULT opentype_get_cpal_entries(const void*,UINT32,UINT32,UINT32,DWRITE_COLOR_F*) DECLSPEC_HIDDEN;
|
||||||
extern BOOL opentype_has_vertical_variants(IDWriteFontFace4*) DECLSPEC_HIDDEN;
|
extern BOOL opentype_has_vertical_variants(IDWriteFontFace4*) DECLSPEC_HIDDEN;
|
||||||
extern UINT32 opentype_get_glyph_image_formats(IDWriteFontFace4*) DECLSPEC_HIDDEN;
|
extern UINT32 opentype_get_glyph_image_formats(IDWriteFontFace4*) DECLSPEC_HIDDEN;
|
||||||
|
extern DWRITE_CONTAINER_TYPE opentype_analyze_container_type(void const *, UINT32) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
struct dwrite_colorglyph {
|
struct dwrite_colorglyph {
|
||||||
USHORT layer; /* [0, num_layers) index indicating current layer */
|
USHORT layer; /* [0, num_layers) index indicating current layer */
|
||||||
|
|
|
@ -1636,9 +1636,9 @@ static DWRITE_CONTAINER_TYPE WINAPI dwritefactory5_AnalyzeContainerType(IDWriteF
|
||||||
{
|
{
|
||||||
struct dwritefactory *This = impl_from_IDWriteFactory5(iface);
|
struct dwritefactory *This = impl_from_IDWriteFactory5(iface);
|
||||||
|
|
||||||
FIXME("(%p)->(%p %u): stub\n", This, data, data_size);
|
TRACE("(%p)->(%p %u)\n", This, data, data_size);
|
||||||
|
|
||||||
return DWRITE_CONTAINER_TYPE_UNKNOWN;
|
return opentype_analyze_container_type(data, data_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI dwritefactory5_UnpackFontFile(IDWriteFactory5 *iface, DWRITE_CONTAINER_TYPE container_type, void const *data,
|
static HRESULT WINAPI dwritefactory5_UnpackFontFile(IDWriteFactory5 *iface, DWRITE_CONTAINER_TYPE container_type, void const *data,
|
||||||
|
|
|
@ -47,6 +47,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
|
||||||
#define MS_JPG__TAG DWRITE_MAKE_OPENTYPE_TAG('j','p','g',' ')
|
#define MS_JPG__TAG DWRITE_MAKE_OPENTYPE_TAG('j','p','g',' ')
|
||||||
#define MS_TIFF_TAG DWRITE_MAKE_OPENTYPE_TAG('t','i','f','f')
|
#define MS_TIFF_TAG DWRITE_MAKE_OPENTYPE_TAG('t','i','f','f')
|
||||||
|
|
||||||
|
#define MS_WOFF_TAG DWRITE_MAKE_OPENTYPE_TAG('w','O','F','F')
|
||||||
|
#define MS_WOF2_TAG DWRITE_MAKE_OPENTYPE_TAG('w','O','F','2')
|
||||||
|
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
#define GET_BE_WORD(x) (x)
|
#define GET_BE_WORD(x) (x)
|
||||||
#define GET_BE_DWORD(x) (x)
|
#define GET_BE_DWORD(x) (x)
|
||||||
|
@ -2167,3 +2170,24 @@ UINT32 opentype_get_glyph_image_formats(IDWriteFontFace4 *fontface)
|
||||||
/* TODO: handle embedded bitmaps tables */
|
/* TODO: handle embedded bitmaps tables */
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DWRITE_CONTAINER_TYPE opentype_analyze_container_type(void const *data, UINT32 data_size)
|
||||||
|
{
|
||||||
|
DWORD signature;
|
||||||
|
|
||||||
|
if (data_size < sizeof(DWORD))
|
||||||
|
return DWRITE_CONTAINER_TYPE_UNKNOWN;
|
||||||
|
|
||||||
|
/* Both WOFF and WOFF2 start with 4 bytes signature. */
|
||||||
|
signature = *(DWORD *)data;
|
||||||
|
|
||||||
|
switch (signature)
|
||||||
|
{
|
||||||
|
case MS_WOFF_TAG:
|
||||||
|
return DWRITE_CONTAINER_TYPE_WOFF;
|
||||||
|
case MS_WOF2_TAG:
|
||||||
|
return DWRITE_CONTAINER_TYPE_WOFF2;
|
||||||
|
default:
|
||||||
|
return DWRITE_CONTAINER_TYPE_UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -54,12 +54,19 @@
|
||||||
#define MS_JPG__TAG DWRITE_MAKE_OPENTYPE_TAG('j','p','g',' ')
|
#define MS_JPG__TAG DWRITE_MAKE_OPENTYPE_TAG('j','p','g',' ')
|
||||||
#define MS_TIFF_TAG DWRITE_MAKE_OPENTYPE_TAG('t','i','f','f')
|
#define MS_TIFF_TAG DWRITE_MAKE_OPENTYPE_TAG('t','i','f','f')
|
||||||
|
|
||||||
|
#define MS_WOFF_TAG DWRITE_MAKE_OPENTYPE_TAG('w','O','F','F')
|
||||||
|
#define MS_WOF2_TAG DWRITE_MAKE_OPENTYPE_TAG('w','O','F','2')
|
||||||
|
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
#define GET_BE_WORD(x) (x)
|
#define GET_BE_WORD(x) (x)
|
||||||
#define GET_BE_DWORD(x) (x)
|
#define GET_BE_DWORD(x) (x)
|
||||||
|
#define GET_LE_WORD(x) RtlUshortByteSwap(x)
|
||||||
|
#define GET_LE_DWORD(x) RtlUlongByteSwap(x)
|
||||||
#else
|
#else
|
||||||
#define GET_BE_WORD(x) RtlUshortByteSwap(x)
|
#define GET_BE_WORD(x) RtlUshortByteSwap(x)
|
||||||
#define GET_BE_DWORD(x) RtlUlongByteSwap(x)
|
#define GET_BE_DWORD(x) RtlUlongByteSwap(x)
|
||||||
|
#define GET_LE_WORD(x) (x)
|
||||||
|
#define GET_LE_DWORD(x) (x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define EXPECT_HR(hr,hr_exp) \
|
#define EXPECT_HR(hr,hr_exp) \
|
||||||
|
@ -334,13 +341,54 @@ typedef struct {
|
||||||
WORD numGlyphs;
|
WORD numGlyphs;
|
||||||
} maxp;
|
} maxp;
|
||||||
|
|
||||||
|
struct WOFFHeader
|
||||||
|
{
|
||||||
|
ULONG signature;
|
||||||
|
ULONG flavor;
|
||||||
|
ULONG length;
|
||||||
|
USHORT numTables;
|
||||||
|
USHORT reserved;
|
||||||
|
ULONG totalSfntSize;
|
||||||
|
USHORT majorVersion;
|
||||||
|
USHORT minorVersion;
|
||||||
|
ULONG metaOffset;
|
||||||
|
ULONG metaLength;
|
||||||
|
ULONG metaOrigLength;
|
||||||
|
ULONG privOffset;
|
||||||
|
ULONG privLength;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct WOFFHeader2
|
||||||
|
{
|
||||||
|
ULONG signature;
|
||||||
|
ULONG flavor;
|
||||||
|
ULONG length;
|
||||||
|
USHORT numTables;
|
||||||
|
USHORT reserved;
|
||||||
|
ULONG totalSfntSize;
|
||||||
|
ULONG totalCompressedSize;
|
||||||
|
USHORT majorVersion;
|
||||||
|
USHORT minorVersion;
|
||||||
|
ULONG metaOffset;
|
||||||
|
ULONG metaLength;
|
||||||
|
ULONG metaOrigLength;
|
||||||
|
ULONG privOffset;
|
||||||
|
ULONG privLength;
|
||||||
|
};
|
||||||
|
|
||||||
#include "poppack.h"
|
#include "poppack.h"
|
||||||
|
|
||||||
|
static void *create_factory_iid(REFIID riid)
|
||||||
|
{
|
||||||
|
IUnknown *factory = NULL;
|
||||||
|
DWriteCreateFactory(DWRITE_FACTORY_TYPE_ISOLATED, riid, &factory);
|
||||||
|
return factory;
|
||||||
|
}
|
||||||
|
|
||||||
static IDWriteFactory *create_factory(void)
|
static IDWriteFactory *create_factory(void)
|
||||||
{
|
{
|
||||||
IDWriteFactory *factory;
|
IDWriteFactory *factory = create_factory_iid(&IID_IDWriteFactory);
|
||||||
HRESULT hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_ISOLATED, &IID_IDWriteFactory, (IUnknown**)&factory);
|
ok(factory != NULL, "Failed to create factory.\n");
|
||||||
ok(hr == S_OK, "Failed to create factory, hr %#x.\n", hr);
|
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4459,32 +4507,28 @@ static void test_GetGlyphRunOutline(void)
|
||||||
static void test_GetEudcFontCollection(void)
|
static void test_GetEudcFontCollection(void)
|
||||||
{
|
{
|
||||||
IDWriteFontCollection *coll, *coll2;
|
IDWriteFontCollection *coll, *coll2;
|
||||||
IDWriteFactory1 *factory1;
|
IDWriteFactory1 *factory;
|
||||||
IDWriteFactory *factory;
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
ULONG ref;
|
ULONG ref;
|
||||||
|
|
||||||
factory = create_factory();
|
factory = create_factory_iid(&IID_IDWriteFactory1);
|
||||||
|
if (!factory) {
|
||||||
hr = IDWriteFactory_QueryInterface(factory, &IID_IDWriteFactory1, (void**)&factory1);
|
|
||||||
IDWriteFactory_Release(factory);
|
|
||||||
if (hr != S_OK) {
|
|
||||||
win_skip("GetEudcFontCollection() is not supported.\n");
|
win_skip("GetEudcFontCollection() is not supported.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_REF(factory1, 1);
|
EXPECT_REF(factory, 1);
|
||||||
hr = IDWriteFactory1_GetEudcFontCollection(factory1, &coll, FALSE);
|
hr = IDWriteFactory1_GetEudcFontCollection(factory, &coll, FALSE);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
EXPECT_REF(factory1, 2);
|
EXPECT_REF(factory, 2);
|
||||||
hr = IDWriteFactory1_GetEudcFontCollection(factory1, &coll2, FALSE);
|
hr = IDWriteFactory1_GetEudcFontCollection(factory, &coll2, FALSE);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
EXPECT_REF(factory1, 2);
|
EXPECT_REF(factory, 2);
|
||||||
ok(coll == coll2, "got %p, %p\n", coll, coll2);
|
ok(coll == coll2, "got %p, %p\n", coll, coll2);
|
||||||
IDWriteFontCollection_Release(coll);
|
IDWriteFontCollection_Release(coll);
|
||||||
IDWriteFontCollection_Release(coll2);
|
IDWriteFontCollection_Release(coll2);
|
||||||
|
|
||||||
ref = IDWriteFactory1_Release(factory1);
|
ref = IDWriteFactory1_Release(factory);
|
||||||
ok(ref == 0, "factory not released, %u\n", ref);
|
ok(ref == 0, "factory not released, %u\n", ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6643,8 +6687,7 @@ static void test_TranslateColorGlyphRun(void)
|
||||||
const DWRITE_COLOR_GLYPH_RUN *colorrun;
|
const DWRITE_COLOR_GLYPH_RUN *colorrun;
|
||||||
IDWriteFontFace2 *fontface2;
|
IDWriteFontFace2 *fontface2;
|
||||||
IDWriteFontFace *fontface;
|
IDWriteFontFace *fontface;
|
||||||
IDWriteFactory2 *factory2;
|
IDWriteFactory2 *factory;
|
||||||
IDWriteFactory *factory;
|
|
||||||
DWRITE_GLYPH_RUN run;
|
DWRITE_GLYPH_RUN run;
|
||||||
UINT32 codepoints[2];
|
UINT32 codepoints[2];
|
||||||
IDWriteFont *font;
|
IDWriteFont *font;
|
||||||
|
@ -6653,17 +6696,14 @@ static void test_TranslateColorGlyphRun(void)
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
ULONG ref;
|
ULONG ref;
|
||||||
|
|
||||||
factory = create_factory();
|
factory = create_factory_iid(&IID_IDWriteFactory2);
|
||||||
|
if (!factory) {
|
||||||
hr = IDWriteFactory_QueryInterface(factory, &IID_IDWriteFactory2, (void**)&factory2);
|
|
||||||
IDWriteFactory_Release(factory);
|
|
||||||
if (hr != S_OK) {
|
|
||||||
win_skip("TranslateColorGlyphRun() is not supported.\n");
|
win_skip("TranslateColorGlyphRun() is not supported.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tahoma, no color support */
|
/* Tahoma, no color support */
|
||||||
fontface = create_fontface((IDWriteFactory*)factory2);
|
fontface = create_fontface((IDWriteFactory *)factory);
|
||||||
|
|
||||||
codepoints[0] = 'A';
|
codepoints[0] = 'A';
|
||||||
hr = IDWriteFontFace_GetGlyphIndices(fontface, codepoints, 1, glyphs);
|
hr = IDWriteFontFace_GetGlyphIndices(fontface, codepoints, 1, glyphs);
|
||||||
|
@ -6679,16 +6719,16 @@ static void test_TranslateColorGlyphRun(void)
|
||||||
run.bidiLevel = 0;
|
run.bidiLevel = 0;
|
||||||
|
|
||||||
layers = (void*)0xdeadbeef;
|
layers = (void*)0xdeadbeef;
|
||||||
hr = IDWriteFactory2_TranslateColorGlyphRun(factory2, 0.0, 0.0, &run, NULL,
|
hr = IDWriteFactory2_TranslateColorGlyphRun(factory, 0.0f, 0.0f, &run, NULL,
|
||||||
DWRITE_MEASURING_MODE_NATURAL, NULL, 0, &layers);
|
DWRITE_MEASURING_MODE_NATURAL, NULL, 0, &layers);
|
||||||
ok(hr == DWRITE_E_NOCOLOR, "got 0x%08x\n", hr);
|
ok(hr == DWRITE_E_NOCOLOR, "got 0x%08x\n", hr);
|
||||||
ok(layers == NULL, "got %p\n", layers);
|
ok(layers == NULL, "got %p\n", layers);
|
||||||
IDWriteFontFace_Release(fontface);
|
IDWriteFontFace_Release(fontface);
|
||||||
|
|
||||||
/* Segoe UI Emoji, with color support */
|
/* Segoe UI Emoji, with color support */
|
||||||
font = get_font((IDWriteFactory*)factory2, emojiW, DWRITE_FONT_STYLE_NORMAL);
|
font = get_font((IDWriteFactory *)factory, emojiW, DWRITE_FONT_STYLE_NORMAL);
|
||||||
if (!font) {
|
if (!font) {
|
||||||
IDWriteFactory2_Release(factory2);
|
IDWriteFactory2_Release(factory);
|
||||||
skip("Segoe UI Emoji font not found.\n");
|
skip("Segoe UI Emoji font not found.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6704,12 +6744,12 @@ static void test_TranslateColorGlyphRun(void)
|
||||||
run.fontFace = fontface;
|
run.fontFace = fontface;
|
||||||
|
|
||||||
layers = NULL;
|
layers = NULL;
|
||||||
hr = IDWriteFactory2_TranslateColorGlyphRun(factory2, 0.0, 0.0, &run, NULL,
|
hr = IDWriteFactory2_TranslateColorGlyphRun(factory, 0.0f, 0.0f, &run, NULL,
|
||||||
DWRITE_MEASURING_MODE_NATURAL, NULL, 0, &layers);
|
DWRITE_MEASURING_MODE_NATURAL, NULL, 0, &layers);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
ok(layers != NULL, "got %p\n", layers);
|
ok(layers != NULL, "got %p\n", layers);
|
||||||
|
|
||||||
while (1) {
|
for (;;) {
|
||||||
hasrun = FALSE;
|
hasrun = FALSE;
|
||||||
hr = IDWriteColorGlyphRunEnumerator_MoveNext(layers, &hasrun);
|
hr = IDWriteColorGlyphRunEnumerator_MoveNext(layers, &hasrun);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
@ -6737,14 +6777,14 @@ static void test_TranslateColorGlyphRun(void)
|
||||||
|
|
||||||
/* invalid palette index */
|
/* invalid palette index */
|
||||||
layers = (void*)0xdeadbeef;
|
layers = (void*)0xdeadbeef;
|
||||||
hr = IDWriteFactory2_TranslateColorGlyphRun(factory2, 0.0f, 0.0f, &run, NULL,
|
hr = IDWriteFactory2_TranslateColorGlyphRun(factory, 0.0f, 0.0f, &run, NULL,
|
||||||
DWRITE_MEASURING_MODE_NATURAL, NULL, IDWriteFontFace2_GetColorPaletteCount(fontface2),
|
DWRITE_MEASURING_MODE_NATURAL, NULL, IDWriteFontFace2_GetColorPaletteCount(fontface2),
|
||||||
&layers);
|
&layers);
|
||||||
ok(hr == DWRITE_E_NOCOLOR, "got 0x%08x\n", hr);
|
ok(hr == DWRITE_E_NOCOLOR, "got 0x%08x\n", hr);
|
||||||
ok(layers == NULL, "got %p\n", layers);
|
ok(layers == NULL, "got %p\n", layers);
|
||||||
|
|
||||||
layers = NULL;
|
layers = NULL;
|
||||||
hr = IDWriteFactory2_TranslateColorGlyphRun(factory2, 0.0f, 0.0f, &run, NULL,
|
hr = IDWriteFactory2_TranslateColorGlyphRun(factory, 0.0f, 0.0f, &run, NULL,
|
||||||
DWRITE_MEASURING_MODE_NATURAL, NULL, IDWriteFontFace2_GetColorPaletteCount(fontface2) - 1,
|
DWRITE_MEASURING_MODE_NATURAL, NULL, IDWriteFontFace2_GetColorPaletteCount(fontface2) - 1,
|
||||||
&layers);
|
&layers);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
@ -6756,7 +6796,7 @@ static void test_TranslateColorGlyphRun(void)
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
layers = (void*)0xdeadbeef;
|
layers = (void*)0xdeadbeef;
|
||||||
hr = IDWriteFactory2_TranslateColorGlyphRun(factory2, 0.0, 0.0, &run, NULL,
|
hr = IDWriteFactory2_TranslateColorGlyphRun(factory, 0.0f, 0.0f, &run, NULL,
|
||||||
DWRITE_MEASURING_MODE_NATURAL, NULL, 0, &layers);
|
DWRITE_MEASURING_MODE_NATURAL, NULL, 0, &layers);
|
||||||
ok(hr == DWRITE_E_NOCOLOR, "got 0x%08x\n", hr);
|
ok(hr == DWRITE_E_NOCOLOR, "got 0x%08x\n", hr);
|
||||||
ok(layers == NULL, "got %p\n", layers);
|
ok(layers == NULL, "got %p\n", layers);
|
||||||
|
@ -6771,7 +6811,7 @@ static void test_TranslateColorGlyphRun(void)
|
||||||
run.glyphCount = 2;
|
run.glyphCount = 2;
|
||||||
|
|
||||||
layers = NULL;
|
layers = NULL;
|
||||||
hr = IDWriteFactory2_TranslateColorGlyphRun(factory2, 0.0, 0.0, &run, NULL,
|
hr = IDWriteFactory2_TranslateColorGlyphRun(factory, 0.0f, 0.0f, &run, NULL,
|
||||||
DWRITE_MEASURING_MODE_NATURAL, NULL, 0, &layers);
|
DWRITE_MEASURING_MODE_NATURAL, NULL, 0, &layers);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
ok(layers != NULL, "got %p\n", layers);
|
ok(layers != NULL, "got %p\n", layers);
|
||||||
|
@ -6779,7 +6819,7 @@ static void test_TranslateColorGlyphRun(void)
|
||||||
|
|
||||||
IDWriteFontFace2_Release(fontface2);
|
IDWriteFontFace2_Release(fontface2);
|
||||||
IDWriteFontFace_Release(fontface);
|
IDWriteFontFace_Release(fontface);
|
||||||
ref = IDWriteFactory2_Release(factory2);
|
ref = IDWriteFactory2_Release(factory);
|
||||||
ok(ref == 0, "factory not released, %u\n", ref);
|
ok(ref == 0, "factory not released, %u\n", ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6824,8 +6864,7 @@ static void test_CreateFontFaceReference(void)
|
||||||
IDWriteFontFace3 *fontface, *fontface1;
|
IDWriteFontFace3 *fontface, *fontface1;
|
||||||
IDWriteFontFaceReference *ref, *ref1;
|
IDWriteFontFaceReference *ref, *ref1;
|
||||||
IDWriteFontFile *file, *file1;
|
IDWriteFontFile *file, *file1;
|
||||||
IDWriteFactory3 *factory3;
|
IDWriteFactory3 *factory;
|
||||||
IDWriteFactory *factory;
|
|
||||||
IDWriteFont3 *font3;
|
IDWriteFont3 *font3;
|
||||||
IDWriteFont *font;
|
IDWriteFont *font;
|
||||||
ULONG refcount;
|
ULONG refcount;
|
||||||
|
@ -6834,26 +6873,23 @@ static void test_CreateFontFaceReference(void)
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
factory = create_factory();
|
factory = create_factory_iid(&IID_IDWriteFactory3);
|
||||||
|
if (!factory) {
|
||||||
hr = IDWriteFactory_QueryInterface(factory, &IID_IDWriteFactory3, (void**)&factory3);
|
|
||||||
IDWriteFactory_Release(factory);
|
|
||||||
if (FAILED(hr)) {
|
|
||||||
win_skip("CreateFontFaceReference() is not supported.\n");
|
win_skip("CreateFontFaceReference() is not supported.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
path = create_testfontfile(test_fontfile);
|
path = create_testfontfile(test_fontfile);
|
||||||
|
|
||||||
hr = IDWriteFactory3_CreateFontFaceReference(factory3, NULL, NULL, 0, DWRITE_FONT_SIMULATIONS_NONE, &ref);
|
hr = IDWriteFactory3_CreateFontFaceReference(factory, NULL, NULL, 0, DWRITE_FONT_SIMULATIONS_NONE, &ref);
|
||||||
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
|
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
/* out of range simulation flags */
|
/* out of range simulation flags */
|
||||||
hr = IDWriteFactory3_CreateFontFaceReference(factory3, path, NULL, 0, ~0u, &ref);
|
hr = IDWriteFactory3_CreateFontFaceReference(factory, path, NULL, 0, ~0u, &ref);
|
||||||
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
|
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
/* test file is not a collection, but reference could still be created with non-zero face index */
|
/* test file is not a collection, but reference could still be created with non-zero face index */
|
||||||
hr = IDWriteFactory3_CreateFontFaceReference(factory3, path, NULL, 1, DWRITE_FONT_SIMULATIONS_NONE, &ref);
|
hr = IDWriteFactory3_CreateFontFaceReference(factory, path, NULL, 1, DWRITE_FONT_SIMULATIONS_NONE, &ref);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
index = IDWriteFontFaceReference_GetFontFaceIndex(ref);
|
index = IDWriteFontFaceReference_GetFontFaceIndex(ref);
|
||||||
|
@ -6870,16 +6906,16 @@ todo_wine
|
||||||
IDWriteFontFaceReference_Release(ref);
|
IDWriteFontFaceReference_Release(ref);
|
||||||
|
|
||||||
/* path however has to be valid */
|
/* path however has to be valid */
|
||||||
hr = IDWriteFactory3_CreateFontFaceReference(factory3, dummyW, NULL, 0, DWRITE_FONT_SIMULATIONS_NONE, &ref);
|
hr = IDWriteFactory3_CreateFontFaceReference(factory, dummyW, NULL, 0, DWRITE_FONT_SIMULATIONS_NONE, &ref);
|
||||||
todo_wine
|
todo_wine
|
||||||
ok(hr == DWRITE_E_FILENOTFOUND, "got 0x%08x\n", hr);
|
ok(hr == DWRITE_E_FILENOTFOUND, "got 0x%08x\n", hr);
|
||||||
if (hr == S_OK)
|
if (hr == S_OK)
|
||||||
IDWriteFontFaceReference_Release(ref);
|
IDWriteFontFaceReference_Release(ref);
|
||||||
|
|
||||||
EXPECT_REF(factory3, 1);
|
EXPECT_REF(factory, 1);
|
||||||
hr = IDWriteFactory3_CreateFontFaceReference(factory3, path, NULL, 0, DWRITE_FONT_SIMULATIONS_NONE, &ref);
|
hr = IDWriteFactory3_CreateFontFaceReference(factory, path, NULL, 0, DWRITE_FONT_SIMULATIONS_NONE, &ref);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
EXPECT_REF(factory3, 2);
|
EXPECT_REF(factory, 2);
|
||||||
|
|
||||||
/* new file is returned */
|
/* new file is returned */
|
||||||
hr = IDWriteFontFaceReference_GetFontFile(ref, &file);
|
hr = IDWriteFontFaceReference_GetFontFile(ref, &file);
|
||||||
|
@ -6893,7 +6929,7 @@ todo_wine
|
||||||
IDWriteFontFile_Release(file1);
|
IDWriteFontFile_Release(file1);
|
||||||
|
|
||||||
/* references are not reused */
|
/* references are not reused */
|
||||||
hr = IDWriteFactory3_CreateFontFaceReference(factory3, path, NULL, 0, DWRITE_FONT_SIMULATIONS_NONE, &ref1);
|
hr = IDWriteFactory3_CreateFontFaceReference(factory, path, NULL, 0, DWRITE_FONT_SIMULATIONS_NONE, &ref1);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
ok(ref1 != ref, "got %p, previous ref %p\n", ref1, ref);
|
ok(ref1 != ref, "got %p, previous ref %p\n", ref1, ref);
|
||||||
|
|
||||||
|
@ -6912,13 +6948,13 @@ todo_wine
|
||||||
ok(ret, "got %d\n", ret);
|
ok(ret, "got %d\n", ret);
|
||||||
IDWriteFontFaceReference_Release(ref1);
|
IDWriteFontFaceReference_Release(ref1);
|
||||||
|
|
||||||
hr = IDWriteFactory3_CreateFontFaceReference(factory3, path, NULL, 1, DWRITE_FONT_SIMULATIONS_NONE, &ref1);
|
hr = IDWriteFactory3_CreateFontFaceReference(factory, path, NULL, 1, DWRITE_FONT_SIMULATIONS_NONE, &ref1);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
ret = IDWriteFontFaceReference_Equals(ref, ref1);
|
ret = IDWriteFontFaceReference_Equals(ref, ref1);
|
||||||
ok(!ret, "got %d\n", ret);
|
ok(!ret, "got %d\n", ret);
|
||||||
IDWriteFontFaceReference_Release(ref1);
|
IDWriteFontFaceReference_Release(ref1);
|
||||||
|
|
||||||
hr = IDWriteFactory3_CreateFontFaceReference(factory3, path, NULL, 0, DWRITE_FONT_SIMULATIONS_BOLD, &ref1);
|
hr = IDWriteFactory3_CreateFontFaceReference(factory, path, NULL, 0, DWRITE_FONT_SIMULATIONS_BOLD, &ref1);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
ret = IDWriteFontFaceReference_Equals(ref, ref1);
|
ret = IDWriteFontFaceReference_Equals(ref, ref1);
|
||||||
ok(!ret, "got %d\n", ret);
|
ok(!ret, "got %d\n", ret);
|
||||||
|
@ -6927,10 +6963,10 @@ todo_wine
|
||||||
IDWriteFontFaceReference_Release(ref);
|
IDWriteFontFaceReference_Release(ref);
|
||||||
|
|
||||||
/* create reference from a file */
|
/* create reference from a file */
|
||||||
hr = IDWriteFactory3_CreateFontFileReference(factory3, path, NULL, &file);
|
hr = IDWriteFactory3_CreateFontFileReference(factory, path, NULL, &file);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
hr = IDWriteFactory3_CreateFontFaceReference_(factory3, file, 0, DWRITE_FONT_SIMULATIONS_NONE, &ref);
|
hr = IDWriteFactory3_CreateFontFaceReference_(factory, file, 0, DWRITE_FONT_SIMULATIONS_NONE, &ref);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
hr = IDWriteFontFaceReference_GetFontFile(ref, &file1);
|
hr = IDWriteFontFaceReference_GetFontFile(ref, &file1);
|
||||||
|
@ -6942,7 +6978,7 @@ todo_wine
|
||||||
IDWriteFontFile_Release(file1);
|
IDWriteFontFile_Release(file1);
|
||||||
|
|
||||||
/* references returned from IDWriteFont3 */
|
/* references returned from IDWriteFont3 */
|
||||||
font = get_tahoma_instance((IDWriteFactory*)factory3, DWRITE_FONT_STYLE_NORMAL);
|
font = get_tahoma_instance((IDWriteFactory *)factory, DWRITE_FONT_STYLE_NORMAL);
|
||||||
hr = IDWriteFont_QueryInterface(font, &IID_IDWriteFont3, (void**)&font3);
|
hr = IDWriteFont_QueryInterface(font, &IID_IDWriteFont3, (void**)&font3);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
IDWriteFont_Release(font);
|
IDWriteFont_Release(font);
|
||||||
|
@ -6983,7 +7019,7 @@ if (hr == S_OK) {
|
||||||
IDWriteFontFace3_Release(fontface);
|
IDWriteFontFace3_Release(fontface);
|
||||||
IDWriteFont3_Release(font3);
|
IDWriteFont3_Release(font3);
|
||||||
|
|
||||||
refcount = IDWriteFactory3_Release(factory3);
|
refcount = IDWriteFactory3_Release(factory);
|
||||||
ok(refcount == 0, "factory not released, %u\n", refcount);
|
ok(refcount == 0, "factory not released, %u\n", refcount);
|
||||||
DELETE_FONTFILE(path);
|
DELETE_FONTFILE(path);
|
||||||
}
|
}
|
||||||
|
@ -7370,8 +7406,7 @@ static void test_HasKerningPairs(void)
|
||||||
|
|
||||||
static void test_ComputeGlyphOrigins(void)
|
static void test_ComputeGlyphOrigins(void)
|
||||||
{
|
{
|
||||||
IDWriteFactory4 *factory4;
|
IDWriteFactory4 *factory;
|
||||||
IDWriteFactory *factory;
|
|
||||||
DWRITE_GLYPH_RUN run;
|
DWRITE_GLYPH_RUN run;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
D2D1_POINT_2F origins[2];
|
D2D1_POINT_2F origins[2];
|
||||||
|
@ -7381,10 +7416,8 @@ static void test_ComputeGlyphOrigins(void)
|
||||||
DWRITE_MATRIX m;
|
DWRITE_MATRIX m;
|
||||||
ULONG ref;
|
ULONG ref;
|
||||||
|
|
||||||
factory = create_factory();
|
factory = create_factory_iid(&IID_IDWriteFactory4);
|
||||||
hr = IDWriteFactory_QueryInterface(factory, &IID_IDWriteFactory4, (void **)&factory4);
|
if (!factory) {
|
||||||
IDWriteFactory_Release(factory);
|
|
||||||
if (FAILED(hr)) {
|
|
||||||
win_skip("ComputeGlyphOrigins() is not supported.\n");
|
win_skip("ComputeGlyphOrigins() is not supported.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -7405,13 +7438,13 @@ static void test_ComputeGlyphOrigins(void)
|
||||||
baseline_origin.y = 321.0f;
|
baseline_origin.y = 321.0f;
|
||||||
|
|
||||||
memset(origins, 0, sizeof(origins));
|
memset(origins, 0, sizeof(origins));
|
||||||
hr = IDWriteFactory4_ComputeGlyphOrigins_(factory4, &run, baseline_origin, origins);
|
hr = IDWriteFactory4_ComputeGlyphOrigins_(factory, &run, baseline_origin, origins);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
ok(origins[0].x == 123.0f && origins[0].y == 321.0f, "origins[0] %f,%f\n", origins[0].x, origins[0].y);
|
ok(origins[0].x == 123.0f && origins[0].y == 321.0f, "origins[0] %f,%f\n", origins[0].x, origins[0].y);
|
||||||
ok(origins[1].x == 133.0f && origins[1].y == 321.0f, "origins[1] %f,%f\n", origins[1].x, origins[1].y);
|
ok(origins[1].x == 133.0f && origins[1].y == 321.0f, "origins[1] %f,%f\n", origins[1].x, origins[1].y);
|
||||||
|
|
||||||
memset(origins, 0, sizeof(origins));
|
memset(origins, 0, sizeof(origins));
|
||||||
hr = IDWriteFactory4_ComputeGlyphOrigins(factory4, &run, DWRITE_MEASURING_MODE_NATURAL, baseline_origin,
|
hr = IDWriteFactory4_ComputeGlyphOrigins(factory, &run, DWRITE_MEASURING_MODE_NATURAL, baseline_origin,
|
||||||
NULL, origins);
|
NULL, origins);
|
||||||
ok(origins[0].x == 123.0f && origins[0].y == 321.0f, "origins[0] %f,%f\n", origins[0].x, origins[0].y);
|
ok(origins[0].x == 123.0f && origins[0].y == 321.0f, "origins[0] %f,%f\n", origins[0].x, origins[0].y);
|
||||||
ok(origins[1].x == 133.0f && origins[1].y == 321.0f, "origins[1] %f,%f\n", origins[1].x, origins[1].y);
|
ok(origins[1].x == 133.0f && origins[1].y == 321.0f, "origins[1] %f,%f\n", origins[1].x, origins[1].y);
|
||||||
|
@ -7425,12 +7458,12 @@ static void test_ComputeGlyphOrigins(void)
|
||||||
m.dy = 0.0f;
|
m.dy = 0.0f;
|
||||||
|
|
||||||
memset(origins, 0, sizeof(origins));
|
memset(origins, 0, sizeof(origins));
|
||||||
hr = IDWriteFactory4_ComputeGlyphOrigins(factory4, &run, DWRITE_MEASURING_MODE_NATURAL, baseline_origin,
|
hr = IDWriteFactory4_ComputeGlyphOrigins(factory, &run, DWRITE_MEASURING_MODE_NATURAL, baseline_origin,
|
||||||
&m, origins);
|
&m, origins);
|
||||||
ok(origins[0].x == 123.0f && origins[0].y == 321.0f, "origins[0] %f,%f\n", origins[0].x, origins[0].y);
|
ok(origins[0].x == 123.0f && origins[0].y == 321.0f, "origins[0] %f,%f\n", origins[0].x, origins[0].y);
|
||||||
ok(origins[1].x == 133.0f && origins[1].y == 321.0f, "origins[1] %f,%f\n", origins[1].x, origins[1].y);
|
ok(origins[1].x == 133.0f && origins[1].y == 321.0f, "origins[1] %f,%f\n", origins[1].x, origins[1].y);
|
||||||
|
|
||||||
ref = IDWriteFactory4_Release(factory4);
|
ref = IDWriteFactory4_Release(factory);
|
||||||
ok(ref == 0, "factory not released, %u\n", ref);
|
ok(ref == 0, "factory not released, %u\n", ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7648,32 +7681,28 @@ static void test_inmemory_file_loader(void)
|
||||||
UINT64 file_size, size, writetime;
|
UINT64 file_size, size, writetime;
|
||||||
IDWriteFontFile *file, *file2;
|
IDWriteFontFile *file, *file2;
|
||||||
IDWriteFontFace *fontface;
|
IDWriteFontFace *fontface;
|
||||||
IDWriteFactory5 *factory5;
|
|
||||||
void *context, *context2;
|
void *context, *context2;
|
||||||
IDWriteFactory *factory;
|
IDWriteFactory5 *factory;
|
||||||
UINT32 count, key_size;
|
UINT32 count, key_size;
|
||||||
DWORD ref_key;
|
DWORD ref_key;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
ULONG ref;
|
ULONG ref;
|
||||||
|
|
||||||
factory = create_factory();
|
factory = create_factory_iid(&IID_IDWriteFactory5);
|
||||||
|
if (!factory) {
|
||||||
hr = IDWriteFactory_QueryInterface(factory, &IID_IDWriteFactory5, (void **)&factory5);
|
win_skip("CreateInMemoryFontFileLoader() is not supported\n");
|
||||||
IDWriteFactory_Release(factory);
|
|
||||||
if (FAILED(hr)) {
|
|
||||||
win_skip("CreateInMemoryFontFileLoader is not supported\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_REF(factory5, 1);
|
EXPECT_REF(factory, 1);
|
||||||
hr = IDWriteFactory5_CreateInMemoryFontFileLoader(factory5, &loader);
|
hr = IDWriteFactory5_CreateInMemoryFontFileLoader(factory, &loader);
|
||||||
ok(hr == S_OK, "got %#x\n", hr);
|
ok(hr == S_OK, "got %#x\n", hr);
|
||||||
EXPECT_REF(factory5, 1);
|
EXPECT_REF(factory, 1);
|
||||||
|
|
||||||
testowner_init(&ownerobject);
|
testowner_init(&ownerobject);
|
||||||
fontface = create_fontface((IDWriteFactory *)factory5);
|
fontface = create_fontface((IDWriteFactory *)factory);
|
||||||
|
|
||||||
hr = IDWriteFactory5_CreateInMemoryFontFileLoader(factory5, &loader2);
|
hr = IDWriteFactory5_CreateInMemoryFontFileLoader(factory, &loader2);
|
||||||
ok(hr == S_OK, "got %#x\n", hr);
|
ok(hr == S_OK, "got %#x\n", hr);
|
||||||
ok(loader != loader2, "unexpected pointer\n");
|
ok(loader != loader2, "unexpected pointer\n");
|
||||||
IDWriteFontFileLoader_Release(loader2);
|
IDWriteFontFileLoader_Release(loader2);
|
||||||
|
@ -7709,19 +7738,19 @@ static void test_inmemory_file_loader(void)
|
||||||
ok(hr == S_OK, "got %#x\n", hr);
|
ok(hr == S_OK, "got %#x\n", hr);
|
||||||
|
|
||||||
/* Not registered yet. */
|
/* Not registered yet. */
|
||||||
hr = IDWriteInMemoryFontFileLoader_CreateInMemoryFontFileReference(inmemory, (IDWriteFactory *)factory5, data,
|
hr = IDWriteInMemoryFontFileLoader_CreateInMemoryFontFileReference(inmemory, (IDWriteFactory *)factory, data,
|
||||||
file_size, NULL, &file);
|
file_size, NULL, &file);
|
||||||
ok(hr == E_INVALIDARG, "got %#x\n", hr);
|
ok(hr == E_INVALIDARG, "got %#x\n", hr);
|
||||||
|
|
||||||
count = IDWriteInMemoryFontFileLoader_GetFileCount(inmemory);
|
count = IDWriteInMemoryFontFileLoader_GetFileCount(inmemory);
|
||||||
ok(count == 1, "Unexpected file count %u.\n", count);
|
ok(count == 1, "Unexpected file count %u.\n", count);
|
||||||
|
|
||||||
hr = IDWriteFactory5_RegisterFontFileLoader(factory5, (IDWriteFontFileLoader *)inmemory);
|
hr = IDWriteFactory5_RegisterFontFileLoader(factory, (IDWriteFontFileLoader *)inmemory);
|
||||||
ok(hr == S_OK, "got %#x\n", hr);
|
ok(hr == S_OK, "got %#x\n", hr);
|
||||||
EXPECT_REF(inmemory, 2);
|
EXPECT_REF(inmemory, 2);
|
||||||
|
|
||||||
EXPECT_REF(&ownerobject.IUnknown_iface, 1);
|
EXPECT_REF(&ownerobject.IUnknown_iface, 1);
|
||||||
hr = IDWriteInMemoryFontFileLoader_CreateInMemoryFontFileReference(inmemory, (IDWriteFactory *)factory5, data,
|
hr = IDWriteInMemoryFontFileLoader_CreateInMemoryFontFileReference(inmemory, (IDWriteFactory *)factory, data,
|
||||||
file_size, &ownerobject.IUnknown_iface, &file);
|
file_size, &ownerobject.IUnknown_iface, &file);
|
||||||
ok(hr == S_OK, "got %#x\n", hr);
|
ok(hr == S_OK, "got %#x\n", hr);
|
||||||
EXPECT_REF(&ownerobject.IUnknown_iface, 2);
|
EXPECT_REF(&ownerobject.IUnknown_iface, 2);
|
||||||
|
@ -7730,7 +7759,7 @@ static void test_inmemory_file_loader(void)
|
||||||
count = IDWriteInMemoryFontFileLoader_GetFileCount(inmemory);
|
count = IDWriteInMemoryFontFileLoader_GetFileCount(inmemory);
|
||||||
ok(count == 2, "Unexpected file count %u.\n", count);
|
ok(count == 2, "Unexpected file count %u.\n", count);
|
||||||
|
|
||||||
hr = IDWriteInMemoryFontFileLoader_CreateInMemoryFontFileReference(inmemory, (IDWriteFactory *)factory5, data,
|
hr = IDWriteInMemoryFontFileLoader_CreateInMemoryFontFileReference(inmemory, (IDWriteFactory *)factory, data,
|
||||||
file_size, &ownerobject.IUnknown_iface, &file2);
|
file_size, &ownerobject.IUnknown_iface, &file2);
|
||||||
ok(hr == S_OK, "got %#x\n", hr);
|
ok(hr == S_OK, "got %#x\n", hr);
|
||||||
ok(file2 != file, "got unexpected file\n");
|
ok(file2 != file, "got unexpected file\n");
|
||||||
|
@ -7784,7 +7813,7 @@ static void test_inmemory_file_loader(void)
|
||||||
count = IDWriteInMemoryFontFileLoader_GetFileCount(inmemory);
|
count = IDWriteInMemoryFontFileLoader_GetFileCount(inmemory);
|
||||||
ok(count == 3, "Unexpected file count %u.\n", count);
|
ok(count == 3, "Unexpected file count %u.\n", count);
|
||||||
|
|
||||||
hr = IDWriteFactory5_UnregisterFontFileLoader(factory5, (IDWriteFontFileLoader *)inmemory);
|
hr = IDWriteFactory5_UnregisterFontFileLoader(factory, (IDWriteFontFileLoader *)inmemory);
|
||||||
ok(hr == S_OK, "got %#x\n", hr);
|
ok(hr == S_OK, "got %#x\n", hr);
|
||||||
EXPECT_REF(&ownerobject.IUnknown_iface, 3);
|
EXPECT_REF(&ownerobject.IUnknown_iface, 3);
|
||||||
|
|
||||||
|
@ -7794,21 +7823,21 @@ static void test_inmemory_file_loader(void)
|
||||||
EXPECT_REF(&ownerobject.IUnknown_iface, 1);
|
EXPECT_REF(&ownerobject.IUnknown_iface, 1);
|
||||||
|
|
||||||
/* Test reference key for first added file. */
|
/* Test reference key for first added file. */
|
||||||
hr = IDWriteFactory5_CreateInMemoryFontFileLoader(factory5, &loader);
|
hr = IDWriteFactory5_CreateInMemoryFontFileLoader(factory, &loader);
|
||||||
ok(hr == S_OK, "Failed to create loader, hr %#x.\n", hr);
|
ok(hr == S_OK, "Failed to create loader, hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDWriteFontFileLoader_QueryInterface(loader, &IID_IDWriteInMemoryFontFileLoader, (void **)&inmemory);
|
hr = IDWriteFontFileLoader_QueryInterface(loader, &IID_IDWriteInMemoryFontFileLoader, (void **)&inmemory);
|
||||||
ok(hr == S_OK, "Failed to get in-memory interface, hr %#x.\n", hr);
|
ok(hr == S_OK, "Failed to get in-memory interface, hr %#x.\n", hr);
|
||||||
IDWriteFontFileLoader_Release(loader);
|
IDWriteFontFileLoader_Release(loader);
|
||||||
|
|
||||||
hr = IDWriteFactory5_RegisterFontFileLoader(factory5, (IDWriteFontFileLoader *)inmemory);
|
hr = IDWriteFactory5_RegisterFontFileLoader(factory, (IDWriteFontFileLoader *)inmemory);
|
||||||
ok(hr == S_OK, "Failed to register loader, hr %#x.\n", hr);
|
ok(hr == S_OK, "Failed to register loader, hr %#x.\n", hr);
|
||||||
|
|
||||||
ref_key = 0;
|
ref_key = 0;
|
||||||
hr = IDWriteInMemoryFontFileLoader_CreateStreamFromKey(inmemory, &ref_key, sizeof(ref_key), &stream2);
|
hr = IDWriteInMemoryFontFileLoader_CreateStreamFromKey(inmemory, &ref_key, sizeof(ref_key), &stream2);
|
||||||
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
|
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDWriteInMemoryFontFileLoader_CreateInMemoryFontFileReference(inmemory, (IDWriteFactory *)factory5, data,
|
hr = IDWriteInMemoryFontFileLoader_CreateInMemoryFontFileReference(inmemory, (IDWriteFactory *)factory, data,
|
||||||
file_size, &ownerobject.IUnknown_iface, &file);
|
file_size, &ownerobject.IUnknown_iface, &file);
|
||||||
ok(hr == S_OK, "Failed to create in-memory file reference, hr %#x.\n", hr);
|
ok(hr == S_OK, "Failed to create in-memory file reference, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
@ -7861,14 +7890,14 @@ static void test_inmemory_file_loader(void)
|
||||||
count = IDWriteInMemoryFontFileLoader_GetFileCount(inmemory);
|
count = IDWriteInMemoryFontFileLoader_GetFileCount(inmemory);
|
||||||
ok(count == 1, "Unexpected file count %u.\n", count);
|
ok(count == 1, "Unexpected file count %u.\n", count);
|
||||||
|
|
||||||
hr = IDWriteFactory5_UnregisterFontFileLoader(factory5, (IDWriteFontFileLoader *)inmemory);
|
hr = IDWriteFactory5_UnregisterFontFileLoader(factory, (IDWriteFontFileLoader *)inmemory);
|
||||||
ok(hr == S_OK, "Failed to unregister loader, hr %#x.\n", hr);
|
ok(hr == S_OK, "Failed to unregister loader, hr %#x.\n", hr);
|
||||||
|
|
||||||
IDWriteFontFileStream_ReleaseFileFragment(stream, context);
|
IDWriteFontFileStream_ReleaseFileFragment(stream, context);
|
||||||
IDWriteFontFileStream_Release(stream);
|
IDWriteFontFileStream_Release(stream);
|
||||||
IDWriteFontFace_Release(fontface);
|
IDWriteFontFace_Release(fontface);
|
||||||
|
|
||||||
ref = IDWriteFactory5_Release(factory5);
|
ref = IDWriteFactory5_Release(factory);
|
||||||
ok(ref == 0, "factory not released, %u\n", ref);
|
ok(ref == 0, "factory not released, %u\n", ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8156,6 +8185,59 @@ static void test_localfontfileloader(void)
|
||||||
DELETE_FONTFILE(path);
|
DELETE_FONTFILE(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_AnalyzeContainerType(void)
|
||||||
|
{
|
||||||
|
struct WOFFHeader2 woff2_header;
|
||||||
|
struct WOFFHeader woff_header;
|
||||||
|
DWRITE_CONTAINER_TYPE type;
|
||||||
|
IDWriteFactory5 *factory;
|
||||||
|
|
||||||
|
factory = create_factory_iid(&IID_IDWriteFactory5);
|
||||||
|
if (!factory) {
|
||||||
|
win_skip("AnalyzeContainerType() is not supported.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
type = IDWriteFactory5_AnalyzeContainerType(factory, NULL, 0);
|
||||||
|
ok(type == DWRITE_CONTAINER_TYPE_UNKNOWN, "Unexpected container type %u.\n", type);
|
||||||
|
|
||||||
|
type = IDWriteFactory5_AnalyzeContainerType(factory, (void const *)0xdeadbeef, 0);
|
||||||
|
ok(type == DWRITE_CONTAINER_TYPE_UNKNOWN, "Unexpected container type %u.\n", type);
|
||||||
|
|
||||||
|
memset(&woff_header, 0xff, sizeof(woff_header));
|
||||||
|
woff_header.signature = GET_LE_DWORD(MS_WOFF_TAG);
|
||||||
|
woff_header.length = 0;
|
||||||
|
type = IDWriteFactory5_AnalyzeContainerType(factory, &woff_header, sizeof(woff_header));
|
||||||
|
ok(type == DWRITE_CONTAINER_TYPE_WOFF, "Unexpected container type %u.\n", type);
|
||||||
|
|
||||||
|
memset(&woff_header, 0xff, sizeof(woff_header));
|
||||||
|
woff_header.signature = GET_LE_DWORD(MS_WOFF_TAG);
|
||||||
|
type = IDWriteFactory5_AnalyzeContainerType(factory, &woff_header, sizeof(woff_header.signature));
|
||||||
|
ok(type == DWRITE_CONTAINER_TYPE_WOFF, "Unexpected container type %u.\n", type);
|
||||||
|
|
||||||
|
memset(&woff_header, 0xff, sizeof(woff_header));
|
||||||
|
woff_header.signature = GET_LE_DWORD(MS_WOFF_TAG);
|
||||||
|
type = IDWriteFactory5_AnalyzeContainerType(factory, &woff_header, sizeof(woff_header.signature) - 1);
|
||||||
|
ok(type == DWRITE_CONTAINER_TYPE_UNKNOWN, "Unexpected container type %u.\n", type);
|
||||||
|
|
||||||
|
memset(&woff2_header, 0xff, sizeof(woff2_header));
|
||||||
|
woff2_header.signature = GET_LE_DWORD(MS_WOF2_TAG);
|
||||||
|
type = IDWriteFactory5_AnalyzeContainerType(factory, &woff2_header, sizeof(woff2_header));
|
||||||
|
ok(type == DWRITE_CONTAINER_TYPE_WOFF2, "Unexpected container type %u.\n", type);
|
||||||
|
|
||||||
|
memset(&woff2_header, 0xff, sizeof(woff2_header));
|
||||||
|
woff2_header.signature = GET_LE_DWORD(MS_WOF2_TAG);
|
||||||
|
type = IDWriteFactory5_AnalyzeContainerType(factory, &woff2_header, sizeof(woff2_header.signature));
|
||||||
|
ok(type == DWRITE_CONTAINER_TYPE_WOFF2, "Unexpected container type %u.\n", type);
|
||||||
|
|
||||||
|
memset(&woff2_header, 0xff, sizeof(woff2_header));
|
||||||
|
woff2_header.signature = GET_LE_DWORD(MS_WOF2_TAG);
|
||||||
|
type = IDWriteFactory5_AnalyzeContainerType(factory, &woff2_header, sizeof(woff2_header.signature) - 1);
|
||||||
|
ok(type == DWRITE_CONTAINER_TYPE_UNKNOWN, "Unexpected container type %u.\n", type);
|
||||||
|
|
||||||
|
IDWriteFactory5_Release(factory);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(font)
|
START_TEST(font)
|
||||||
{
|
{
|
||||||
IDWriteFactory *factory;
|
IDWriteFactory *factory;
|
||||||
|
@ -8221,6 +8303,7 @@ START_TEST(font)
|
||||||
test_GetGlyphImageFormats();
|
test_GetGlyphImageFormats();
|
||||||
test_CreateCustomRenderingParams();
|
test_CreateCustomRenderingParams();
|
||||||
test_localfontfileloader();
|
test_localfontfileloader();
|
||||||
|
test_AnalyzeContainerType();
|
||||||
|
|
||||||
IDWriteFactory_Release(factory);
|
IDWriteFactory_Release(factory);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue