Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/dwrite_private.h | 40 +- dlls/dwrite/font.c | 732 +++++++++++++++++++---------------- dlls/dwrite/freetype.c | 40 +- dlls/dwrite/main.c | 15 +- dlls/dwrite/opentype.c | 24 +- 5 files changed, 470 insertions(+), 381 deletions(-)
diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index d3d74e0709..7898403dd9 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -175,7 +175,7 @@ struct dwrite_fonttable struct fontfacecached { struct list entry; - IDWriteFontFace4 *fontface; + IDWriteFontFace5 *fontface; };
#define GLYPH_BLOCK_SHIFT 8 @@ -185,8 +185,8 @@ struct fontfacecached
struct dwrite_fontface { - IDWriteFontFace4 IDWriteFontFace4_iface; - LONG ref; + IDWriteFontFace5 IDWriteFontFace5_iface; + LONG refcount;
IDWriteFontFileStream *stream; IDWriteFontFile **files; @@ -244,7 +244,8 @@ extern IDWriteTextAnalyzer *get_text_analyzer(void) DECLSPEC_HIDDEN; extern HRESULT create_font_file(IDWriteFontFileLoader *loader, const void *reference_key, UINT32 key_size, IDWriteFontFile **font_file) DECLSPEC_HIDDEN; extern void init_local_fontfile_loader(void) DECLSPEC_HIDDEN; extern IDWriteFontFileLoader *get_local_fontfile_loader(void) DECLSPEC_HIDDEN; -extern HRESULT create_fontface(const struct fontface_desc*,struct list*,IDWriteFontFace4**) DECLSPEC_HIDDEN; +extern HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_list, + IDWriteFontFace5 **fontface) DECLSPEC_HIDDEN; extern HRESULT create_font_collection(IDWriteFactory5 *factory, IDWriteFontFileEnumerator *enumerator, BOOL is_system, IDWriteFontCollection3 **collection) DECLSPEC_HIDDEN; extern HRESULT create_glyphrunanalysis(const struct glyphrunanalysis_desc*,IDWriteGlyphRunAnalysis**) DECLSPEC_HIDDEN; @@ -267,13 +268,14 @@ extern HRESULT factory_get_cached_fontface(IDWriteFactory5*,IDWriteFontFile*cons struct list**,REFIID,void**) DECLSPEC_HIDDEN; extern void factory_detach_fontcollection(IDWriteFactory5 *factory, IDWriteFontCollection3 *collection) DECLSPEC_HIDDEN; extern void factory_detach_gdiinterop(IDWriteFactory5*,IDWriteGdiInterop1*) DECLSPEC_HIDDEN; -extern struct fontfacecached *factory_cache_fontface(IDWriteFactory5*,struct list*,IDWriteFontFace4*) DECLSPEC_HIDDEN; +extern struct fontfacecached *factory_cache_fontface(IDWriteFactory5 *factory, struct list *fontfaces, + IDWriteFontFace5 *fontface) DECLSPEC_HIDDEN; extern void get_logfont_from_font(IDWriteFont*,LOGFONTW*) DECLSPEC_HIDDEN; extern void get_logfont_from_fontface(IDWriteFontFace*,LOGFONTW*) DECLSPEC_HIDDEN; extern HRESULT get_fontsig_from_font(IDWriteFont*,FONTSIGNATURE*) DECLSPEC_HIDDEN; extern HRESULT get_fontsig_from_fontface(IDWriteFontFace*,FONTSIGNATURE*) DECLSPEC_HIDDEN; extern HRESULT create_gdiinterop(IDWriteFactory5*,IDWriteGdiInterop1**) DECLSPEC_HIDDEN; -extern void fontface_detach_from_cache(IDWriteFontFace4*) DECLSPEC_HIDDEN; +extern void fontface_detach_from_cache(IDWriteFontFace5 *fontface) DECLSPEC_HIDDEN; extern void factory_lock(IDWriteFactory5*) DECLSPEC_HIDDEN; extern void factory_unlock(IDWriteFactory5*) DECLSPEC_HIDDEN; extern HRESULT create_inmemory_fileloader(IDWriteFontFileLoader**) DECLSPEC_HIDDEN; @@ -300,7 +302,7 @@ struct file_stream_desc { UINT32 face_index; };
-extern const void* get_fontface_table(IDWriteFontFace4 *fontface, UINT32 tag, +extern const void* get_fontface_table(IDWriteFontFace5 *fontface, UINT32 tag, struct dwrite_fonttable *table) DECLSPEC_HIDDEN;
extern HRESULT opentype_analyze_font(IDWriteFontFileStream*,BOOL*,DWRITE_FONT_FILE_TYPE*,DWRITE_FONT_FACE_TYPE*,UINT32*) DECLSPEC_HIDDEN; @@ -321,8 +323,8 @@ extern unsigned int opentype_get_cpal_palettecount(const struct dwrite_fonttable extern unsigned int opentype_get_cpal_paletteentrycount(const struct dwrite_fonttable *table) DECLSPEC_HIDDEN; extern HRESULT opentype_get_cpal_entries(const struct dwrite_fonttable *table, unsigned int palette, unsigned int first_entry_index, unsigned int entry_count, DWRITE_COLOR_F *entries) DECLSPEC_HIDDEN; -extern BOOL opentype_has_vertical_variants(IDWriteFontFace4*) DECLSPEC_HIDDEN; -extern UINT32 opentype_get_glyph_image_formats(IDWriteFontFace4*) DECLSPEC_HIDDEN; +extern BOOL opentype_has_vertical_variants(IDWriteFontFace5 *fontface) DECLSPEC_HIDDEN; +extern UINT32 opentype_get_glyph_image_formats(IDWriteFontFace5 *fontface) DECLSPEC_HIDDEN; extern DWRITE_CONTAINER_TYPE opentype_analyze_container_type(void const *, UINT32) DECLSPEC_HIDDEN;
struct dwrite_colorglyph { @@ -373,19 +375,21 @@ extern void release_freetype(void) DECLSPEC_HIDDEN;
extern HRESULT freetype_get_design_glyph_metrics(struct dwrite_fontface *fontface, UINT16 glyph, DWRITE_GLYPH_METRICS *metrics) DECLSPEC_HIDDEN; -extern void freetype_notify_cacheremove(IDWriteFontFace4*) DECLSPEC_HIDDEN; -extern BOOL freetype_is_monospaced(IDWriteFontFace4*) DECLSPEC_HIDDEN; -extern HRESULT freetype_get_glyphrun_outline(IDWriteFontFace4 *fontface, float emsize, UINT16 const *glyphs, +extern void freetype_notify_cacheremove(IDWriteFontFace5 *fontface) DECLSPEC_HIDDEN; +extern BOOL freetype_is_monospaced(IDWriteFontFace5 *fontface) DECLSPEC_HIDDEN; +extern HRESULT freetype_get_glyphrun_outline(IDWriteFontFace5 *fontface, float emsize, UINT16 const *glyphs, float const *advances, DWRITE_GLYPH_OFFSET const *offsets, unsigned int count, BOOL is_rtl, IDWriteGeometrySink *sink) DECLSPEC_HIDDEN; -extern UINT16 freetype_get_glyphcount(IDWriteFontFace4*) DECLSPEC_HIDDEN; -extern void freetype_get_glyphs(IDWriteFontFace4*,INT,UINT32 const*,UINT32,UINT16*) DECLSPEC_HIDDEN; -extern BOOL freetype_has_kerning_pairs(IDWriteFontFace4*) DECLSPEC_HIDDEN; -extern INT32 freetype_get_kerning_pair_adjustment(IDWriteFontFace4*,UINT16,UINT16) DECLSPEC_HIDDEN; +extern UINT16 freetype_get_glyphcount(IDWriteFontFace5 *fontface) DECLSPEC_HIDDEN; +extern void freetype_get_glyphs(IDWriteFontFace5 *fontface, INT charmap, UINT32 const *codepoints, UINT32 count, + UINT16 *glyphs) DECLSPEC_HIDDEN; +extern BOOL freetype_has_kerning_pairs(IDWriteFontFace5 *fontface) DECLSPEC_HIDDEN; +extern INT32 freetype_get_kerning_pair_adjustment(IDWriteFontFace5 *fontface, UINT16 left, UINT16 right) DECLSPEC_HIDDEN; extern void freetype_get_glyph_bbox(struct dwrite_glyphbitmap *bitmap_desc) DECLSPEC_HIDDEN; extern BOOL freetype_get_glyph_bitmap(struct dwrite_glyphbitmap*) DECLSPEC_HIDDEN; -extern INT freetype_get_charmap_index(IDWriteFontFace4*,BOOL*) DECLSPEC_HIDDEN; -extern INT32 freetype_get_glyph_advance(IDWriteFontFace4*,FLOAT,UINT16,DWRITE_MEASURING_MODE,BOOL*) DECLSPEC_HIDDEN; +extern INT freetype_get_charmap_index(IDWriteFontFace5 *fontface, BOOL *is_symbol) DECLSPEC_HIDDEN; +extern INT32 freetype_get_glyph_advance(IDWriteFontFace5 *fontface, FLOAT emsize, UINT16 index, + DWRITE_MEASURING_MODE measuring_mode, BOOL *has_contours) DECLSPEC_HIDDEN; extern void freetype_get_design_glyph_bbox(IDWriteFontFace4*,UINT16,UINT16,RECT*) DECLSPEC_HIDDEN;
/* Glyph shaping */ diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 306f431d65..1bf88d6b17 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -185,7 +185,7 @@ struct dwrite_colorglyphenum FLOAT origin_x; /* original run origin */ FLOAT origin_y;
- IDWriteFontFace4 *fontface; /* for convenience */ + IDWriteFontFace5 *fontface; /* for convenience */ DWRITE_COLOR_GLYPH_RUN1 colorrun; /* returned with GetCurrentRun() */ DWRITE_GLYPH_RUN run; /* base run */ UINT32 palette; /* palette index to get layer color from */ @@ -239,7 +239,7 @@ static void dwrite_grab_font_table(void *context, UINT32 table, const BYTE **dat struct dwrite_fontface *fontface = context; BOOL exists = FALSE;
- if (FAILED(IDWriteFontFace4_TryGetFontTable(&fontface->IDWriteFontFace4_iface, table, (const void **)data, + if (FAILED(IDWriteFontFace5_TryGetFontTable(&fontface->IDWriteFontFace5_iface, table, (const void **)data, size, data_context, &exists)) || !exists) { *data = NULL; @@ -251,7 +251,7 @@ static void dwrite_grab_font_table(void *context, UINT32 table, const BYTE **dat static void dwrite_release_font_table(void *context, void *data_context) { struct dwrite_fontface *fontface = context; - IDWriteFontFace4_ReleaseFontTable(&fontface->IDWriteFontFace4_iface, data_context); + IDWriteFontFace5_ReleaseFontTable(&fontface->IDWriteFontFace5_iface, data_context); }
static UINT16 dwrite_get_font_upem(void *context) @@ -275,9 +275,9 @@ struct scriptshaping_cache *fontface_get_shaping_cache(struct dwrite_fontface *f return fontface->shaping_cache = create_scriptshaping_cache(fontface, &dwrite_font_ops); }
-static inline struct dwrite_fontface *impl_from_IDWriteFontFace4(IDWriteFontFace4 *iface) +static inline struct dwrite_fontface *impl_from_IDWriteFontFace5(IDWriteFontFace5 *iface) { - return CONTAINING_RECORD(iface, struct dwrite_fontface, IDWriteFontFace4_iface); + return CONTAINING_RECORD(iface, struct dwrite_fontface, IDWriteFontFace5_iface); }
static inline struct dwrite_font *impl_from_IDWriteFont3(IDWriteFont3 *iface) @@ -350,7 +350,7 @@ static HRESULT set_cached_glyph_metrics(struct dwrite_fontface *fontface, UINT16 return S_OK; }
-const void* get_fontface_table(IDWriteFontFace4 *fontface, UINT32 tag, struct dwrite_fonttable *table) +const void* get_fontface_table(IDWriteFontFace5 *fontface, UINT32 tag, struct dwrite_fonttable *table) { HRESULT hr;
@@ -358,7 +358,7 @@ const void* get_fontface_table(IDWriteFontFace4 *fontface, UINT32 tag, struct dw return table->data;
table->exists = FALSE; - hr = IDWriteFontFace4_TryGetFontTable(fontface, tag, (const void**)&table->data, &table->size, &table->context, + hr = IDWriteFontFace5_TryGetFontTable(fontface, tag, (const void **)&table->data, &table->size, &table->context, &table->exists); if (FAILED(hr) || !table->exists) { TRACE("Font does not have %s table\n", debugstr_tag(tag)); @@ -388,25 +388,25 @@ static FLOAT get_font_prop_vec_dotproduct(const struct dwrite_font_propvec *left
static const struct dwrite_fonttable *get_fontface_vdmx(struct dwrite_fontface *fontface) { - get_fontface_table(&fontface->IDWriteFontFace4_iface, MS_VDMX_TAG, &fontface->vdmx); + get_fontface_table(&fontface->IDWriteFontFace5_iface, MS_VDMX_TAG, &fontface->vdmx); return &fontface->vdmx; }
static const struct dwrite_fonttable *get_fontface_gasp(struct dwrite_fontface *fontface) { - get_fontface_table(&fontface->IDWriteFontFace4_iface, MS_GASP_TAG, &fontface->gasp); + get_fontface_table(&fontface->IDWriteFontFace5_iface, MS_GASP_TAG, &fontface->gasp); return &fontface->gasp; }
static const struct dwrite_fonttable *get_fontface_cpal(struct dwrite_fontface *fontface) { - get_fontface_table(&fontface->IDWriteFontFace4_iface, MS_CPAL_TAG, &fontface->cpal); + get_fontface_table(&fontface->IDWriteFontFace5_iface, MS_CPAL_TAG, &fontface->cpal); return &fontface->cpal; }
static const void* get_fontface_colr(struct dwrite_fontface *fontface) { - return get_fontface_table(&fontface->IDWriteFontFace4_iface, MS_COLR_TAG, &fontface->colr); + return get_fontface_table(&fontface->IDWriteFontFace5_iface, MS_COLR_TAG, &fontface->colr); }
static void addref_font_data(struct dwrite_font_data *data) @@ -447,17 +447,17 @@ static void release_fontfamily_data(struct dwrite_fontfamily_data *data) heap_free(data); }
-void fontface_detach_from_cache(IDWriteFontFace4 *iface) +void fontface_detach_from_cache(IDWriteFontFace5 *iface) { - struct dwrite_fontface *fontface = impl_from_IDWriteFontFace4(iface); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); fontface->cached = NULL; }
-static HRESULT WINAPI dwritefontface_QueryInterface(IDWriteFontFace4 *iface, REFIID riid, void **obj) +static HRESULT WINAPI dwritefontface_QueryInterface(IDWriteFontFace5 *iface, REFIID riid, void **obj) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface);
- TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
if (IsEqualIID(riid, &IID_IDWriteFontFace4) || IsEqualIID(riid, &IID_IDWriteFontFace3) || @@ -467,8 +467,9 @@ static HRESULT WINAPI dwritefontface_QueryInterface(IDWriteFontFace4 *iface, REF IsEqualIID(riid, &IID_IUnknown)) { *obj = iface; - if (InterlockedIncrement(&This->ref) == 1) { - InterlockedDecrement(&This->ref); + if (InterlockedIncrement(&fontface->refcount) == 1) + { + InterlockedDecrement(&fontface->refcount); *obj = NULL; return E_FAIL; } @@ -481,131 +482,148 @@ static HRESULT WINAPI dwritefontface_QueryInterface(IDWriteFontFace4 *iface, REF return E_NOINTERFACE; }
-static ULONG WINAPI dwritefontface_AddRef(IDWriteFontFace4 *iface) +static ULONG WINAPI dwritefontface_AddRef(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - ULONG ref = InterlockedIncrement(&This->ref); - TRACE("(%p)->(%d)\n", This, ref); - return ref; + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + ULONG refcount = InterlockedIncrement(&fontface->refcount); + + TRACE("%p, refcount %u.\n", iface, refcount); + + return refcount; }
-static ULONG WINAPI dwritefontface_Release(IDWriteFontFace4 *iface) +static ULONG WINAPI dwritefontface_Release(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - ULONG ref = InterlockedDecrement(&This->ref); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + ULONG refcount = InterlockedDecrement(&fontface->refcount);
- TRACE("(%p)->(%d)\n", This, ref); + TRACE("%p, refcount %u.\n", iface, refcount);
- if (!ref) { + if (!refcount) + { UINT32 i;
- if (This->cached) { - factory_lock(This->factory); - list_remove(&This->cached->entry); - factory_unlock(This->factory); - heap_free(This->cached); + if (fontface->cached) + { + factory_lock(fontface->factory); + list_remove(&fontface->cached->entry); + factory_unlock(fontface->factory); + heap_free(fontface->cached); } - release_scriptshaping_cache(This->shaping_cache); - if (This->cmap.context) - IDWriteFontFace4_ReleaseFontTable(iface, This->cmap.context); - if (This->vdmx.context) - IDWriteFontFace4_ReleaseFontTable(iface, This->vdmx.context); - if (This->gasp.context) - IDWriteFontFace4_ReleaseFontTable(iface, This->gasp.context); - if (This->cpal.context) - IDWriteFontFace4_ReleaseFontTable(iface, This->cpal.context); - if (This->colr.context) - IDWriteFontFace4_ReleaseFontTable(iface, This->colr.context); - for (i = 0; i < This->file_count; i++) { - if (This->files[i]) - IDWriteFontFile_Release(This->files[i]); + release_scriptshaping_cache(fontface->shaping_cache); + if (fontface->cmap.context) + IDWriteFontFace5_ReleaseFontTable(iface, fontface->cmap.context); + if (fontface->vdmx.context) + IDWriteFontFace5_ReleaseFontTable(iface, fontface->vdmx.context); + if (fontface->gasp.context) + IDWriteFontFace5_ReleaseFontTable(iface, fontface->gasp.context); + if (fontface->cpal.context) + IDWriteFontFace5_ReleaseFontTable(iface, fontface->cpal.context); + if (fontface->colr.context) + IDWriteFontFace5_ReleaseFontTable(iface, fontface->colr.context); + for (i = 0; i < fontface->file_count; i++) + { + if (fontface->files[i]) + IDWriteFontFile_Release(fontface->files[i]); } - if (This->stream) - IDWriteFontFileStream_Release(This->stream); - heap_free(This->files); + if (fontface->stream) + IDWriteFontFileStream_Release(fontface->stream); + heap_free(fontface->files);
- for (i = 0; i < ARRAY_SIZE(This->glyphs); i++) - heap_free(This->glyphs[i]); + for (i = 0; i < ARRAY_SIZE(fontface->glyphs); i++) + heap_free(fontface->glyphs[i]);
freetype_notify_cacheremove(iface);
- IDWriteFactory5_Release(This->factory); - heap_free(This); + IDWriteFactory5_Release(fontface->factory); + heap_free(fontface); }
- return ref; + return refcount; }
-static DWRITE_FONT_FACE_TYPE WINAPI dwritefontface_GetType(IDWriteFontFace4 *iface) +static DWRITE_FONT_FACE_TYPE WINAPI dwritefontface_GetType(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)\n", This); - return This->type; + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p.\n", iface); + + return fontface->type; }
-static HRESULT WINAPI dwritefontface_GetFiles(IDWriteFontFace4 *iface, UINT32 *number_of_files, +static HRESULT WINAPI dwritefontface_GetFiles(IDWriteFontFace5 *iface, UINT32 *number_of_files, IDWriteFontFile **fontfiles) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); int i;
- TRACE("(%p)->(%p %p)\n", This, number_of_files, fontfiles); + TRACE("%p, %p, %p.\n", iface, number_of_files, fontfiles); + if (fontfiles == NULL) { - *number_of_files = This->file_count; + *number_of_files = fontface->file_count; return S_OK; } - if (*number_of_files < This->file_count) + + if (*number_of_files < fontface->file_count) return E_INVALIDARG;
- for (i = 0; i < This->file_count; i++) + for (i = 0; i < fontface->file_count; i++) { - IDWriteFontFile_AddRef(This->files[i]); - fontfiles[i] = This->files[i]; + IDWriteFontFile_AddRef(fontface->files[i]); + fontfiles[i] = fontface->files[i]; }
return S_OK; }
-static UINT32 WINAPI dwritefontface_GetIndex(IDWriteFontFace4 *iface) +static UINT32 WINAPI dwritefontface_GetIndex(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)\n", This); - return This->index; + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p.\n", iface); + + return fontface->index; }
-static DWRITE_FONT_SIMULATIONS WINAPI dwritefontface_GetSimulations(IDWriteFontFace4 *iface) +static DWRITE_FONT_SIMULATIONS WINAPI dwritefontface_GetSimulations(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)\n", This); - return This->simulations; + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p.\n", iface); + + return fontface->simulations; }
-static BOOL WINAPI dwritefontface_IsSymbolFont(IDWriteFontFace4 *iface) +static BOOL WINAPI dwritefontface_IsSymbolFont(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)\n", This); - return !!(This->flags & FONTFACE_IS_SYMBOL); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p.\n", iface); + + return !!(fontface->flags & FONTFACE_IS_SYMBOL); }
-static void WINAPI dwritefontface_GetMetrics(IDWriteFontFace4 *iface, DWRITE_FONT_METRICS *metrics) +static void WINAPI dwritefontface_GetMetrics(IDWriteFontFace5 *iface, DWRITE_FONT_METRICS *metrics) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)->(%p)\n", This, metrics); - memcpy(metrics, &This->metrics, sizeof(*metrics)); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p, %p.\n", iface, metrics); + + memcpy(metrics, &fontface->metrics, sizeof(*metrics)); }
-static UINT16 WINAPI dwritefontface_GetGlyphCount(IDWriteFontFace4 *iface) +static UINT16 WINAPI dwritefontface_GetGlyphCount(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)\n", This); + TRACE("%p.\n", iface); + return freetype_get_glyphcount(iface); }
-static HRESULT WINAPI dwritefontface_GetDesignGlyphMetrics(IDWriteFontFace4 *iface, +static HRESULT WINAPI dwritefontface_GetDesignGlyphMetrics(IDWriteFontFace5 *iface, UINT16 const *glyphs, UINT32 glyph_count, DWRITE_GLYPH_METRICS *ret, BOOL is_sideways) { - struct dwrite_fontface *fontface = impl_from_IDWriteFontFace4(iface); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); unsigned int i; HRESULT hr;
@@ -644,50 +662,48 @@ static HRESULT fontface_get_glyphs(struct dwrite_fontface *fontface, UINT32 cons return E_INVALIDARG; }
- freetype_get_glyphs(&fontface->IDWriteFontFace4_iface, fontface->charmap, codepoints, count, glyphs); + freetype_get_glyphs(&fontface->IDWriteFontFace5_iface, fontface->charmap, codepoints, count, glyphs); return S_OK; }
-static HRESULT WINAPI dwritefontface_GetGlyphIndices(IDWriteFontFace4 *iface, UINT32 const *codepoints, +static HRESULT WINAPI dwritefontface_GetGlyphIndices(IDWriteFontFace5 *iface, UINT32 const *codepoints, UINT32 count, UINT16 *glyphs) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface);
- TRACE("(%p)->(%p %u %p)\n", This, codepoints, count, glyphs); + TRACE("%p, %p, %u, %p.\n", iface, codepoints, count, glyphs);
- return fontface_get_glyphs(This, codepoints, count, glyphs); + return fontface_get_glyphs(fontface, codepoints, count, glyphs); }
-static HRESULT WINAPI dwritefontface_TryGetFontTable(IDWriteFontFace4 *iface, UINT32 table_tag, +static HRESULT WINAPI dwritefontface_TryGetFontTable(IDWriteFontFace5 *iface, UINT32 table_tag, const void **table_data, UINT32 *table_size, void **context, BOOL *exists) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); struct file_stream_desc stream_desc;
- TRACE("(%p)->(%s %p %p %p %p)\n", This, debugstr_tag(table_tag), table_data, table_size, context, exists); + TRACE("%p, %s, %p, %p, %p, %p.\n", iface, debugstr_tag(table_tag), table_data, table_size, context, exists);
- stream_desc.stream = This->stream; - stream_desc.face_type = This->type; - stream_desc.face_index = This->index; + stream_desc.stream = fontface->stream; + stream_desc.face_type = fontface->type; + stream_desc.face_index = fontface->index; return opentype_get_font_table(&stream_desc, table_tag, table_data, context, table_size, exists); }
-static void WINAPI dwritefontface_ReleaseFontTable(IDWriteFontFace4 *iface, void *table_context) +static void WINAPI dwritefontface_ReleaseFontTable(IDWriteFontFace5 *iface, void *table_context) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface);
- TRACE("(%p)->(%p)\n", This, table_context); + TRACE("%p, %p.\n", iface, table_context);
- IDWriteFontFileStream_ReleaseFileFragment(This->stream, table_context); + IDWriteFontFileStream_ReleaseFileFragment(fontface->stream, table_context); }
-static HRESULT WINAPI dwritefontface_GetGlyphRunOutline(IDWriteFontFace4 *iface, FLOAT emSize, +static HRESULT WINAPI dwritefontface_GetGlyphRunOutline(IDWriteFontFace5 *iface, FLOAT emSize, UINT16 const *glyphs, FLOAT const* advances, DWRITE_GLYPH_OFFSET const *offsets, UINT32 count, BOOL is_sideways, BOOL is_rtl, IDWriteGeometrySink *sink) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - - TRACE("(%p)->(%.2f %p %p %p %u %d %d %p)\n", This, emSize, glyphs, advances, offsets, + TRACE("%p, %.8e, %p, %p, %p, %u, %d, %d, %p.\n", iface, emSize, glyphs, advances, offsets, count, is_sideways, is_rtl, sink);
if (!glyphs || !sink) @@ -727,14 +743,14 @@ static DWRITE_RENDERING_MODE fontface_renderingmode_from_measuringmode(DWRITE_ME return mode; }
-static HRESULT WINAPI dwritefontface_GetRecommendedRenderingMode(IDWriteFontFace4 *iface, FLOAT emSize, +static HRESULT WINAPI dwritefontface_GetRecommendedRenderingMode(IDWriteFontFace5 *iface, FLOAT emSize, FLOAT ppdip, DWRITE_MEASURING_MODE measuring, IDWriteRenderingParams *params, DWRITE_RENDERING_MODE *mode) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); unsigned int flags; FLOAT ppem;
- TRACE("(%p)->(%.2f %.2f %d %p %p)\n", This, emSize, ppdip, measuring, params, mode); + TRACE("%p, %.8e, %.8e, %d, %p, %p.\n", iface, emSize, ppdip, measuring, params, mode);
if (!params) { *mode = DWRITE_RENDERING_MODE_DEFAULT; @@ -752,16 +768,16 @@ static HRESULT WINAPI dwritefontface_GetRecommendedRenderingMode(IDWriteFontFace return S_OK; }
- flags = opentype_get_gasp_flags(get_fontface_gasp(This), ppem); + flags = opentype_get_gasp_flags(get_fontface_gasp(fontface), ppem); *mode = fontface_renderingmode_from_measuringmode(measuring, ppem, flags); return S_OK; }
-static HRESULT WINAPI dwritefontface_GetGdiCompatibleMetrics(IDWriteFontFace4 *iface, FLOAT emSize, FLOAT pixels_per_dip, +static HRESULT WINAPI dwritefontface_GetGdiCompatibleMetrics(IDWriteFontFace5 *iface, FLOAT emSize, FLOAT pixels_per_dip, DWRITE_MATRIX const *transform, DWRITE_FONT_METRICS *metrics) { DWRITE_FONT_METRICS1 metrics1; - HRESULT hr = IDWriteFontFace4_GetGdiCompatibleMetrics(iface, emSize, pixels_per_dip, transform, &metrics1); + HRESULT hr = IDWriteFontFace5_GetGdiCompatibleMetrics(iface, emSize, pixels_per_dip, transform, &metrics1); memcpy(metrics, &metrics1, sizeof(*metrics)); return hr; } @@ -779,25 +795,25 @@ static UINT32 fontface_get_horz_metric_adjustment(const struct dwrite_fontface * return (fontface->metrics.designUnitsPerEm + 49) / 50; }
-static HRESULT WINAPI dwritefontface_GetGdiCompatibleGlyphMetrics(IDWriteFontFace4 *iface, FLOAT emSize, FLOAT ppdip, +static HRESULT WINAPI dwritefontface_GetGdiCompatibleGlyphMetrics(IDWriteFontFace5 *iface, FLOAT emSize, FLOAT ppdip, DWRITE_MATRIX const *m, BOOL use_gdi_natural, UINT16 const *glyphs, UINT32 glyph_count, DWRITE_GLYPH_METRICS *metrics, BOOL is_sideways) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - UINT32 adjustment = fontface_get_horz_metric_adjustment(This); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + UINT32 adjustment = fontface_get_horz_metric_adjustment(fontface); DWRITE_MEASURING_MODE mode; FLOAT scale, size; HRESULT hr; UINT32 i;
- TRACE("(%p)->(%.2f %.2f %p %d %p %u %p %d)\n", This, emSize, ppdip, m, use_gdi_natural, glyphs, + TRACE("%p, %.8e, %.8e, %p, %d, %p, %u, %p, %d.\n", iface, emSize, ppdip, m, use_gdi_natural, glyphs, glyph_count, metrics, is_sideways);
if (m && memcmp(m, &identity, sizeof(*m))) FIXME("transform is not supported, %s\n", debugstr_matrix(m));
size = emSize * ppdip; - scale = size / This->metrics.designUnitsPerEm; + scale = size / fontface->metrics.designUnitsPerEm; mode = use_gdi_natural ? DWRITE_MEASURING_MODE_GDI_NATURAL : DWRITE_MEASURING_MODE_GDI_CLASSIC;
for (i = 0; i < glyph_count; i++) { @@ -805,15 +821,15 @@ static HRESULT WINAPI dwritefontface_GetGdiCompatibleGlyphMetrics(IDWriteFontFac DWRITE_GLYPH_METRICS design; BOOL has_contours;
- hr = IDWriteFontFace4_GetDesignGlyphMetrics(iface, glyphs + i, 1, &design, is_sideways); + hr = IDWriteFontFace5_GetDesignGlyphMetrics(iface, glyphs + i, 1, &design, is_sideways); if (FAILED(hr)) return hr;
ret->advanceWidth = freetype_get_glyph_advance(iface, size, glyphs[i], mode, &has_contours); if (has_contours) - ret->advanceWidth = round_metric(ret->advanceWidth * This->metrics.designUnitsPerEm / size + adjustment); + ret->advanceWidth = round_metric(ret->advanceWidth * fontface->metrics.designUnitsPerEm / size + adjustment); else - ret->advanceWidth = round_metric(ret->advanceWidth * This->metrics.designUnitsPerEm / size); + ret->advanceWidth = round_metric(ret->advanceWidth * fontface->metrics.designUnitsPerEm / size);
#define SCALE_METRIC(x) ret->x = round_metric(round_metric((design.x) * scale) / scale) SCALE_METRIC(leftSideBearing); @@ -828,22 +844,24 @@ static HRESULT WINAPI dwritefontface_GetGdiCompatibleGlyphMetrics(IDWriteFontFac return S_OK; }
-static void WINAPI dwritefontface1_GetMetrics(IDWriteFontFace4 *iface, DWRITE_FONT_METRICS1 *metrics) +static void WINAPI dwritefontface1_GetMetrics(IDWriteFontFace5 *iface, DWRITE_FONT_METRICS1 *metrics) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)->(%p)\n", This, metrics); - *metrics = This->metrics; + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p, %p.\n", iface, metrics); + + *metrics = fontface->metrics; }
-static HRESULT WINAPI dwritefontface1_GetGdiCompatibleMetrics(IDWriteFontFace4 *iface, FLOAT em_size, FLOAT pixels_per_dip, - const DWRITE_MATRIX *m, DWRITE_FONT_METRICS1 *metrics) +static HRESULT WINAPI dwritefontface1_GetGdiCompatibleMetrics(IDWriteFontFace5 *iface, FLOAT em_size, + FLOAT pixels_per_dip, const DWRITE_MATRIX *m, DWRITE_FONT_METRICS1 *metrics) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - const DWRITE_FONT_METRICS1 *design = &This->metrics; + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + const DWRITE_FONT_METRICS1 *design = &fontface->metrics; UINT16 ascent, descent; FLOAT scale;
- TRACE("(%p)->(%.2f %.2f %p %p)\n", This, em_size, pixels_per_dip, m, metrics); + TRACE("%p, %.8e, %.8e, %p, %p.\n", iface, em_size, pixels_per_dip, m, metrics);
if (em_size <= 0.0f || pixels_per_dip <= 0.0f) { memset(metrics, 0, sizeof(*metrics)); @@ -855,7 +873,8 @@ static HRESULT WINAPI dwritefontface1_GetGdiCompatibleMetrics(IDWriteFontFace4 * em_size *= fabs(m->m22);
scale = em_size / design->designUnitsPerEm; - if (!opentype_get_vdmx_size(get_fontface_vdmx(This), em_size, &ascent, &descent)) { + if (!opentype_get_vdmx_size(get_fontface_vdmx(fontface), em_size, &ascent, &descent)) + { ascent = round_metric(design->ascent * scale); descent = round_metric(design->descent * scale); } @@ -891,33 +910,37 @@ static HRESULT WINAPI dwritefontface1_GetGdiCompatibleMetrics(IDWriteFontFace4 * return S_OK; }
-static void WINAPI dwritefontface1_GetCaretMetrics(IDWriteFontFace4 *iface, DWRITE_CARET_METRICS *metrics) +static void WINAPI dwritefontface1_GetCaretMetrics(IDWriteFontFace5 *iface, DWRITE_CARET_METRICS *metrics) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)->(%p)\n", This, metrics); - *metrics = This->caret; + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p, %p.\n", iface, metrics); + + *metrics = fontface->caret; }
-static HRESULT WINAPI dwritefontface1_GetUnicodeRanges(IDWriteFontFace4 *iface, UINT32 max_count, +static HRESULT WINAPI dwritefontface1_GetUnicodeRanges(IDWriteFontFace5 *iface, UINT32 max_count, DWRITE_UNICODE_RANGE *ranges, UINT32 *count) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface);
- TRACE("(%p)->(%u %p %p)\n", This, max_count, ranges, count); + TRACE("%p, %u, %p, %p.\n", iface, max_count, ranges, count);
*count = 0; if (max_count && !ranges) return E_INVALIDARG;
- get_fontface_table(iface, MS_CMAP_TAG, &This->cmap); - return opentype_cmap_get_unicode_ranges(&This->cmap, max_count, ranges, count); + get_fontface_table(iface, MS_CMAP_TAG, &fontface->cmap); + return opentype_cmap_get_unicode_ranges(&fontface->cmap, max_count, ranges, count); }
-static BOOL WINAPI dwritefontface1_IsMonospacedFont(IDWriteFontFace4 *iface) +static BOOL WINAPI dwritefontface1_IsMonospacedFont(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)\n", This); - return !!(This->flags & FONTFACE_IS_MONOSPACED); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p.\n", iface); + + return !!(fontface->flags & FONTFACE_IS_MONOSPACED); }
static int fontface_get_design_advance(struct dwrite_fontface *fontface, DWRITE_MEASURING_MODE measuring_mode, @@ -933,7 +956,7 @@ static int fontface_get_design_advance(struct dwrite_fontface *fontface, DWRITE_ switch (measuring_mode) { case DWRITE_MEASURING_MODE_NATURAL: - advance = freetype_get_glyph_advance(&fontface->IDWriteFontFace4_iface, fontface->metrics.designUnitsPerEm, + advance = freetype_get_glyph_advance(&fontface->IDWriteFontFace5_iface, fontface->metrics.designUnitsPerEm, glyph, measuring_mode, &has_contours); if (has_contours) advance += adjustment; @@ -948,7 +971,7 @@ static int fontface_get_design_advance(struct dwrite_fontface *fontface, DWRITE_ if (transform && memcmp(transform, &identity, sizeof(*transform))) FIXME("Transform is not supported.\n");
- advance = freetype_get_glyph_advance(&fontface->IDWriteFontFace4_iface, emsize, glyph, measuring_mode, + advance = freetype_get_glyph_advance(&fontface->IDWriteFontFace5_iface, emsize, glyph, measuring_mode, &has_contours); if (has_contours) advance = round_metric(advance * fontface->metrics.designUnitsPerEm / emsize + adjustment); @@ -962,35 +985,35 @@ static int fontface_get_design_advance(struct dwrite_fontface *fontface, DWRITE_ } }
-static HRESULT WINAPI dwritefontface1_GetDesignGlyphAdvances(IDWriteFontFace4 *iface, +static HRESULT WINAPI dwritefontface1_GetDesignGlyphAdvances(IDWriteFontFace5 *iface, UINT32 glyph_count, UINT16 const *glyphs, INT32 *advances, BOOL is_sideways) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); unsigned int i;
- TRACE("(%p)->(%u %p %p %d)\n", This, glyph_count, glyphs, advances, is_sideways); + TRACE("%p, %u, %p, %p, %d.\n", iface, glyph_count, glyphs, advances, is_sideways);
if (is_sideways) FIXME("sideways mode not supported\n");
for (i = 0; i < glyph_count; ++i) { - advances[i] = fontface_get_design_advance(This, DWRITE_MEASURING_MODE_NATURAL, This->metrics.designUnitsPerEm, - 1.0f, NULL, glyphs[i], is_sideways); + advances[i] = fontface_get_design_advance(fontface, DWRITE_MEASURING_MODE_NATURAL, + fontface->metrics.designUnitsPerEm, 1.0f, NULL, glyphs[i], is_sideways); }
return S_OK; }
-static HRESULT WINAPI dwritefontface1_GetGdiCompatibleGlyphAdvances(IDWriteFontFace4 *iface, +static HRESULT WINAPI dwritefontface1_GetGdiCompatibleGlyphAdvances(IDWriteFontFace5 *iface, float em_size, float ppdip, const DWRITE_MATRIX *transform, BOOL use_gdi_natural, BOOL is_sideways, UINT32 glyph_count, UINT16 const *glyphs, INT32 *advances) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); DWRITE_MEASURING_MODE measuring_mode; UINT32 i;
- TRACE("(%p)->(%.2f %.2f %p %d %d %u %p %p)\n", This, em_size, ppdip, transform, + TRACE("%p, %.8e, %.8e, %p, %d, %d, %u, %p, %p.\n", iface, em_size, ppdip, transform, use_gdi_natural, is_sideways, glyph_count, glyphs, advances);
if (em_size < 0.0f || ppdip <= 0.0f) { @@ -1006,20 +1029,20 @@ static HRESULT WINAPI dwritefontface1_GetGdiCompatibleGlyphAdvances(IDWriteFontF measuring_mode = use_gdi_natural ? DWRITE_MEASURING_MODE_GDI_NATURAL : DWRITE_MEASURING_MODE_GDI_CLASSIC; for (i = 0; i < glyph_count; ++i) { - advances[i] = fontface_get_design_advance(This, measuring_mode, em_size, ppdip, transform, + advances[i] = fontface_get_design_advance(fontface, measuring_mode, em_size, ppdip, transform, glyphs[i], is_sideways); }
return S_OK; }
-static HRESULT WINAPI dwritefontface1_GetKerningPairAdjustments(IDWriteFontFace4 *iface, UINT32 count, +static HRESULT WINAPI dwritefontface1_GetKerningPairAdjustments(IDWriteFontFace5 *iface, UINT32 count, const UINT16 *indices, INT32 *adjustments) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); UINT32 i;
- TRACE("(%p)->(%u %p %p)\n", This, count, indices, adjustments); + TRACE("%p, %u, %p, %p.\n", iface, count, indices, adjustments);
if (!(indices || adjustments) || !count) return E_INVALIDARG; @@ -1029,7 +1052,8 @@ static HRESULT WINAPI dwritefontface1_GetKerningPairAdjustments(IDWriteFontFace4 return E_INVALIDARG; }
- if (!(This->flags & FONTFACE_HAS_KERNING_PAIRS)) { + if (!(fontface->flags & FONTFACE_HAS_KERNING_PAIRS)) + { memset(adjustments, 0, count*sizeof(INT32)); return S_OK; } @@ -1041,76 +1065,88 @@ static HRESULT WINAPI dwritefontface1_GetKerningPairAdjustments(IDWriteFontFace4 return S_OK; }
-static BOOL WINAPI dwritefontface1_HasKerningPairs(IDWriteFontFace4 *iface) +static BOOL WINAPI dwritefontface1_HasKerningPairs(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)\n", This); - return !!(This->flags & FONTFACE_HAS_KERNING_PAIRS); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p.\n", iface); + + return !!(fontface->flags & FONTFACE_HAS_KERNING_PAIRS); }
-static HRESULT WINAPI dwritefontface1_GetRecommendedRenderingMode(IDWriteFontFace4 *iface, +static HRESULT WINAPI dwritefontface1_GetRecommendedRenderingMode(IDWriteFontFace5 *iface, FLOAT font_emsize, FLOAT dpiX, FLOAT dpiY, const DWRITE_MATRIX *transform, BOOL is_sideways, DWRITE_OUTLINE_THRESHOLD threshold, DWRITE_MEASURING_MODE measuring_mode, DWRITE_RENDERING_MODE *rendering_mode) { DWRITE_GRID_FIT_MODE gridfitmode; - return IDWriteFontFace2_GetRecommendedRenderingMode((IDWriteFontFace2*)iface, font_emsize, dpiX, dpiY, transform, is_sideways, - threshold, measuring_mode, NULL, rendering_mode, &gridfitmode); + return IDWriteFontFace2_GetRecommendedRenderingMode((IDWriteFontFace2 *)iface, font_emsize, dpiX, dpiY, transform, + is_sideways, threshold, measuring_mode, NULL, rendering_mode, &gridfitmode); }
-static HRESULT WINAPI dwritefontface1_GetVerticalGlyphVariants(IDWriteFontFace4 *iface, UINT32 glyph_count, +static HRESULT WINAPI dwritefontface1_GetVerticalGlyphVariants(IDWriteFontFace5 *iface, UINT32 glyph_count, const UINT16 *nominal_indices, UINT16 *vertical_indices) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - FIXME("(%p)->(%u %p %p): stub\n", This, glyph_count, nominal_indices, vertical_indices); + FIXME("%p, %u, %p, %p: stub\n", iface, glyph_count, nominal_indices, vertical_indices); + return E_NOTIMPL; }
-static BOOL WINAPI dwritefontface1_HasVerticalGlyphVariants(IDWriteFontFace4 *iface) +static BOOL WINAPI dwritefontface1_HasVerticalGlyphVariants(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)\n", This); - return !!(This->flags & FONTFACE_HAS_VERTICAL_VARIANTS); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p.\n", iface); + + return !!(fontface->flags & FONTFACE_HAS_VERTICAL_VARIANTS); }
-static BOOL WINAPI dwritefontface2_IsColorFont(IDWriteFontFace4 *iface) +static BOOL WINAPI dwritefontface2_IsColorFont(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)\n", This); - return get_fontface_cpal(This) && get_fontface_colr(This); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p.\n", iface); + + return get_fontface_cpal(fontface) && get_fontface_colr(fontface); }
-static UINT32 WINAPI dwritefontface2_GetColorPaletteCount(IDWriteFontFace4 *iface) +static UINT32 WINAPI dwritefontface2_GetColorPaletteCount(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)\n", This); - return opentype_get_cpal_palettecount(get_fontface_cpal(This)); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p.\n", iface); + + return opentype_get_cpal_palettecount(get_fontface_cpal(fontface)); }
-static UINT32 WINAPI dwritefontface2_GetPaletteEntryCount(IDWriteFontFace4 *iface) +static UINT32 WINAPI dwritefontface2_GetPaletteEntryCount(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)\n", This); - return opentype_get_cpal_paletteentrycount(get_fontface_cpal(This)); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p.\n", iface); + + return opentype_get_cpal_paletteentrycount(get_fontface_cpal(fontface)); }
-static HRESULT WINAPI dwritefontface2_GetPaletteEntries(IDWriteFontFace4 *iface, UINT32 palette_index, +static HRESULT WINAPI dwritefontface2_GetPaletteEntries(IDWriteFontFace5 *iface, UINT32 palette_index, UINT32 first_entry_index, UINT32 entry_count, DWRITE_COLOR_F *entries) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)->(%u %u %u %p)\n", This, palette_index, first_entry_index, entry_count, entries); - return opentype_get_cpal_entries(get_fontface_cpal(This), palette_index, first_entry_index, entry_count, entries); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p, %u, %u, %u, %p.\n", iface, palette_index, first_entry_index, entry_count, entries); + + return opentype_get_cpal_entries(get_fontface_cpal(fontface), palette_index, first_entry_index, entry_count, entries); }
-static HRESULT WINAPI dwritefontface2_GetRecommendedRenderingMode(IDWriteFontFace4 *iface, FLOAT emSize, +static HRESULT WINAPI dwritefontface2_GetRecommendedRenderingMode(IDWriteFontFace5 *iface, FLOAT emSize, FLOAT dpiX, FLOAT dpiY, DWRITE_MATRIX const *m, BOOL is_sideways, DWRITE_OUTLINE_THRESHOLD threshold, DWRITE_MEASURING_MODE measuringmode, IDWriteRenderingParams *params, DWRITE_RENDERING_MODE *renderingmode, DWRITE_GRID_FIT_MODE *gridfitmode) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); unsigned int flags; FLOAT emthreshold;
- TRACE("(%p)->(%.2f %.2f %.2f %p %d %d %d %p %p %p)\n", This, emSize, dpiX, dpiY, m, is_sideways, threshold, + TRACE("%p, %.8e, %.8e, %.8e, %p, %d, %d, %d, %p, %p, %p.\n", iface, emSize, dpiX, dpiY, m, is_sideways, threshold, measuringmode, params, renderingmode, gridfitmode);
if (m) @@ -1139,7 +1175,7 @@ static HRESULT WINAPI dwritefontface2_GetRecommendedRenderingMode(IDWriteFontFac
emthreshold = threshold == DWRITE_OUTLINE_THRESHOLD_ANTIALIASED ? RECOMMENDED_OUTLINE_AA_THRESHOLD : RECOMMENDED_OUTLINE_A_THRESHOLD;
- flags = opentype_get_gasp_flags(get_fontface_gasp(This), emSize); + flags = opentype_get_gasp_flags(get_fontface_gasp(fontface), emSize);
if (*renderingmode == DWRITE_RENDERING_MODE_DEFAULT) { if (emSize >= emthreshold) @@ -1161,86 +1197,94 @@ static HRESULT WINAPI dwritefontface2_GetRecommendedRenderingMode(IDWriteFontFac return S_OK; }
-static HRESULT WINAPI dwritefontface3_GetFontFaceReference(IDWriteFontFace4 *iface, IDWriteFontFaceReference **ref) +static HRESULT WINAPI dwritefontface3_GetFontFaceReference(IDWriteFontFace5 *iface, IDWriteFontFaceReference **ref) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - FIXME("(%p)->(%p): stub\n", This, ref); + FIXME("%p, %p: stub\n", iface, ref); + return E_NOTIMPL; }
-static void WINAPI dwritefontface3_GetPanose(IDWriteFontFace4 *iface, DWRITE_PANOSE *panose) +static void WINAPI dwritefontface3_GetPanose(IDWriteFontFace5 *iface, DWRITE_PANOSE *panose) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)->(%p)\n", This, panose); - *panose = This->panose; + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p, %p.\n", iface, panose); + + *panose = fontface->panose; }
-static DWRITE_FONT_WEIGHT WINAPI dwritefontface3_GetWeight(IDWriteFontFace4 *iface) +static DWRITE_FONT_WEIGHT WINAPI dwritefontface3_GetWeight(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)\n", This); - return This->weight; + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p.\n", iface); + + return fontface->weight; }
-static DWRITE_FONT_STRETCH WINAPI dwritefontface3_GetStretch(IDWriteFontFace4 *iface) +static DWRITE_FONT_STRETCH WINAPI dwritefontface3_GetStretch(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)\n", This); - return This->stretch; + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p.\n", iface); + + return fontface->stretch; }
-static DWRITE_FONT_STYLE WINAPI dwritefontface3_GetStyle(IDWriteFontFace4 *iface) +static DWRITE_FONT_STYLE WINAPI dwritefontface3_GetStyle(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - TRACE("(%p)\n", This); - return This->style; + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); + + TRACE("%p.\n", iface); + + return fontface->style; }
-static HRESULT WINAPI dwritefontface3_GetFamilyNames(IDWriteFontFace4 *iface, IDWriteLocalizedStrings **names) +static HRESULT WINAPI dwritefontface3_GetFamilyNames(IDWriteFontFace5 *iface, IDWriteLocalizedStrings **names) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - FIXME("(%p)->(%p): stub\n", This, names); + FIXME("%p, %p: stub\n", iface, names); + return E_NOTIMPL; }
-static HRESULT WINAPI dwritefontface3_GetFaceNames(IDWriteFontFace4 *iface, IDWriteLocalizedStrings **names) +static HRESULT WINAPI dwritefontface3_GetFaceNames(IDWriteFontFace5 *iface, IDWriteLocalizedStrings **names) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - FIXME("(%p)->(%p): stub\n", This, names); + FIXME("%p, %p: stub\n", iface, names); + return E_NOTIMPL; }
-static HRESULT WINAPI dwritefontface3_GetInformationalStrings(IDWriteFontFace4 *iface, DWRITE_INFORMATIONAL_STRING_ID stringid, - IDWriteLocalizedStrings **strings, BOOL *exists) +static HRESULT WINAPI dwritefontface3_GetInformationalStrings(IDWriteFontFace5 *iface, + DWRITE_INFORMATIONAL_STRING_ID stringid, IDWriteLocalizedStrings **strings, BOOL *exists) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - FIXME("(%p)->(%u %p %p): stub\n", This, stringid, strings, exists); + FIXME("%p, %u, %p, %p: stub\n", iface, stringid, strings, exists); + return E_NOTIMPL; }
-static BOOL WINAPI dwritefontface3_HasCharacter(IDWriteFontFace4 *iface, UINT32 ch) +static BOOL WINAPI dwritefontface3_HasCharacter(IDWriteFontFace5 *iface, UINT32 ch) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); UINT16 index;
- TRACE("(%p)->(%#x)\n", This, ch); + TRACE("%p, %#x.\n", iface, ch);
index = 0; - if (FAILED(fontface_get_glyphs(This, &ch, 1, &index))) + if (FAILED(fontface_get_glyphs(fontface, &ch, 1, &index))) return FALSE;
return index != 0; }
-static HRESULT WINAPI dwritefontface3_GetRecommendedRenderingMode(IDWriteFontFace4 *iface, FLOAT emSize, FLOAT dpiX, FLOAT dpiY, +static HRESULT WINAPI dwritefontface3_GetRecommendedRenderingMode(IDWriteFontFace5 *iface, FLOAT emSize, FLOAT dpiX, FLOAT dpiY, DWRITE_MATRIX const *m, BOOL is_sideways, DWRITE_OUTLINE_THRESHOLD threshold, DWRITE_MEASURING_MODE measuring_mode, IDWriteRenderingParams *params, DWRITE_RENDERING_MODE1 *rendering_mode, DWRITE_GRID_FIT_MODE *gridfit_mode) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface); unsigned int flags; FLOAT emthreshold;
- TRACE("(%p)->(%.2f %.2f %.2f %p %d %d %d %p %p %p)\n", This, emSize, dpiX, dpiY, m, is_sideways, threshold, + TRACE("%p, %.8e, %.8e, %.8e, %p, %d, %d, %d, %p, %p, %p.\n", iface, emSize, dpiX, dpiY, m, is_sideways, threshold, measuring_mode, params, rendering_mode, gridfit_mode);
if (m) @@ -1269,7 +1313,7 @@ static HRESULT WINAPI dwritefontface3_GetRecommendedRenderingMode(IDWriteFontFac
emthreshold = threshold == DWRITE_OUTLINE_THRESHOLD_ANTIALIASED ? RECOMMENDED_OUTLINE_AA_THRESHOLD : RECOMMENDED_OUTLINE_A_THRESHOLD;
- flags = opentype_get_gasp_flags(get_fontface_gasp(This), emSize); + flags = opentype_get_gasp_flags(get_fontface_gasp(fontface), emSize);
if (*rendering_mode == DWRITE_RENDERING_MODE1_DEFAULT) { if (emSize >= emthreshold) @@ -1291,68 +1335,97 @@ static HRESULT WINAPI dwritefontface3_GetRecommendedRenderingMode(IDWriteFontFac return S_OK; }
-static BOOL WINAPI dwritefontface3_IsCharacterLocal(IDWriteFontFace4 *iface, UINT32 ch) +static BOOL WINAPI dwritefontface3_IsCharacterLocal(IDWriteFontFace5 *iface, UINT32 ch) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - FIXME("(%p)->(0x%x): stub\n", This, ch); + FIXME("%p, %#x: stub\n", iface, ch); + return FALSE; }
-static BOOL WINAPI dwritefontface3_IsGlyphLocal(IDWriteFontFace4 *iface, UINT16 glyph) +static BOOL WINAPI dwritefontface3_IsGlyphLocal(IDWriteFontFace5 *iface, UINT16 glyph) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - FIXME("(%p)->(%u): stub\n", This, glyph); + FIXME("%p, %u: stub\n", iface, glyph); + return FALSE; }
-static HRESULT WINAPI dwritefontface3_AreCharactersLocal(IDWriteFontFace4 *iface, WCHAR const *text, +static HRESULT WINAPI dwritefontface3_AreCharactersLocal(IDWriteFontFace5 *iface, WCHAR const *text, UINT32 count, BOOL enqueue_if_not, BOOL *are_local) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - FIXME("(%p)->(%s:%u %d %p): stub\n", This, debugstr_wn(text, count), count, enqueue_if_not, are_local); + FIXME("%p, %s:%u, %d %p: stub\n", iface, debugstr_wn(text, count), count, enqueue_if_not, are_local); + return E_NOTIMPL; }
-static HRESULT WINAPI dwritefontface3_AreGlyphsLocal(IDWriteFontFace4 *iface, UINT16 const *glyphs, +static HRESULT WINAPI dwritefontface3_AreGlyphsLocal(IDWriteFontFace5 *iface, UINT16 const *glyphs, UINT32 count, BOOL enqueue_if_not, BOOL *are_local) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - FIXME("(%p)->(%p %u %d %p): stub\n", This, glyphs, count, enqueue_if_not, are_local); + FIXME("%p, %p, %u, %d, %p: stub\n", iface, glyphs, count, enqueue_if_not, are_local); + return E_NOTIMPL; }
-static HRESULT WINAPI dwritefontface4_GetGlyphImageFormats_(IDWriteFontFace4 *iface, UINT16 glyph, +static HRESULT WINAPI dwritefontface4_GetGlyphImageFormats_(IDWriteFontFace5 *iface, UINT16 glyph, UINT32 ppem_first, UINT32 ppem_last, DWRITE_GLYPH_IMAGE_FORMATS *formats) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - FIXME("(%p)->(%u %u %u %p): stub\n", This, glyph, ppem_first, ppem_last, formats); + FIXME("%p, %u, %u, %u, %p: stub\n", iface, glyph, ppem_first, ppem_last, formats); + return E_NOTIMPL; }
-static DWRITE_GLYPH_IMAGE_FORMATS WINAPI dwritefontface4_GetGlyphImageFormats(IDWriteFontFace4 *iface) +static DWRITE_GLYPH_IMAGE_FORMATS WINAPI dwritefontface4_GetGlyphImageFormats(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); + struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface);
- TRACE("(%p)\n", This); + TRACE("%p.\n", iface);
- return This->glyph_image_formats; + return fontface->glyph_image_formats; }
-static HRESULT WINAPI dwritefontface4_GetGlyphImageData(IDWriteFontFace4 *iface, UINT16 glyph, +static HRESULT WINAPI dwritefontface4_GetGlyphImageData(IDWriteFontFace5 *iface, UINT16 glyph, UINT32 ppem, DWRITE_GLYPH_IMAGE_FORMATS format, DWRITE_GLYPH_IMAGE_DATA *data, void **context) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - FIXME("(%p)->(%u %u %d %p %p): stub\n", This, glyph, ppem, format, data, context); + FIXME("%p, %u, %u, %d, %p, %p: stub\n", iface, glyph, ppem, format, data, context); + + return E_NOTIMPL; +} + +static void WINAPI dwritefontface4_ReleaseGlyphImageData(IDWriteFontFace5 *iface, void *context) +{ + FIXME("%p, %p: stub\n", iface, context); +} + +static UINT32 WINAPI dwritefontface5_GetFontAxisValueCount(IDWriteFontFace5 *iface) +{ + FIXME("%p: stub\n", iface); + + return 0; +} + +static HRESULT WINAPI dwritefontface5_GetFontAxisValues(IDWriteFontFace5 *iface, DWRITE_FONT_AXIS_VALUE *axis_values, + UINT32 value_count) +{ + FIXME("%p, %p, %u: stub\n", iface, axis_values, value_count); + return E_NOTIMPL; }
-static void WINAPI dwritefontface4_ReleaseGlyphImageData(IDWriteFontFace4 *iface, void *context) +static BOOL WINAPI dwritefontface5_HasVariantions(IDWriteFontFace5 *iface) { - struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface); - FIXME("(%p)->(%p): stub\n", This, context); + FIXME("%p: stub\n", iface); + + return FALSE; }
-static const IDWriteFontFace4Vtbl dwritefontfacevtbl = { +static HRESULT WINAPI dwritefontface5_GetFontResource(IDWriteFontFace5 *iface, IDWriteFontResource **resource) +{ + FIXME("%p, %p: stub\n", iface, resource); + + return E_NOTIMPL; +} + +static const IDWriteFontFace5Vtbl dwritefontfacevtbl = +{ dwritefontface_QueryInterface, dwritefontface_AddRef, dwritefontface_Release, @@ -1405,10 +1478,14 @@ static const IDWriteFontFace4Vtbl dwritefontfacevtbl = { dwritefontface4_GetGlyphImageFormats_, dwritefontface4_GetGlyphImageFormats, dwritefontface4_GetGlyphImageData, - dwritefontface4_ReleaseGlyphImageData + dwritefontface4_ReleaseGlyphImageData, + dwritefontface5_GetFontAxisValueCount, + dwritefontface5_GetFontAxisValues, + dwritefontface5_HasVariantions, + dwritefontface5_GetFontResource, };
-static HRESULT get_fontface_from_font(struct dwrite_font *font, IDWriteFontFace4 **fontface) +static HRESULT get_fontface_from_font(struct dwrite_font *font, IDWriteFontFace5 **fontface) { struct dwrite_font_data *data = font->data; struct fontface_desc desc; @@ -1518,19 +1595,19 @@ static DWRITE_FONT_STYLE WINAPI dwritefont_GetStyle(IDWriteFont3 *iface)
static BOOL WINAPI dwritefont_IsSymbolFont(IDWriteFont3 *iface) { - struct dwrite_font *This = impl_from_IDWriteFont3(iface); - IDWriteFontFace4 *fontface; + struct dwrite_font *font = impl_from_IDWriteFont3(iface); + IDWriteFontFace5 *fontface; HRESULT hr; BOOL ret;
- TRACE("(%p)\n", This); + TRACE("%p.\n", iface);
- hr = get_fontface_from_font(This, &fontface); + hr = get_fontface_from_font(font, &fontface); if (FAILED(hr)) return FALSE;
- ret = IDWriteFontFace4_IsSymbolFont(fontface); - IDWriteFontFace4_Release(fontface); + ret = IDWriteFontFace5_IsSymbolFont(fontface); + IDWriteFontFace5_Release(fontface); return ret; }
@@ -1544,11 +1621,11 @@ static HRESULT WINAPI dwritefont_GetFaceNames(IDWriteFont3 *iface, IDWriteLocali static HRESULT WINAPI dwritefont_GetInformationalStrings(IDWriteFont3 *iface, DWRITE_INFORMATIONAL_STRING_ID stringid, IDWriteLocalizedStrings **strings, BOOL *exists) { - struct dwrite_font *This = impl_from_IDWriteFont3(iface); - struct dwrite_font_data *data = This->data; + struct dwrite_font *font = impl_from_IDWriteFont3(iface); + struct dwrite_font_data *data = font->data; HRESULT hr;
- TRACE("(%p)->(%d %p %p)\n", This, stringid, strings, exists); + TRACE("%p, %d, %p, %p.\n", iface, stringid, strings, exists);
*exists = FALSE; *strings = NULL; @@ -1556,29 +1633,31 @@ static HRESULT WINAPI dwritefont_GetInformationalStrings(IDWriteFont3 *iface, if (stringid > DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_CID_NAME || stringid == DWRITE_INFORMATIONAL_STRING_NONE) return S_OK;
- if (!data->info_strings[stringid]) { - IDWriteFontFace4 *fontface; + if (!data->info_strings[stringid]) + { + IDWriteFontFace5 *fontface; const void *table_data; BOOL table_exists; void *context; UINT32 size;
- hr = get_fontface_from_font(This, &fontface); + hr = get_fontface_from_font(font, &fontface); if (FAILED(hr)) return hr;
table_exists = FALSE; - hr = IDWriteFontFace4_TryGetFontTable(fontface, MS_NAME_TAG, &table_data, &size, &context, &table_exists); + hr = IDWriteFontFace5_TryGetFontTable(fontface, MS_NAME_TAG, &table_data, &size, &context, &table_exists); if (FAILED(hr) || !table_exists) WARN("no NAME table found.\n");
- if (table_exists) { + if (table_exists) + { hr = opentype_get_font_info_strings(table_data, stringid, &data->info_strings[stringid]); - IDWriteFontFace4_ReleaseFontTable(fontface, context); + IDWriteFontFace5_ReleaseFontTable(fontface, context); if (FAILED(hr) || !data->info_strings[stringid]) return hr; } - IDWriteFontFace4_Release(fontface); + IDWriteFontFace5_Release(fontface); }
hr = clone_localizedstring(data->info_strings[stringid], strings); @@ -1606,7 +1685,7 @@ static void WINAPI dwritefont_GetMetrics(IDWriteFont3 *iface, DWRITE_FONT_METRIC
static HRESULT font_has_character(struct dwrite_font *font, UINT32 ch, BOOL *exists) { - IDWriteFontFace4 *fontface; + IDWriteFontFace5 *fontface; UINT16 index; HRESULT hr;
@@ -1617,8 +1696,8 @@ static HRESULT font_has_character(struct dwrite_font *font, UINT32 ch, BOOL *exi return hr;
index = 0; - hr = IDWriteFontFace4_GetGlyphIndices(fontface, &ch, 1, &index); - IDWriteFontFace4_Release(fontface); + hr = IDWriteFontFace5_GetGlyphIndices(fontface, &ch, 1, &index); + IDWriteFontFace5_Release(fontface); if (FAILED(hr)) return hr;
@@ -1637,9 +1716,11 @@ static HRESULT WINAPI dwritefont_HasCharacter(IDWriteFont3 *iface, UINT32 ch, BO
static HRESULT WINAPI dwritefont_CreateFontFace(IDWriteFont3 *iface, IDWriteFontFace **fontface) { - struct dwrite_font *This = impl_from_IDWriteFont3(iface); - TRACE("(%p)->(%p)\n", This, fontface); - return get_fontface_from_font(This, (IDWriteFontFace4 **)fontface); + struct dwrite_font *font = impl_from_IDWriteFont3(iface); + + TRACE("%p, %p.\n", iface, fontface); + + return get_fontface_from_font(font, (IDWriteFontFace5 **)fontface); }
static void WINAPI dwritefont1_GetMetrics(IDWriteFont3 *iface, DWRITE_FONT_METRICS1 *metrics) @@ -1658,64 +1739,64 @@ static void WINAPI dwritefont1_GetPanose(IDWriteFont3 *iface, DWRITE_PANOSE *pan
static HRESULT WINAPI dwritefont1_GetUnicodeRanges(IDWriteFont3 *iface, UINT32 max_count, DWRITE_UNICODE_RANGE *ranges, UINT32 *count) { - struct dwrite_font *This = impl_from_IDWriteFont3(iface); - IDWriteFontFace4 *fontface; + struct dwrite_font *font = impl_from_IDWriteFont3(iface); + IDWriteFontFace5 *fontface; HRESULT hr;
- TRACE("(%p)->(%u %p %p)\n", This, max_count, ranges, count); + TRACE("%p, %u, %p, %p.\n", iface, max_count, ranges, count);
- hr = get_fontface_from_font(This, &fontface); + hr = get_fontface_from_font(font, &fontface); if (FAILED(hr)) return hr;
- hr = IDWriteFontFace4_GetUnicodeRanges(fontface, max_count, ranges, count); - IDWriteFontFace4_Release(fontface); + hr = IDWriteFontFace5_GetUnicodeRanges(fontface, max_count, ranges, count); + IDWriteFontFace5_Release(fontface); return hr; }
static BOOL WINAPI dwritefont1_IsMonospacedFont(IDWriteFont3 *iface) { - struct dwrite_font *This = impl_from_IDWriteFont3(iface); - IDWriteFontFace4 *fontface; + struct dwrite_font *font = impl_from_IDWriteFont3(iface); + IDWriteFontFace5 *fontface; HRESULT hr; BOOL ret;
- TRACE("(%p)\n", This); + TRACE("%p.\n", iface);
- hr = get_fontface_from_font(This, &fontface); + hr = get_fontface_from_font(font, &fontface); if (FAILED(hr)) return FALSE;
- ret = IDWriteFontFace4_IsMonospacedFont(fontface); - IDWriteFontFace4_Release(fontface); + ret = IDWriteFontFace5_IsMonospacedFont(fontface); + IDWriteFontFace5_Release(fontface); return ret; }
static BOOL WINAPI dwritefont2_IsColorFont(IDWriteFont3 *iface) { - struct dwrite_font *This = impl_from_IDWriteFont3(iface); - IDWriteFontFace4 *fontface; + struct dwrite_font *font = impl_from_IDWriteFont3(iface); + IDWriteFontFace5 *fontface; HRESULT hr; BOOL ret;
- TRACE("(%p)\n", This); + TRACE("%p.\n", iface);
- hr = get_fontface_from_font(This, &fontface); + hr = get_fontface_from_font(font, &fontface); if (FAILED(hr)) return FALSE;
- ret = IDWriteFontFace4_IsColorFont(fontface); - IDWriteFontFace4_Release(fontface); + ret = IDWriteFontFace5_IsColorFont(fontface); + IDWriteFontFace5_Release(fontface); return ret; }
static HRESULT WINAPI dwritefont3_CreateFontFace(IDWriteFont3 *iface, IDWriteFontFace3 **fontface) { - struct dwrite_font *This = impl_from_IDWriteFont3(iface); + struct dwrite_font *font = impl_from_IDWriteFont3(iface);
- TRACE("(%p)->(%p)\n", This, fontface); + TRACE("%p, %p.\n", iface, fontface);
- return get_fontface_from_font(This, (IDWriteFontFace4 **)fontface); + return get_fontface_from_font(font, (IDWriteFontFace5 **)fontface); }
static BOOL WINAPI dwritefont3_Equals(IDWriteFont3 *iface, IDWriteFont *font) @@ -1792,7 +1873,7 @@ struct dwrite_fontface *unsafe_impl_from_IDWriteFontFace(IDWriteFontFace *iface) if (!iface) return NULL; assert(iface->lpVtbl == (IDWriteFontFaceVtbl*)&dwritefontfacevtbl); - return CONTAINING_RECORD(iface, struct dwrite_fontface, IDWriteFontFace4_iface); + return CONTAINING_RECORD(iface, struct dwrite_fontface, IDWriteFontFace5_iface); }
void get_logfont_from_font(IDWriteFont *iface, LOGFONTW *lf) @@ -4532,7 +4613,7 @@ HRESULT create_font_file(IDWriteFontFileLoader *loader, const void *reference_ke return S_OK; }
-HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_list, IDWriteFontFace4 **ret) +HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_list, IDWriteFontFace5 **ret) { struct file_stream_desc stream_desc; struct dwrite_fontface *fontface; @@ -4552,8 +4633,8 @@ HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_li return E_OUTOFMEMORY; }
- fontface->IDWriteFontFace4_iface.lpVtbl = &dwritefontfacevtbl; - fontface->ref = 1; + fontface->IDWriteFontFace5_iface.lpVtbl = &dwritefontfacevtbl; + fontface->refcount = 1; fontface->type = desc->face_type; fontface->file_count = desc->files_number; fontface->cmap.exists = TRUE; @@ -4585,16 +4666,16 @@ HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_li } }
- fontface->charmap = freetype_get_charmap_index(&fontface->IDWriteFontFace4_iface, &is_symbol); + fontface->charmap = freetype_get_charmap_index(&fontface->IDWriteFontFace5_iface, &is_symbol); if (is_symbol) fontface->flags |= FONTFACE_IS_SYMBOL; - if (freetype_has_kerning_pairs(&fontface->IDWriteFontFace4_iface)) + if (freetype_has_kerning_pairs(&fontface->IDWriteFontFace5_iface)) fontface->flags |= FONTFACE_HAS_KERNING_PAIRS; - if (freetype_is_monospaced(&fontface->IDWriteFontFace4_iface)) + if (freetype_is_monospaced(&fontface->IDWriteFontFace5_iface)) fontface->flags |= FONTFACE_IS_MONOSPACED; - if (opentype_has_vertical_variants(&fontface->IDWriteFontFace4_iface)) + if (opentype_has_vertical_variants(&fontface->IDWriteFontFace5_iface)) fontface->flags |= FONTFACE_HAS_VERTICAL_VARIANTS; - fontface->glyph_image_formats = opentype_get_glyph_image_formats(&fontface->IDWriteFontFace4_iface); + fontface->glyph_image_formats = opentype_get_glyph_image_formats(&fontface->IDWriteFontFace5_iface);
/* Font properties are reused from font object when 'normal' face creation path is used: collection -> family -> matching font -> fontface. @@ -4614,8 +4695,9 @@ HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_li struct dwrite_font_data *data;
hr = init_font_data(desc, &names, &data); - if (FAILED(hr)) { - IDWriteFontFace4_Release(&fontface->IDWriteFontFace4_iface); + if (FAILED(hr)) + { + IDWriteFontFace5_Release(&fontface->IDWriteFontFace5_iface); return hr; }
@@ -4630,9 +4712,10 @@ HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_li release_font_data(data); }
- fontface->cached = factory_cache_fontface(fontface->factory, cached_list, &fontface->IDWriteFontFace4_iface); + fontface->cached = factory_cache_fontface(fontface->factory, cached_list, &fontface->IDWriteFontFace5_iface); + + *ret = &fontface->IDWriteFontFace5_iface;
- *ret = &fontface->IDWriteFontFace4_iface; return S_OK; }
@@ -5670,8 +5753,8 @@ static ULONG WINAPI colorglyphenum_Release(IDWriteColorGlyphRunEnumerator1 *ifac heap_free(glyphenum->glyphindices); heap_free(glyphenum->glyphs); if (glyphenum->colr.context) - IDWriteFontFace4_ReleaseFontTable(glyphenum->fontface, glyphenum->colr.context); - IDWriteFontFace4_Release(glyphenum->fontface); + IDWriteFontFace5_ReleaseFontTable(glyphenum->fontface, glyphenum->colr.context); + IDWriteFontFace5_Release(glyphenum->fontface); heap_free(glyphenum); }
@@ -5744,9 +5827,10 @@ static BOOL colorglyphenum_build_color_run(struct dwrite_colorglyphenum *glyphen colorrun->paletteIndex = glyphenum->glyphs[g].palette_index; /* use foreground color or request one from the font */ memset(&colorrun->runColor, 0, sizeof(colorrun->runColor)); - if (colorrun->paletteIndex != 0xffff) { - HRESULT hr = IDWriteFontFace4_GetPaletteEntries(glyphenum->fontface, glyphenum->palette, colorrun->paletteIndex, - 1, &colorrun->runColor); + if (colorrun->paletteIndex != 0xffff) + { + HRESULT hr = IDWriteFontFace5_GetPaletteEntries(glyphenum->fontface, glyphenum->palette, + colorrun->paletteIndex, 1, &colorrun->runColor); if (FAILED(hr)) WARN("failed to get palette entry, fontface %p, palette %u, index %u, 0x%08x\n", glyphenum->fontface, glyphenum->palette, colorrun->paletteIndex, hr); @@ -5857,8 +5941,8 @@ HRESULT create_colorglyphenum(float originX, float originY, const DWRITE_GLYPH_R
fontface = unsafe_impl_from_IDWriteFontFace(run->fontFace);
- colorfont = IDWriteFontFace4_IsColorFont(&fontface->IDWriteFontFace4_iface) && - IDWriteFontFace4_GetColorPaletteCount(&fontface->IDWriteFontFace4_iface) > palette; + colorfont = IDWriteFontFace5_IsColorFont(&fontface->IDWriteFontFace5_iface) && + IDWriteFontFace5_GetColorPaletteCount(&fontface->IDWriteFontFace5_iface) > palette; if (!colorfont) return DWRITE_E_NOCOLOR;
@@ -5870,8 +5954,8 @@ HRESULT create_colorglyphenum(float originX, float originY, const DWRITE_GLYPH_R colorglyphenum->refcount = 1; colorglyphenum->origin_x = originX; colorglyphenum->origin_y = originY; - colorglyphenum->fontface = &fontface->IDWriteFontFace4_iface; - IDWriteFontFace4_AddRef(colorglyphenum->fontface); + colorglyphenum->fontface = &fontface->IDWriteFontFace5_iface; + IDWriteFontFace5_AddRef(colorglyphenum->fontface); colorglyphenum->glyphs = NULL; colorglyphenum->run = *run; colorglyphenum->run.glyphIndices = NULL; @@ -5880,7 +5964,7 @@ HRESULT create_colorglyphenum(float originX, float originY, const DWRITE_GLYPH_R colorglyphenum->palette = palette; memset(&colorglyphenum->colr, 0, sizeof(colorglyphenum->colr)); colorglyphenum->colr.exists = TRUE; - get_fontface_table(&fontface->IDWriteFontFace4_iface, MS_COLR_TAG, &colorglyphenum->colr); + get_fontface_table(&fontface->IDWriteFontFace5_iface, MS_COLR_TAG, &colorglyphenum->colr); colorglyphenum->current_layer = 0; colorglyphenum->max_layer_num = 0;
diff --git a/dlls/dwrite/freetype.c b/dlls/dwrite/freetype.c index 16317036e3..ffc97f1d8a 100644 --- a/dlls/dwrite/freetype.c +++ b/dlls/dwrite/freetype.c @@ -256,7 +256,7 @@ void release_freetype(void) pFT_Done_FreeType(library); }
-void freetype_notify_cacheremove(IDWriteFontFace4 *fontface) +void freetype_notify_cacheremove(IDWriteFontFace5 *fontface) { EnterCriticalSection(&freetype_cs); pFTC_Manager_RemoveFaceID(cache_manager, fontface); @@ -268,7 +268,7 @@ HRESULT freetype_get_design_glyph_metrics(struct dwrite_fontface *fontface, UINT FTC_ScalerRec scaler; FT_Size size;
- scaler.face_id = &fontface->IDWriteFontFace4_iface; + scaler.face_id = &fontface->IDWriteFontFace5_iface; scaler.width = fontface->metrics.designUnitsPerEm; scaler.height = fontface->metrics.designUnitsPerEm; scaler.pixel = 1; @@ -303,7 +303,7 @@ HRESULT freetype_get_design_glyph_metrics(struct dwrite_fontface *fontface, UINT return S_OK; }
-BOOL freetype_is_monospaced(IDWriteFontFace4 *fontface) +BOOL freetype_is_monospaced(IDWriteFontFace5 *fontface) { BOOL is_monospaced = FALSE; FT_Face face; @@ -484,7 +484,7 @@ static void embolden_glyph(FT_Glyph glyph, FLOAT emsize) embolden_glyph_outline(&outline_glyph->outline, emsize); }
-HRESULT freetype_get_glyphrun_outline(IDWriteFontFace4 *fontface, float emSize, UINT16 const *glyphs, +HRESULT freetype_get_glyphrun_outline(IDWriteFontFace5 *fontface, float emSize, UINT16 const *glyphs, float const *advances, DWRITE_GLYPH_OFFSET const *offsets, unsigned int count, BOOL is_rtl, IDWriteGeometrySink *sink) { @@ -498,7 +498,7 @@ HRESULT freetype_get_glyphrun_outline(IDWriteFontFace4 *fontface, float emSize,
ID2D1SimplifiedGeometrySink_SetFillMode(sink, D2D1_FILL_MODE_WINDING);
- simulations = IDWriteFontFace4_GetSimulations(fontface); + simulations = IDWriteFontFace5_GetSimulations(fontface);
scaler.face_id = fontface; scaler.width = emSize; @@ -563,7 +563,7 @@ HRESULT freetype_get_glyphrun_outline(IDWriteFontFace4 *fontface, float emSize, return hr; }
-UINT16 freetype_get_glyphcount(IDWriteFontFace4 *fontface) +UINT16 freetype_get_glyphcount(IDWriteFontFace5 *fontface) { UINT16 count = 0; FT_Face face; @@ -576,7 +576,7 @@ UINT16 freetype_get_glyphcount(IDWriteFontFace4 *fontface) return count; }
-void freetype_get_glyphs(IDWriteFontFace4 *fontface, INT charmap, UINT32 const *codepoints, UINT32 count, +void freetype_get_glyphs(IDWriteFontFace5 *fontface, INT charmap, UINT32 const *codepoints, UINT32 count, UINT16 *glyphs) { UINT32 i; @@ -597,7 +597,7 @@ void freetype_get_glyphs(IDWriteFontFace4 *fontface, INT charmap, UINT32 const * LeaveCriticalSection(&freetype_cs); }
-BOOL freetype_has_kerning_pairs(IDWriteFontFace4 *fontface) +BOOL freetype_has_kerning_pairs(IDWriteFontFace5 *fontface) { BOOL has_kerning_pairs = FALSE; FT_Face face; @@ -610,7 +610,7 @@ BOOL freetype_has_kerning_pairs(IDWriteFontFace4 *fontface) return has_kerning_pairs; }
-INT32 freetype_get_kerning_pair_adjustment(IDWriteFontFace4 *fontface, UINT16 left, UINT16 right) +INT32 freetype_get_kerning_pair_adjustment(IDWriteFontFace5 *fontface, UINT16 left, UINT16 right) { INT32 adjustment = 0; FT_Face face; @@ -855,7 +855,7 @@ BOOL freetype_get_glyph_bitmap(struct dwrite_glyphbitmap *bitmap) return ret; }
-INT freetype_get_charmap_index(IDWriteFontFace4 *fontface, BOOL *is_symbol) +INT freetype_get_charmap_index(IDWriteFontFace5 *fontface, BOOL *is_symbol) { INT charmap_index = -1; FT_Face face; @@ -887,7 +887,7 @@ INT freetype_get_charmap_index(IDWriteFontFace4 *fontface, BOOL *is_symbol) return charmap_index; }
-INT32 freetype_get_glyph_advance(IDWriteFontFace4 *fontface, FLOAT emSize, UINT16 index, DWRITE_MEASURING_MODE mode, +INT32 freetype_get_glyph_advance(IDWriteFontFace5 *fontface, FLOAT emSize, UINT16 index, DWRITE_MEASURING_MODE mode, BOOL *has_contours) { FTC_ImageTypeRec imagetype; @@ -926,7 +926,7 @@ void release_freetype(void) { }
-void freetype_notify_cacheremove(IDWriteFontFace4 *fontface) +void freetype_notify_cacheremove(IDWriteFontFace5 *fontface) { }
@@ -935,35 +935,35 @@ HRESULT freetype_get_design_glyph_metrics(struct dwrite_fontface *fontface, UINT return E_NOTIMPL; }
-BOOL freetype_is_monospaced(IDWriteFontFace4 *fontface) +BOOL freetype_is_monospaced(IDWriteFontFace5 *fontface) { return FALSE; }
-HRESULT freetype_get_glyphrun_outline(IDWriteFontFace4 *fontface, float emSize, UINT16 const *glyphs, +HRESULT freetype_get_glyphrun_outline(IDWriteFontFace5 *fontface, float emSize, UINT16 const *glyphs, float const *advances, DWRITE_GLYPH_OFFSET const *offsets, unsigned int count, BOOL is_rtl, IDWriteGeometrySink *sink) { return E_NOTIMPL; }
-UINT16 freetype_get_glyphcount(IDWriteFontFace4 *fontface) +UINT16 freetype_get_glyphcount(IDWriteFontFace5 *fontface) { return 0; }
-void freetype_get_glyphs(IDWriteFontFace4 *fontface, INT charmap, UINT32 const *codepoints, UINT32 count, +void freetype_get_glyphs(IDWriteFontFace5 *fontface, INT charmap, UINT32 const *codepoints, UINT32 count, UINT16 *glyphs) { memset(glyphs, 0, count * sizeof(*glyphs)); }
-BOOL freetype_has_kerning_pairs(IDWriteFontFace4 *fontface) +BOOL freetype_has_kerning_pairs(IDWriteFontFace5 *fontface) { return FALSE; }
-INT32 freetype_get_kerning_pair_adjustment(IDWriteFontFace4 *fontface, UINT16 left, UINT16 right) +INT32 freetype_get_kerning_pair_adjustment(IDWriteFontFace5 *fontface, UINT16 left, UINT16 right) { return 0; } @@ -978,13 +978,13 @@ BOOL freetype_get_glyph_bitmap(struct dwrite_glyphbitmap *bitmap) return FALSE; }
-INT freetype_get_charmap_index(IDWriteFontFace4 *fontface, BOOL *is_symbol) +INT freetype_get_charmap_index(IDWriteFontFace5 *fontface, BOOL *is_symbol) { *is_symbol = FALSE; return -1; }
-INT32 freetype_get_glyph_advance(IDWriteFontFace4 *fontface, FLOAT emSize, UINT16 index, DWRITE_MEASURING_MODE mode, +INT32 freetype_get_glyph_advance(IDWriteFontFace5 *fontface, FLOAT emSize, UINT16 index, DWRITE_MEASURING_MODE mode, BOOL *has_contours) { *has_contours = FALSE; diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c index fb3ed090e6..7b97d77bd1 100644 --- a/dlls/dwrite/main.c +++ b/dlls/dwrite/main.c @@ -901,14 +901,14 @@ HRESULT factory_get_cached_fontface(IDWriteFactory5 *iface, IDWriteFontFile * co const void *cached_key; IDWriteFontFile *file;
- cached_face_index = IDWriteFontFace4_GetIndex(cached->fontface); - cached_simulations = IDWriteFontFace4_GetSimulations(cached->fontface); + cached_face_index = IDWriteFontFace5_GetIndex(cached->fontface); + cached_simulations = IDWriteFontFace5_GetSimulations(cached->fontface);
/* skip earlier */ if (cached_face_index != index || cached_simulations != simulations) continue;
- hr = IDWriteFontFace4_GetFiles(cached->fontface, &count, &file); + hr = IDWriteFontFace5_GetFiles(cached->fontface, &count, &file); if (FAILED(hr)) break;
@@ -917,8 +917,9 @@ HRESULT factory_get_cached_fontface(IDWriteFactory5 *iface, IDWriteFontFile * co if (FAILED(hr)) break;
- if (cached_key_size == key_size && !memcmp(cached_key, key, key_size)) { - if (FAILED(hr = IDWriteFontFace4_QueryInterface(cached->fontface, riid, obj))) + if (cached_key_size == key_size && !memcmp(cached_key, key, key_size)) + { + if (FAILED(hr = IDWriteFontFace5_QueryInterface(cached->fontface, riid, obj))) WARN("Failed to get %s from fontface, hr %#x.\n", debugstr_guid(riid), hr);
TRACE("returning cached fontface %p\n", cached->fontface); @@ -932,7 +933,7 @@ HRESULT factory_get_cached_fontface(IDWriteFactory5 *iface, IDWriteFontFile * co }
struct fontfacecached *factory_cache_fontface(IDWriteFactory5 *iface, struct list *fontfaces, - IDWriteFontFace4 *fontface) + IDWriteFontFace5 *fontface) { struct dwritefactory *factory = impl_from_IDWriteFactory5(iface); struct fontfacecached *cached; @@ -1011,7 +1012,7 @@ static HRESULT WINAPI dwritefactory_CreateFontFace(IDWriteFactory5 *iface, DWRIT desc.index = index; desc.simulations = simulations; desc.font_data = NULL; - hr = create_fontface(&desc, fontfaces, (IDWriteFontFace4 **)fontface); + hr = create_fontface(&desc, fontfaces, (IDWriteFontFace5 **)fontface);
failed: IDWriteFontFileStream_Release(stream); diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index efae402f91..09a9a861c3 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -2440,7 +2440,7 @@ void opentype_colr_next_glyph(const struct dwrite_fonttable *colr, struct dwrite } }
-BOOL opentype_has_vertical_variants(IDWriteFontFace4 *fontface) +BOOL opentype_has_vertical_variants(IDWriteFontFace5 *fontface) { const struct gpos_gsub_header *header; const struct ot_feature_list *featurelist; @@ -2452,7 +2452,7 @@ BOOL opentype_has_vertical_variants(IDWriteFontFace4 *fontface) UINT32 size; HRESULT hr;
- hr = IDWriteFontFace4_TryGetFontTable(fontface, MS_GSUB_TAG, &data, &size, &context, &exists); + hr = IDWriteFontFace5_TryGetFontTable(fontface, MS_GSUB_TAG, &data, &size, &context, &exists); if (FAILED(hr) || !exists) return FALSE;
@@ -2510,12 +2510,12 @@ BOOL opentype_has_vertical_variants(IDWriteFontFace4 *fontface) } }
- IDWriteFontFace4_ReleaseFontTable(fontface, context); + IDWriteFontFace5_ReleaseFontTable(fontface, context);
return ret; }
-static BOOL opentype_has_font_table(IDWriteFontFace4 *fontface, UINT32 tag) +static BOOL opentype_has_font_table(IDWriteFontFace5 *fontface, UINT32 tag) { BOOL exists = FALSE; const void *data; @@ -2523,17 +2523,17 @@ static BOOL opentype_has_font_table(IDWriteFontFace4 *fontface, UINT32 tag) UINT32 size; HRESULT hr;
- hr = IDWriteFontFace4_TryGetFontTable(fontface, tag, &data, &size, &context, &exists); + hr = IDWriteFontFace5_TryGetFontTable(fontface, tag, &data, &size, &context, &exists); if (FAILED(hr)) return FALSE;
if (exists) - IDWriteFontFace4_ReleaseFontTable(fontface, context); + IDWriteFontFace5_ReleaseFontTable(fontface, context);
return exists; }
-static unsigned int opentype_get_sbix_formats(IDWriteFontFace4 *fontface) +static unsigned int opentype_get_sbix_formats(IDWriteFontFace5 *fontface) { unsigned int num_strikes, num_glyphs, i, j, ret = 0; const struct sbix_header *sbix_header; @@ -2547,7 +2547,7 @@ static unsigned int opentype_get_sbix_formats(IDWriteFontFace4 *fontface)
num_glyphs = table_read_be_word(&table, FIELD_OFFSET(struct maxp, num_glyphs));
- IDWriteFontFace4_ReleaseFontTable(fontface, table.context); + IDWriteFontFace5_ReleaseFontTable(fontface, table.context);
memset(&table, 0, sizeof(table)); table.exists = TRUE; @@ -2600,12 +2600,12 @@ static unsigned int opentype_get_sbix_formats(IDWriteFontFace4 *fontface) } }
- IDWriteFontFace4_ReleaseFontTable(fontface, table.context); + IDWriteFontFace5_ReleaseFontTable(fontface, table.context);
return ret; }
-static unsigned int opentype_get_cblc_formats(IDWriteFontFace4 *fontface) +static unsigned int opentype_get_cblc_formats(IDWriteFontFace5 *fontface) { const unsigned int format_mask = DWRITE_GLYPH_IMAGE_FORMATS_PNG | DWRITE_GLYPH_IMAGE_FORMATS_PREMULTIPLIED_B8G8R8A8; @@ -2637,12 +2637,12 @@ static unsigned int opentype_get_cblc_formats(IDWriteFontFace4 *fontface) } }
- IDWriteFontFace4_ReleaseFontTable(fontface, cblc.context); + IDWriteFontFace5_ReleaseFontTable(fontface, cblc.context);
return ret; }
-UINT32 opentype_get_glyph_image_formats(IDWriteFontFace4 *fontface) +UINT32 opentype_get_glyph_image_formats(IDWriteFontFace5 *fontface) { UINT32 ret = DWRITE_GLYPH_IMAGE_FORMATS_NONE;
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/tests/font.c | 76 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+)
diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 3cd41efc91..d565eee331 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -9234,6 +9234,81 @@ todo_wine ok(ref == 0, "factory not released, %u\n", ref); }
+static void test_font_resource(void) +{ + IDWriteFontFaceReference1 *reference, *reference2; + IDWriteFontResource *resource, *resource2; + IDWriteFontFile *fontfile, *fontfile2; + IDWriteFontFace5 *fontface5; + IDWriteFontFace *fontface; + IDWriteFactory6 *factory; + UINT32 count, index; + HRESULT hr; + ULONG ref; + + if (!(factory = create_factory_iid(&IID_IDWriteFactory6))) + { + skip("IDWriteFactory6 is not supported.\n"); + return; + } + + fontface = create_fontface((IDWriteFactory *)factory); + + count = 1; + hr = IDWriteFontFace_GetFiles(fontface, &count, &fontfile); + ok(hr == S_OK, "Failed to get file object, hr %#x.\n", hr); + + hr = IDWriteFactory6_CreateFontResource(factory, fontfile, 0, &resource); + ok(hr == S_OK, "Failed to create font resource, hr %#x.\n", hr); + + hr = IDWriteFactory6_CreateFontResource(factory, fontfile, 0, &resource2); + ok(hr == S_OK, "Failed to create font resource, hr %#x.\n", hr); + ok(resource != resource2, "Unexpected instance.\n"); + IDWriteFontResource_Release(resource2); + + hr = IDWriteFontResource_GetFontFile(resource, &fontfile2); + ok(hr == S_OK, "Failed to get font file, hr %#x.\n", hr); + ok(fontfile2 == fontfile, "Unexpected file instance.\n"); + IDWriteFontFile_Release(fontfile2); + + index = IDWriteFontResource_GetFontFaceIndex(resource); + ok(!index, "Unexpected index %u.\n", index); + + hr = IDWriteFontResource_CreateFontFaceReference(resource, DWRITE_FONT_SIMULATIONS_NONE, NULL, 0, &reference); + ok(hr == S_OK, "Failed to create reference object, hr %#x.\n", hr); + + hr = IDWriteFontResource_CreateFontFaceReference(resource, DWRITE_FONT_SIMULATIONS_NONE, NULL, 0, &reference2); + ok(hr == S_OK, "Failed to create reference object, hr %#x.\n", hr); + ok(reference != reference2, "Unexpected reference instance.\n"); + IDWriteFontFaceReference1_Release(reference2); + IDWriteFontFaceReference1_Release(reference); + + hr = IDWriteFontFace_QueryInterface(fontface, &IID_IDWriteFontFace5, (void **)&fontface5); + ok(hr == S_OK, "Failed to get interface, hr %#x.\n", hr); + + hr = IDWriteFontFace5_GetFontResource(fontface5, &resource2); + ok(hr == S_OK, "Failed to get font resource, hr %#x.\n", hr); + ok(resource != resource2, "Unexpected resource instance.\n"); + IDWriteFontResource_Release(resource); + + hr = IDWriteFontFace5_GetFontResource(fontface5, &resource); + ok(hr == S_OK, "Failed to get font resource, hr %#x.\n", hr); + ok(resource != resource2, "Unexpected resource instance.\n"); + EXPECT_REF(resource, 1); + + IDWriteFontResource_Release(resource); + IDWriteFontResource_Release(resource2); + + IDWriteFontFace5_Release(fontface5); + + IDWriteFontResource_Release(resource); + IDWriteFontFile_Release(fontfile); + + IDWriteFontFace_Release(fontface); + ref = IDWriteFactory6_Release(factory); + ok(ref == 0, "Factory wasn't released, %u.\n", ref); +} + START_TEST(font) { IDWriteFactory *factory; @@ -9301,6 +9376,7 @@ START_TEST(font) test_localfontfileloader(); test_AnalyzeContainerType(); test_fontsetbuilder(); + test_font_resource();
IDWriteFactory_Release(factory); }
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/main.c | 528 +++++++++++++++++++++------------------ dlls/dwrite/tests/font.c | 11 +- 2 files changed, 301 insertions(+), 238 deletions(-)
diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c index 7b97d77bd1..033a664dcf 100644 --- a/dlls/dwrite/main.c +++ b/dlls/dwrite/main.c @@ -34,8 +34,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
-static IDWriteFactory5 *shared_factory; -static void release_shared_factory(IDWriteFactory5*); +static IDWriteFactory7 *shared_factory; +static void release_shared_factory(IDWriteFactory7 *factory);
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved) { @@ -549,8 +549,8 @@ struct fileloader
struct dwritefactory { - IDWriteFactory5 IDWriteFactory5_iface; - LONG ref; + IDWriteFactory7 IDWriteFactory7_iface; + LONG refcount;
IDWriteFontCollection1 *system_collection; IDWriteFontCollection1 *eudc_collection; @@ -566,9 +566,9 @@ struct dwritefactory CRITICAL_SECTION cs; };
-static inline struct dwritefactory *impl_from_IDWriteFactory5(IDWriteFactory5 *iface) +static inline struct dwritefactory *impl_from_IDWriteFactory7(IDWriteFactory7 *iface) { - return CONTAINING_RECORD(iface, struct dwritefactory, IDWriteFactory5_iface); + return CONTAINING_RECORD(iface, struct dwritefactory, IDWriteFactory7_iface); }
static void release_fontface_cache(struct list *fontfaces) @@ -620,11 +620,11 @@ static void release_dwritefactory(struct dwritefactory *factory) heap_free(factory); }
-static void release_shared_factory(IDWriteFactory5 *iface) +static void release_shared_factory(IDWriteFactory7 *iface) { struct dwritefactory *factory; if (!iface) return; - factory = impl_from_IDWriteFactory5(iface); + factory = impl_from_IDWriteFactory7(iface); release_dwritefactory(factory); }
@@ -667,7 +667,8 @@ static IDWriteFontCollection1 *factory_get_system_collection(struct dwritefactor return factory->system_collection; }
- if (FAILED(hr = get_system_fontcollection(&factory->IDWriteFactory5_iface, &collection))) { + if (FAILED(hr = get_system_fontcollection((IDWriteFactory5 *)&factory->IDWriteFactory7_iface, &collection))) + { WARN("Failed to create system font collection, hr %#x.\n", hr); return NULL; } @@ -678,13 +679,13 @@ static IDWriteFontCollection1 *factory_get_system_collection(struct dwritefactor return factory->system_collection; }
-static HRESULT WINAPI dwritefactory_QueryInterface(IDWriteFactory5 *iface, REFIID riid, void **obj) +static HRESULT WINAPI dwritefactory_QueryInterface(IDWriteFactory7 *iface, REFIID riid, void **obj) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
- TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); - - if (IsEqualIID(riid, &IID_IDWriteFactory5) || + if (IsEqualIID(riid, &IID_IDWriteFactory7) || + IsEqualIID(riid, &IID_IDWriteFactory6) || + IsEqualIID(riid, &IID_IDWriteFactory5) || IsEqualIID(riid, &IID_IDWriteFactory4) || IsEqualIID(riid, &IID_IDWriteFactory3) || IsEqualIID(riid, &IID_IDWriteFactory2) || @@ -693,7 +694,7 @@ static HRESULT WINAPI dwritefactory_QueryInterface(IDWriteFactory5 *iface, REFII IsEqualIID(riid, &IID_IUnknown)) { *obj = iface; - IDWriteFactory5_AddRef(iface); + IDWriteFactory7_AddRef(iface); return S_OK; }
@@ -702,75 +703,77 @@ static HRESULT WINAPI dwritefactory_QueryInterface(IDWriteFactory5 *iface, REFII return E_NOINTERFACE; }
-static ULONG WINAPI dwritefactory_AddRef(IDWriteFactory5 *iface) +static ULONG WINAPI dwritefactory_AddRef(IDWriteFactory7 *iface) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - ULONG ref = InterlockedIncrement(&This->ref); - TRACE("(%p)->(%d)\n", This, ref); - return ref; + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface); + ULONG refcount = InterlockedIncrement(&factory->refcount); + + TRACE("%p, refcount %u.\n", iface, refcount); + + return refcount; }
-static ULONG WINAPI dwritefactory_Release(IDWriteFactory5 *iface) +static ULONG WINAPI dwritefactory_Release(IDWriteFactory7 *iface) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - ULONG ref = InterlockedDecrement(&This->ref); + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface); + ULONG refcount = InterlockedDecrement(&factory->refcount);
- TRACE("(%p)->(%d)\n", This, ref); + TRACE("%p, refcount %u.\n", iface, refcount);
- if (!ref) - release_dwritefactory(This); + if (!refcount) + release_dwritefactory(factory);
- return ref; + return refcount; }
-static HRESULT WINAPI dwritefactory_GetSystemFontCollection(IDWriteFactory5 *iface, +static HRESULT WINAPI dwritefactory_GetSystemFontCollection(IDWriteFactory7 *iface, IDWriteFontCollection **collection, BOOL check_for_updates) { - return IDWriteFactory5_GetSystemFontCollection(iface, FALSE, (IDWriteFontCollection1 **)collection, + return IDWriteFactory5_GetSystemFontCollection((IDWriteFactory5 *)iface, FALSE, (IDWriteFontCollection1 **)collection, check_for_updates); }
-static HRESULT WINAPI dwritefactory_CreateCustomFontCollection(IDWriteFactory5 *iface, +static HRESULT WINAPI dwritefactory_CreateCustomFontCollection(IDWriteFactory7 *iface, IDWriteFontCollectionLoader *loader, void const *key, UINT32 key_size, IDWriteFontCollection **collection) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface); IDWriteFontFileEnumerator *enumerator; struct collectionloader *found; HRESULT hr;
- TRACE("(%p)->(%p %p %u %p)\n", This, loader, key, key_size, collection); + TRACE("%p, %p, %p, %u, %p.\n", iface, loader, key, key_size, collection);
*collection = NULL;
if (!loader) return E_INVALIDARG;
- found = factory_get_collection_loader(This, loader); + found = factory_get_collection_loader(factory, loader); if (!found) return E_INVALIDARG;
- hr = IDWriteFontCollectionLoader_CreateEnumeratorFromKey(found->loader, (IDWriteFactory*)iface, + hr = IDWriteFontCollectionLoader_CreateEnumeratorFromKey(found->loader, (IDWriteFactory *)iface, key, key_size, &enumerator); if (FAILED(hr)) return hr;
- hr = create_font_collection(iface, enumerator, FALSE, (IDWriteFontCollection3 **)collection); + hr = create_font_collection((IDWriteFactory5 *)iface, enumerator, FALSE, (IDWriteFontCollection3 **)collection); IDWriteFontFileEnumerator_Release(enumerator); return hr; }
-static HRESULT WINAPI dwritefactory_RegisterFontCollectionLoader(IDWriteFactory5 *iface, +static HRESULT WINAPI dwritefactory_RegisterFontCollectionLoader(IDWriteFactory7 *iface, IDWriteFontCollectionLoader *loader) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface); struct collectionloader *entry;
- TRACE("(%p)->(%p)\n", This, loader); + TRACE("%p, %p.\n", iface, loader);
if (!loader) return E_INVALIDARG;
- if (factory_get_collection_loader(This, loader)) + if (factory_get_collection_loader(factory, loader)) return DWRITE_E_ALREADYREGISTERED;
entry = heap_alloc(sizeof(*entry)); @@ -779,23 +782,23 @@ static HRESULT WINAPI dwritefactory_RegisterFontCollectionLoader(IDWriteFactory5
entry->loader = loader; IDWriteFontCollectionLoader_AddRef(loader); - list_add_tail(&This->collection_loaders, &entry->entry); + list_add_tail(&factory->collection_loaders, &entry->entry);
return S_OK; }
-static HRESULT WINAPI dwritefactory_UnregisterFontCollectionLoader(IDWriteFactory5 *iface, +static HRESULT WINAPI dwritefactory_UnregisterFontCollectionLoader(IDWriteFactory7 *iface, IDWriteFontCollectionLoader *loader) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface); struct collectionloader *found;
- TRACE("(%p)->(%p)\n", This, loader); + TRACE("%p, %p.\n", iface, loader);
if (!loader) return E_INVALIDARG;
- found = factory_get_collection_loader(This, loader); + found = factory_get_collection_loader(factory, loader); if (!found) return E_INVALIDARG;
@@ -806,15 +809,15 @@ static HRESULT WINAPI dwritefactory_UnregisterFontCollectionLoader(IDWriteFactor return S_OK; }
-static HRESULT WINAPI dwritefactory_CreateFontFileReference(IDWriteFactory5 *iface, +static HRESULT WINAPI dwritefactory_CreateFontFileReference(IDWriteFactory7 *iface, WCHAR const *path, FILETIME const *writetime, IDWriteFontFile **font_file) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface); UINT32 key_size; HRESULT hr; void *key;
- TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(path), writetime, font_file); + TRACE("%p, %s, %p, %p.\n", iface, debugstr_w(path), writetime, font_file);
*font_file = NULL;
@@ -823,22 +826,22 @@ static HRESULT WINAPI dwritefactory_CreateFontFileReference(IDWriteFactory5 *ifa if (FAILED(hr)) return hr;
- hr = create_font_file(This->localfontfileloader, key, key_size, font_file); + hr = create_font_file(factory->localfontfileloader, key, key_size, font_file); heap_free(key);
return hr; }
-static HRESULT WINAPI dwritefactory_CreateCustomFontFileReference(IDWriteFactory5 *iface, +static HRESULT WINAPI dwritefactory_CreateCustomFontFileReference(IDWriteFactory7 *iface, void const *reference_key, UINT32 key_size, IDWriteFontFileLoader *loader, IDWriteFontFile **font_file) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface);
- TRACE("(%p)->(%p %u %p %p)\n", This, reference_key, key_size, loader, font_file); + TRACE("%p, %p, %u, %p, %p.\n", iface, reference_key, key_size, loader, font_file);
*font_file = NULL;
- if (!loader || !(factory_get_file_loader(This, loader) || This->localfontfileloader == loader)) + if (!loader || !(factory_get_file_loader(factory, loader) || factory->localfontfileloader == loader)) return E_INVALIDARG;
return create_font_file(loader, reference_key, key_size, font_file); @@ -846,20 +849,20 @@ static HRESULT WINAPI dwritefactory_CreateCustomFontFileReference(IDWriteFactory
void factory_lock(IDWriteFactory5 *iface) { - struct dwritefactory *factory = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7((IDWriteFactory7 *)iface); EnterCriticalSection(&factory->cs); }
void factory_unlock(IDWriteFactory5 *iface) { - struct dwritefactory *factory = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7((IDWriteFactory7 *)iface); LeaveCriticalSection(&factory->cs); }
HRESULT factory_get_cached_fontface(IDWriteFactory5 *iface, IDWriteFontFile * const *font_files, UINT32 index, DWRITE_FONT_SIMULATIONS simulations, struct list **cached_list, REFIID riid, void **obj) { - struct dwritefactory *factory = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7((IDWriteFactory7 *)iface); struct fontfacecached *cached; IDWriteFontFileLoader *loader; struct list *fontfaces; @@ -935,7 +938,7 @@ HRESULT factory_get_cached_fontface(IDWriteFactory5 *iface, IDWriteFontFile * co struct fontfacecached *factory_cache_fontface(IDWriteFactory5 *iface, struct list *fontfaces, IDWriteFontFace5 *fontface) { - struct dwritefactory *factory = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7((IDWriteFactory7 *)iface); struct fontfacecached *cached;
/* new cache entry */ @@ -951,11 +954,10 @@ struct fontfacecached *factory_cache_fontface(IDWriteFactory5 *iface, struct lis return cached; }
-static HRESULT WINAPI dwritefactory_CreateFontFace(IDWriteFactory5 *iface, DWRITE_FONT_FACE_TYPE req_facetype, +static HRESULT WINAPI dwritefactory_CreateFontFace(IDWriteFactory7 *iface, DWRITE_FONT_FACE_TYPE req_facetype, UINT32 files_number, IDWriteFontFile* const* font_files, UINT32 index, DWRITE_FONT_SIMULATIONS simulations, IDWriteFontFace **fontface) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); DWRITE_FONT_FILE_TYPE file_type; DWRITE_FONT_FACE_TYPE face_type; IDWriteFontFileStream *stream; @@ -965,7 +967,7 @@ static HRESULT WINAPI dwritefactory_CreateFontFace(IDWriteFactory5 *iface, DWRIT UINT32 face_count; HRESULT hr;
- TRACE("(%p)->(%d %u %p %u 0x%x %p)\n", This, req_facetype, files_number, font_files, index, + TRACE("%p, %d, %u, %p, %u, %#x, %p.\n", iface, req_facetype, files_number, font_files, index, simulations, fontface);
*fontface = NULL; @@ -999,12 +1001,12 @@ static HRESULT WINAPI dwritefactory_CreateFontFace(IDWriteFactory5 *iface, DWRIT goto failed; }
- hr = factory_get_cached_fontface(iface, font_files, index, simulations, &fontfaces, + hr = factory_get_cached_fontface((IDWriteFactory5 *)iface, font_files, index, simulations, &fontfaces, &IID_IDWriteFontFace, (void **)fontface); if (hr != S_FALSE) goto failed;
- desc.factory = iface; + desc.factory = (IDWriteFactory5 *)iface; desc.face_type = req_facetype; desc.files = font_files; desc.stream = stream; @@ -1019,71 +1021,68 @@ failed: return hr; }
-static HRESULT WINAPI dwritefactory_CreateRenderingParams(IDWriteFactory5 *iface, IDWriteRenderingParams **params) +static HRESULT WINAPI dwritefactory_CreateRenderingParams(IDWriteFactory7 *iface, IDWriteRenderingParams **params) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); HMONITOR monitor; POINT pt;
- TRACE("(%p)->(%p)\n", This, params); + TRACE("%p, %p.\n", iface, params);
pt.x = pt.y = 0; monitor = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY); - return IDWriteFactory5_CreateMonitorRenderingParams(iface, monitor, params); + return IDWriteFactory7_CreateMonitorRenderingParams(iface, monitor, params); }
-static HRESULT WINAPI dwritefactory_CreateMonitorRenderingParams(IDWriteFactory5 *iface, HMONITOR monitor, +static HRESULT WINAPI dwritefactory_CreateMonitorRenderingParams(IDWriteFactory7 *iface, HMONITOR monitor, IDWriteRenderingParams **params) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); IDWriteRenderingParams3 *params3; static int fixme_once = 0; HRESULT hr;
- TRACE("(%p)->(%p %p)\n", This, monitor, params); + TRACE("%p, %p, %p.\n", iface, monitor, params);
if (!fixme_once++) FIXME("(%p): monitor setting ignored\n", monitor);
/* FIXME: use actual per-monitor gamma factor */ - hr = IDWriteFactory5_CreateCustomRenderingParams(iface, 2.0f, 0.0f, 1.0f, 0.0f, DWRITE_PIXEL_GEOMETRY_FLAT, + hr = IDWriteFactory7_CreateCustomRenderingParams(iface, 2.0f, 0.0f, 1.0f, 0.0f, DWRITE_PIXEL_GEOMETRY_FLAT, DWRITE_RENDERING_MODE1_DEFAULT, DWRITE_GRID_FIT_MODE_DEFAULT, ¶ms3); *params = (IDWriteRenderingParams*)params3; return hr; }
-static HRESULT WINAPI dwritefactory_CreateCustomRenderingParams(IDWriteFactory5 *iface, FLOAT gamma, +static HRESULT WINAPI dwritefactory_CreateCustomRenderingParams(IDWriteFactory7 *iface, FLOAT gamma, FLOAT enhancedContrast, FLOAT cleartype_level, DWRITE_PIXEL_GEOMETRY geometry, DWRITE_RENDERING_MODE mode, IDWriteRenderingParams **params) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); IDWriteRenderingParams3 *params3; HRESULT hr;
- TRACE("(%p)->(%f %f %f %d %d %p)\n", This, gamma, enhancedContrast, cleartype_level, geometry, mode, params); + TRACE("%p, %.8e, %.8e, %.8e, %d, %d, %p.\n", iface, gamma, enhancedContrast, cleartype_level, geometry, mode, params);
if ((UINT32)mode > DWRITE_RENDERING_MODE_OUTLINE) { *params = NULL; return E_INVALIDARG; }
- hr = IDWriteFactory5_CreateCustomRenderingParams(iface, gamma, enhancedContrast, 1.0f, cleartype_level, geometry, + hr = IDWriteFactory7_CreateCustomRenderingParams(iface, gamma, enhancedContrast, 1.0f, cleartype_level, geometry, (DWRITE_RENDERING_MODE1)mode, DWRITE_GRID_FIT_MODE_DEFAULT, ¶ms3); *params = (IDWriteRenderingParams*)params3; return hr; }
-static HRESULT WINAPI dwritefactory_RegisterFontFileLoader(IDWriteFactory5 *iface, IDWriteFontFileLoader *loader) +static HRESULT WINAPI dwritefactory_RegisterFontFileLoader(IDWriteFactory7 *iface, IDWriteFontFileLoader *loader) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface); struct fileloader *entry;
- TRACE("(%p)->(%p)\n", This, loader); + TRACE("%p, %p.\n", iface, loader);
if (!loader) return E_INVALIDARG;
- if (factory_get_file_loader(This, loader)) + if (factory_get_file_loader(factory, loader)) return DWRITE_E_ALREADYREGISTERED;
entry = heap_alloc(sizeof(*entry)); @@ -1093,22 +1092,22 @@ static HRESULT WINAPI dwritefactory_RegisterFontFileLoader(IDWriteFactory5 *ifac entry->loader = loader; list_init(&entry->fontfaces); IDWriteFontFileLoader_AddRef(loader); - list_add_tail(&This->file_loaders, &entry->entry); + list_add_tail(&factory->file_loaders, &entry->entry);
return S_OK; }
-static HRESULT WINAPI dwritefactory_UnregisterFontFileLoader(IDWriteFactory5 *iface, IDWriteFontFileLoader *loader) +static HRESULT WINAPI dwritefactory_UnregisterFontFileLoader(IDWriteFactory7 *iface, IDWriteFontFileLoader *loader) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface); struct fileloader *found;
- TRACE("(%p)->(%p)\n", This, loader); + TRACE("%p, %p.\n", iface, loader);
if (!loader) return E_INVALIDARG;
- found = factory_get_file_loader(This, loader); + found = factory_get_file_loader(factory, loader); if (!found) return E_INVALIDARG;
@@ -1116,20 +1115,20 @@ static HRESULT WINAPI dwritefactory_UnregisterFontFileLoader(IDWriteFactory5 *if return S_OK; }
-static HRESULT WINAPI dwritefactory_CreateTextFormat(IDWriteFactory5 *iface, WCHAR const* family_name, +static HRESULT WINAPI dwritefactory_CreateTextFormat(IDWriteFactory7 *iface, WCHAR const* family_name, IDWriteFontCollection *collection, DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STYLE style, DWRITE_FONT_STRETCH stretch, FLOAT size, WCHAR const *locale, IDWriteTextFormat **format) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface); HRESULT hr;
- TRACE("(%p)->(%s %p %d %d %d %f %s %p)\n", This, debugstr_w(family_name), collection, weight, style, stretch, + TRACE("%p, %s, %p, %d, %d, %d, %.8e, %s, %p.\n", iface, debugstr_w(family_name), collection, weight, style, stretch, size, debugstr_w(locale), format);
if (collection) IDWriteFontCollection_AddRef(collection); else { - collection = (IDWriteFontCollection *)factory_get_system_collection(This); + collection = (IDWriteFontCollection *)factory_get_system_collection(factory); if (!collection) { *format = NULL; return E_FAIL; @@ -1141,39 +1140,38 @@ static HRESULT WINAPI dwritefactory_CreateTextFormat(IDWriteFactory5 *iface, WCH return hr; }
-static HRESULT WINAPI dwritefactory_CreateTypography(IDWriteFactory5 *iface, IDWriteTypography **typography) +static HRESULT WINAPI dwritefactory_CreateTypography(IDWriteFactory7 *iface, IDWriteTypography **typography) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - TRACE("(%p)->(%p)\n", This, typography); + TRACE("%p, %p.\n", iface, typography); + return create_typography(typography); }
-static HRESULT WINAPI dwritefactory_GetGdiInterop(IDWriteFactory5 *iface, IDWriteGdiInterop **gdi_interop) +static HRESULT WINAPI dwritefactory_GetGdiInterop(IDWriteFactory7 *iface, IDWriteGdiInterop **gdi_interop) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface); HRESULT hr = S_OK;
- TRACE("(%p)->(%p)\n", This, gdi_interop); + TRACE("%p, %p.\n", iface, gdi_interop);
- if (This->gdiinterop) - IDWriteGdiInterop1_AddRef(This->gdiinterop); + if (factory->gdiinterop) + IDWriteGdiInterop1_AddRef(factory->gdiinterop); else - hr = create_gdiinterop(iface, &This->gdiinterop); + hr = create_gdiinterop((IDWriteFactory5 *)iface, &factory->gdiinterop);
- *gdi_interop = (IDWriteGdiInterop *)This->gdiinterop; + *gdi_interop = (IDWriteGdiInterop *)factory->gdiinterop;
return hr; }
-static HRESULT WINAPI dwritefactory_CreateTextLayout(IDWriteFactory5 *iface, WCHAR const* string, +static HRESULT WINAPI dwritefactory_CreateTextLayout(IDWriteFactory7 *iface, WCHAR const* string, UINT32 length, IDWriteTextFormat *format, FLOAT max_width, FLOAT max_height, IDWriteTextLayout **layout) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); struct textlayout_desc desc;
- TRACE("(%p)->(%s:%u %p %f %f %p)\n", This, debugstr_wn(string, length), length, format, max_width, max_height, layout); + TRACE("%p, %s:%u, %p, %.8e, %.8e, %p.\n", iface, debugstr_wn(string, length), length, format, max_width, max_height, layout);
- desc.factory = iface; + desc.factory = (IDWriteFactory5 *)iface; desc.string = string; desc.length = length; desc.format = format; @@ -1186,17 +1184,16 @@ static HRESULT WINAPI dwritefactory_CreateTextLayout(IDWriteFactory5 *iface, WCH return create_textlayout(&desc, layout); }
-static HRESULT WINAPI dwritefactory_CreateGdiCompatibleTextLayout(IDWriteFactory5 *iface, WCHAR const* string, +static HRESULT WINAPI dwritefactory_CreateGdiCompatibleTextLayout(IDWriteFactory7 *iface, WCHAR const* string, UINT32 length, IDWriteTextFormat *format, FLOAT max_width, FLOAT max_height, FLOAT pixels_per_dip, DWRITE_MATRIX const* transform, BOOL use_gdi_natural, IDWriteTextLayout **layout) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); struct textlayout_desc desc;
- TRACE("(%p)->(%s:%u %p %f %f %f %p %d %p)\n", This, debugstr_wn(string, length), length, format, max_width, - max_height, pixels_per_dip, transform, use_gdi_natural, layout); + TRACE("%p, %s:%u, %p, %.8e, %.8e, %.8e, %p, %d, %p.\n", iface, debugstr_wn(string, length), length, format, + max_width, max_height, pixels_per_dip, transform, use_gdi_natural, layout);
- desc.factory = iface; + desc.factory = (IDWriteFactory5 *)iface; desc.string = string; desc.length = length; desc.format = format; @@ -1209,31 +1206,29 @@ static HRESULT WINAPI dwritefactory_CreateGdiCompatibleTextLayout(IDWriteFactory return create_textlayout(&desc, layout); }
-static HRESULT WINAPI dwritefactory_CreateEllipsisTrimmingSign(IDWriteFactory5 *iface, IDWriteTextFormat *format, +static HRESULT WINAPI dwritefactory_CreateEllipsisTrimmingSign(IDWriteFactory7 *iface, IDWriteTextFormat *format, IDWriteInlineObject **trimming_sign) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - TRACE("(%p)->(%p %p)\n", This, format, trimming_sign); - return create_trimmingsign(iface, format, trimming_sign); + TRACE("%p, %p, %p.\n", iface, format, trimming_sign); + + return create_trimmingsign((IDWriteFactory5 *)iface, format, trimming_sign); }
-static HRESULT WINAPI dwritefactory_CreateTextAnalyzer(IDWriteFactory5 *iface, IDWriteTextAnalyzer **analyzer) +static HRESULT WINAPI dwritefactory_CreateTextAnalyzer(IDWriteFactory7 *iface, IDWriteTextAnalyzer **analyzer) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - - TRACE("(%p)->(%p)\n", This, analyzer); + TRACE("%p, %p.\n", iface, analyzer);
*analyzer = get_text_analyzer();
return S_OK; }
-static HRESULT WINAPI dwritefactory_CreateNumberSubstitution(IDWriteFactory5 *iface, +static HRESULT WINAPI dwritefactory_CreateNumberSubstitution(IDWriteFactory7 *iface, DWRITE_NUMBER_SUBSTITUTION_METHOD method, WCHAR const* locale, BOOL ignore_user_override, IDWriteNumberSubstitution **substitution) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - TRACE("(%p)->(%d %s %d %p)\n", This, method, debugstr_w(locale), ignore_user_override, substitution); + TRACE("%p, %d, %s, %d, %p.\n", iface, method, debugstr_w(locale), ignore_user_override, substitution); + return create_numbersubstitution(method, locale, ignore_user_override, substitution); }
@@ -1249,15 +1244,14 @@ static inline void dwrite_matrix_multiply(DWRITE_MATRIX *a, const DWRITE_MATRIX a->dy = tmp.dy * b->m12 + tmp.dy * b->m22 + b->dx; }
-static HRESULT WINAPI dwritefactory_CreateGlyphRunAnalysis(IDWriteFactory5 *iface, DWRITE_GLYPH_RUN const *run, +static HRESULT WINAPI dwritefactory_CreateGlyphRunAnalysis(IDWriteFactory7 *iface, DWRITE_GLYPH_RUN const *run, FLOAT ppdip, DWRITE_MATRIX const* transform, DWRITE_RENDERING_MODE rendering_mode, DWRITE_MEASURING_MODE measuring_mode, FLOAT originX, FLOAT originY, IDWriteGlyphRunAnalysis **analysis) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); struct glyphrunanalysis_desc desc; DWRITE_MATRIX m, scale = { 0 };
- TRACE("(%p)->(%p %.2f %p %d %d %.2f %.2f %p)\n", This, run, ppdip, transform, rendering_mode, + TRACE("%p, %p, %.8e, %p, %d, %d, %.8e, %.8e, %p.\n", iface, run, ppdip, transform, rendering_mode, measuring_mode, originX, originY, analysis);
if (ppdip <= 0.0f) { @@ -1280,46 +1274,46 @@ static HRESULT WINAPI dwritefactory_CreateGlyphRunAnalysis(IDWriteFactory5 *ifac return create_glyphrunanalysis(&desc, analysis); }
-static HRESULT WINAPI dwritefactory1_GetEudcFontCollection(IDWriteFactory5 *iface, IDWriteFontCollection **collection, +static HRESULT WINAPI dwritefactory1_GetEudcFontCollection(IDWriteFactory7 *iface, IDWriteFontCollection **collection, BOOL check_for_updates) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface); HRESULT hr = S_OK;
- TRACE("(%p)->(%p %d)\n", This, collection, check_for_updates); + TRACE("%p, %p, %d.\n", iface, collection, check_for_updates);
if (check_for_updates) FIXME("checking for eudc updates not implemented\n");
- if (This->eudc_collection) - IDWriteFontCollection1_AddRef(This->eudc_collection); + if (factory->eudc_collection) + IDWriteFontCollection1_AddRef(factory->eudc_collection); else { IDWriteFontCollection3 *eudc_collection;
- if (FAILED(hr = get_eudc_fontcollection(iface, &eudc_collection))) { + if (FAILED(hr = get_eudc_fontcollection((IDWriteFactory5 *)iface, &eudc_collection))) + { *collection = NULL; WARN("Failed to get EUDC collection, hr %#x.\n", hr); return hr; }
- if (InterlockedCompareExchangePointer((void **)&This->eudc_collection, eudc_collection, NULL)) + if (InterlockedCompareExchangePointer((void **)&factory->eudc_collection, eudc_collection, NULL)) IDWriteFontCollection3_Release(eudc_collection); }
- *collection = (IDWriteFontCollection *)This->eudc_collection; + *collection = (IDWriteFontCollection *)factory->eudc_collection;
return hr; }
-static HRESULT WINAPI dwritefactory1_CreateCustomRenderingParams(IDWriteFactory5 *iface, FLOAT gamma, +static HRESULT WINAPI dwritefactory1_CreateCustomRenderingParams(IDWriteFactory7 *iface, FLOAT gamma, FLOAT enhcontrast, FLOAT enhcontrast_grayscale, FLOAT cleartype_level, DWRITE_PIXEL_GEOMETRY geometry, DWRITE_RENDERING_MODE mode, IDWriteRenderingParams1** params) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); IDWriteRenderingParams3 *params3; HRESULT hr;
- TRACE("(%p)->(%.2f %.2f %.2f %.2f %d %d %p)\n", This, gamma, enhcontrast, enhcontrast_grayscale, + TRACE("%p, %.8e, %.8e, %.8e, %.8e, %d, %d, %p.\n", iface, gamma, enhcontrast, enhcontrast_grayscale, cleartype_level, geometry, mode, params);
if ((UINT32)mode > DWRITE_RENDERING_MODE_OUTLINE) { @@ -1327,15 +1321,15 @@ static HRESULT WINAPI dwritefactory1_CreateCustomRenderingParams(IDWriteFactory5 return E_INVALIDARG; }
- hr = IDWriteFactory5_CreateCustomRenderingParams(iface, gamma, enhcontrast, enhcontrast_grayscale, + hr = IDWriteFactory7_CreateCustomRenderingParams(iface, gamma, enhcontrast, enhcontrast_grayscale, cleartype_level, geometry, (DWRITE_RENDERING_MODE1)mode, DWRITE_GRID_FIT_MODE_DEFAULT, ¶ms3); *params = (IDWriteRenderingParams1*)params3; return hr; }
-static HRESULT WINAPI dwritefactory2_GetSystemFontFallback(IDWriteFactory5 *iface, IDWriteFontFallback **fallback) +static HRESULT WINAPI dwritefactory2_GetSystemFontFallback(IDWriteFactory7 *iface, IDWriteFontFallback **fallback) { - struct dwritefactory *factory = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface);
TRACE("%p, %p.\n", iface, fallback);
@@ -1343,7 +1337,7 @@ static HRESULT WINAPI dwritefactory2_GetSystemFontFallback(IDWriteFactory5 *ifac
if (!factory->fallback) { - HRESULT hr = create_system_fontfallback(iface, &factory->fallback); + HRESULT hr = create_system_fontfallback((IDWriteFactory5 *)iface, &factory->fallback); if (FAILED(hr)) return hr; } @@ -1353,35 +1347,32 @@ static HRESULT WINAPI dwritefactory2_GetSystemFontFallback(IDWriteFactory5 *ifac return S_OK; }
-static HRESULT WINAPI dwritefactory2_CreateFontFallbackBuilder(IDWriteFactory5 *iface, +static HRESULT WINAPI dwritefactory2_CreateFontFallbackBuilder(IDWriteFactory7 *iface, IDWriteFontFallbackBuilder **fallbackbuilder) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + TRACE("%p, %p.\n", iface, fallbackbuilder);
- TRACE("(%p)->(%p)\n", This, fallbackbuilder); - - return create_fontfallback_builder(iface, fallbackbuilder); + return create_fontfallback_builder((IDWriteFactory5 *)iface, fallbackbuilder); }
-static HRESULT WINAPI dwritefactory2_TranslateColorGlyphRun(IDWriteFactory5 *iface, FLOAT originX, FLOAT originY, +static HRESULT WINAPI dwritefactory2_TranslateColorGlyphRun(IDWriteFactory7 *iface, FLOAT originX, FLOAT originY, const DWRITE_GLYPH_RUN *run, const DWRITE_GLYPH_RUN_DESCRIPTION *rundescr, DWRITE_MEASURING_MODE mode, const DWRITE_MATRIX *transform, UINT32 palette, IDWriteColorGlyphRunEnumerator **colorlayers) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - TRACE("(%p)->(%.2f %.2f %p %p %d %p %u %p)\n", This, originX, originY, run, rundescr, mode, + TRACE("%p, %.8e, %.8e, %p, %p, %d, %p, %u, %p.\n", iface, originX, originY, run, rundescr, mode, transform, palette, colorlayers); + return create_colorglyphenum(originX, originY, run, rundescr, mode, transform, palette, colorlayers); }
-static HRESULT WINAPI dwritefactory2_CreateCustomRenderingParams(IDWriteFactory5 *iface, FLOAT gamma, FLOAT contrast, +static HRESULT WINAPI dwritefactory2_CreateCustomRenderingParams(IDWriteFactory7 *iface, FLOAT gamma, FLOAT contrast, FLOAT grayscalecontrast, FLOAT cleartype_level, DWRITE_PIXEL_GEOMETRY geometry, DWRITE_RENDERING_MODE mode, DWRITE_GRID_FIT_MODE gridfit, IDWriteRenderingParams2 **params) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); IDWriteRenderingParams3 *params3; HRESULT hr;
- TRACE("(%p)->(%.2f %.2f %.2f %.2f %d %d %d %p)\n", This, gamma, contrast, grayscalecontrast, cleartype_level, + TRACE("%p, %.8e, %.8e, %.8e, %.8e, %d, %d, %d, %p.\n", iface, gamma, contrast, grayscalecontrast, cleartype_level, geometry, mode, gridfit, params);
if ((UINT32)mode > DWRITE_RENDERING_MODE_OUTLINE) { @@ -1389,7 +1380,7 @@ static HRESULT WINAPI dwritefactory2_CreateCustomRenderingParams(IDWriteFactory5 return E_INVALIDARG; }
- hr = IDWriteFactory5_CreateCustomRenderingParams(iface, gamma, contrast, grayscalecontrast, + hr = IDWriteFactory7_CreateCustomRenderingParams(iface, gamma, contrast, grayscalecontrast, cleartype_level, geometry, (DWRITE_RENDERING_MODE1)mode, DWRITE_GRID_FIT_MODE_DEFAULT, ¶ms3); *params = (IDWriteRenderingParams2*)params3; return hr; @@ -1412,112 +1403,97 @@ static HRESULT factory_create_glyphrun_analysis(const DWRITE_GLYPH_RUN *run, con return create_glyphrunanalysis(&desc, analysis); }
-static HRESULT WINAPI dwritefactory2_CreateGlyphRunAnalysis(IDWriteFactory5 *iface, const DWRITE_GLYPH_RUN *run, +static HRESULT WINAPI dwritefactory2_CreateGlyphRunAnalysis(IDWriteFactory7 *iface, const DWRITE_GLYPH_RUN *run, const DWRITE_MATRIX *transform, DWRITE_RENDERING_MODE rendering_mode, DWRITE_MEASURING_MODE measuring_mode, DWRITE_GRID_FIT_MODE gridfit_mode, DWRITE_TEXT_ANTIALIAS_MODE aa_mode, FLOAT originX, FLOAT originY, IDWriteGlyphRunAnalysis **analysis) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - - TRACE("(%p)->(%p %p %d %d %d %d %.2f %.2f %p)\n", This, run, transform, rendering_mode, measuring_mode, + TRACE("%p, %p, %p, %d, %d, %d, %d, %.8e, %.8e, %p.\n", iface, run, transform, rendering_mode, measuring_mode, gridfit_mode, aa_mode, originX, originY, analysis);
return factory_create_glyphrun_analysis(run, transform, (DWRITE_RENDERING_MODE1)rendering_mode, measuring_mode, gridfit_mode, aa_mode, originX, originY, analysis); }
-static HRESULT WINAPI dwritefactory3_CreateGlyphRunAnalysis(IDWriteFactory5 *iface, DWRITE_GLYPH_RUN const *run, +static HRESULT WINAPI dwritefactory3_CreateGlyphRunAnalysis(IDWriteFactory7 *iface, DWRITE_GLYPH_RUN const *run, DWRITE_MATRIX const *transform, DWRITE_RENDERING_MODE1 rendering_mode, DWRITE_MEASURING_MODE measuring_mode, DWRITE_GRID_FIT_MODE gridfit_mode, DWRITE_TEXT_ANTIALIAS_MODE aa_mode, FLOAT originX, FLOAT originY, IDWriteGlyphRunAnalysis **analysis) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - - TRACE("(%p)->(%p %p %d %d %d %d %.2f %.2f %p)\n", This, run, transform, rendering_mode, measuring_mode, + TRACE("%p, %p, %p, %d, %d, %d, %d, %.8e, %.8e, %p.\n", iface, run, transform, rendering_mode, measuring_mode, gridfit_mode, aa_mode, originX, originY, analysis);
return factory_create_glyphrun_analysis(run, transform, rendering_mode, measuring_mode, gridfit_mode, aa_mode, originX, originY, analysis); }
-static HRESULT WINAPI dwritefactory3_CreateCustomRenderingParams(IDWriteFactory5 *iface, FLOAT gamma, FLOAT contrast, +static HRESULT WINAPI dwritefactory3_CreateCustomRenderingParams(IDWriteFactory7 *iface, FLOAT gamma, FLOAT contrast, FLOAT grayscale_contrast, FLOAT cleartype_level, DWRITE_PIXEL_GEOMETRY pixel_geometry, DWRITE_RENDERING_MODE1 rendering_mode, DWRITE_GRID_FIT_MODE gridfit_mode, IDWriteRenderingParams3 **params) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - - TRACE("(%p)->(%.2f %.2f %.2f %.2f %d %d %d %p)\n", This, gamma, contrast, grayscale_contrast, cleartype_level, + TRACE("%p, %.8e, %.8e, %.8e, %.8e, %d, %d, %d, %p.\n", iface, gamma, contrast, grayscale_contrast, cleartype_level, pixel_geometry, rendering_mode, gridfit_mode, params);
return create_renderingparams(gamma, contrast, grayscale_contrast, cleartype_level, pixel_geometry, rendering_mode, gridfit_mode, params); }
-static HRESULT WINAPI dwritefactory3_CreateFontFaceReference_(IDWriteFactory5 *iface, IDWriteFontFile *file, +static HRESULT WINAPI dwritefactory3_CreateFontFaceReference_(IDWriteFactory7 *iface, IDWriteFontFile *file, UINT32 index, DWRITE_FONT_SIMULATIONS simulations, IDWriteFontFaceReference **reference) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - - TRACE("(%p)->(%p %u %x %p)\n", This, file, index, simulations, reference); + TRACE("%p, %p, %u, %x, %p.\n", iface, file, index, simulations, reference);
- return create_fontfacereference(iface, file, index, simulations, reference); + return create_fontfacereference((IDWriteFactory5 *)iface, file, index, simulations, reference); }
-static HRESULT WINAPI dwritefactory3_CreateFontFaceReference(IDWriteFactory5 *iface, WCHAR const *path, +static HRESULT WINAPI dwritefactory3_CreateFontFaceReference(IDWriteFactory7 *iface, WCHAR const *path, FILETIME const *writetime, UINT32 index, DWRITE_FONT_SIMULATIONS simulations, IDWriteFontFaceReference **reference) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); IDWriteFontFile *file; HRESULT hr;
- TRACE("(%p)->(%s %p %u %x, %p)\n", This, debugstr_w(path), writetime, index, simulations, reference); + TRACE("%p, %s, %p, %u, %#x, %p.\n", iface, debugstr_w(path), writetime, index, simulations, reference);
- hr = IDWriteFactory5_CreateFontFileReference(iface, path, writetime, &file); + hr = IDWriteFactory5_CreateFontFileReference((IDWriteFactory5 *)iface, path, writetime, &file); if (FAILED(hr)) { *reference = NULL; return hr; }
- hr = IDWriteFactory5_CreateFontFaceReference_(iface, file, index, simulations, reference); + hr = IDWriteFactory5_CreateFontFaceReference_((IDWriteFactory5 *)iface, file, index, simulations, reference); IDWriteFontFile_Release(file); return hr; }
-static HRESULT WINAPI dwritefactory3_GetSystemFontSet(IDWriteFactory5 *iface, IDWriteFontSet **fontset) +static HRESULT WINAPI dwritefactory3_GetSystemFontSet(IDWriteFactory7 *iface, IDWriteFontSet **fontset) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - - FIXME("(%p)->(%p): stub\n", This, fontset); + FIXME("%p, %p: stub\n", iface, fontset);
return E_NOTIMPL; }
-static HRESULT WINAPI dwritefactory3_CreateFontSetBuilder(IDWriteFactory5 *iface, IDWriteFontSetBuilder **builder) +static HRESULT WINAPI dwritefactory3_CreateFontSetBuilder(IDWriteFactory7 *iface, IDWriteFontSetBuilder **builder) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - - FIXME("(%p)->(%p): stub\n", This, builder); + FIXME("%p, %p: stub\n", iface, builder);
return E_NOTIMPL; }
-static HRESULT WINAPI dwritefactory3_CreateFontCollectionFromFontSet(IDWriteFactory5 *iface, IDWriteFontSet *fontset, +static HRESULT WINAPI dwritefactory3_CreateFontCollectionFromFontSet(IDWriteFactory7 *iface, IDWriteFontSet *fontset, IDWriteFontCollection1 **collection) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - - FIXME("(%p)->(%p %p): stub\n", This, fontset, collection); + FIXME("%p, %p, %p: stub\n", iface, fontset, collection);
return E_NOTIMPL; }
-static HRESULT WINAPI dwritefactory3_GetSystemFontCollection(IDWriteFactory5 *iface, BOOL include_downloadable, +static HRESULT WINAPI dwritefactory3_GetSystemFontCollection(IDWriteFactory7 *iface, BOOL include_downloadable, IDWriteFontCollection1 **collection, BOOL check_for_updates) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7(iface);
- TRACE("(%p)->(%d %p %d)\n", This, include_downloadable, collection, check_for_updates); + TRACE("%p, %d, %p, %d.\n", iface, include_downloadable, collection, check_for_updates);
if (include_downloadable) FIXME("remote fonts are not supported\n"); @@ -1525,28 +1501,24 @@ static HRESULT WINAPI dwritefactory3_GetSystemFontCollection(IDWriteFactory5 *if if (check_for_updates) FIXME("checking for system font updates not implemented\n");
- *collection = factory_get_system_collection(This); + *collection = factory_get_system_collection(factory);
return *collection ? S_OK : E_FAIL; }
-static HRESULT WINAPI dwritefactory3_GetFontDownloadQueue(IDWriteFactory5 *iface, IDWriteFontDownloadQueue **queue) +static HRESULT WINAPI dwritefactory3_GetFontDownloadQueue(IDWriteFactory7 *iface, IDWriteFontDownloadQueue **queue) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - - FIXME("(%p)->(%p): stub\n", This, queue); + FIXME("%p, %p: stub\n", iface, queue);
return E_NOTIMPL; }
-static HRESULT WINAPI dwritefactory4_TranslateColorGlyphRun(IDWriteFactory5 *iface, D2D1_POINT_2F baseline_origin, +static HRESULT WINAPI dwritefactory4_TranslateColorGlyphRun(IDWriteFactory7 *iface, D2D1_POINT_2F baseline_origin, DWRITE_GLYPH_RUN const *run, DWRITE_GLYPH_RUN_DESCRIPTION const *run_desc, DWRITE_GLYPH_IMAGE_FORMATS desired_formats, DWRITE_MEASURING_MODE measuring_mode, DWRITE_MATRIX const *transform, UINT32 palette, IDWriteColorGlyphRunEnumerator1 **layers) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - - FIXME("(%p)->(%p %p %u %d %p %u %p): stub\n", This, run, run_desc, desired_formats, measuring_mode, + FIXME("%p, %p, %p, %u, %d, %p, %u, %p: stub\n", iface, run, run_desc, desired_formats, measuring_mode, transform, palette, layers);
return E_NOTIMPL; @@ -1626,76 +1598,138 @@ static HRESULT compute_glyph_origins(DWRITE_GLYPH_RUN const *run, DWRITE_MEASURI return S_OK; }
-static HRESULT WINAPI dwritefactory4_ComputeGlyphOrigins_(IDWriteFactory5 *iface, DWRITE_GLYPH_RUN const *run, +static HRESULT WINAPI dwritefactory4_ComputeGlyphOrigins_(IDWriteFactory7 *iface, DWRITE_GLYPH_RUN const *run, D2D1_POINT_2F baseline_origin, D2D1_POINT_2F *origins) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - - TRACE("(%p)->(%p (%f,%f) %p)\n", This, run, baseline_origin.x, baseline_origin.y, origins); + TRACE("%p, %p, {%.8e,%.8e}, %p.\n", iface, run, baseline_origin.x, baseline_origin.y, origins);
return compute_glyph_origins(run, DWRITE_MEASURING_MODE_NATURAL, baseline_origin, NULL, origins); }
-static HRESULT WINAPI dwritefactory4_ComputeGlyphOrigins(IDWriteFactory5 *iface, DWRITE_GLYPH_RUN const *run, +static HRESULT WINAPI dwritefactory4_ComputeGlyphOrigins(IDWriteFactory7 *iface, DWRITE_GLYPH_RUN const *run, DWRITE_MEASURING_MODE measuring_mode, D2D1_POINT_2F baseline_origin, DWRITE_MATRIX const *transform, D2D1_POINT_2F *origins) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - - TRACE("(%p)->(%p %d (%f,%f) %p %p)\n", This, run, measuring_mode, baseline_origin.x, baseline_origin.y, + TRACE("%p, %p, %d, {%.8e,%.8e}, %p, %p.\n", iface, run, measuring_mode, baseline_origin.x, baseline_origin.y, transform, origins);
return compute_glyph_origins(run, measuring_mode, baseline_origin, transform, origins); }
-static HRESULT WINAPI dwritefactory5_CreateFontSetBuilder(IDWriteFactory5 *iface, IDWriteFontSetBuilder1 **builder) +static HRESULT WINAPI dwritefactory5_CreateFontSetBuilder(IDWriteFactory7 *iface, IDWriteFontSetBuilder1 **builder) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + FIXME("%p, %p: stub\n", iface, builder); + + return E_NOTIMPL; +}
- FIXME("(%p)->(%p): stub\n", This, builder); +static HRESULT WINAPI dwritefactory5_CreateInMemoryFontFileLoader(IDWriteFactory7 *iface, IDWriteFontFileLoader **loader) +{ + TRACE("%p, %p.\n", iface, loader); + + return create_inmemory_fileloader(loader); +} + +static HRESULT WINAPI dwritefactory5_CreateHttpFontFileLoader(IDWriteFactory7 *iface, WCHAR const *referrer_url, + WCHAR const *extra_headers, IDWriteRemoteFontFileLoader **loader) +{ + FIXME("%p, %s, %s, %p: stub\n", iface, debugstr_w(referrer_url), wine_dbgstr_w(extra_headers), loader);
return E_NOTIMPL; }
-static HRESULT WINAPI dwritefactory5_CreateInMemoryFontFileLoader(IDWriteFactory5 *iface, IDWriteFontFileLoader **loader) +static DWRITE_CONTAINER_TYPE WINAPI dwritefactory5_AnalyzeContainerType(IDWriteFactory7 *iface, void const *data, + UINT32 data_size) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + TRACE("%p, %p, %u.\n", iface, data, data_size);
- TRACE("(%p)->(%p)\n", This, loader); + return opentype_analyze_container_type(data, data_size); +}
- return create_inmemory_fileloader(loader); +static HRESULT WINAPI dwritefactory5_UnpackFontFile(IDWriteFactory7 *iface, DWRITE_CONTAINER_TYPE container_type, void const *data, + UINT32 data_size, IDWriteFontFileStream **stream) +{ + FIXME("%p, %d, %p, %u, %p: stub\n", iface, container_type, data, data_size, stream); + + return E_NOTIMPL; }
-static HRESULT WINAPI dwritefactory5_CreateHttpFontFileLoader(IDWriteFactory5 *iface, WCHAR const *referrer_url, WCHAR const *extra_headers, - IDWriteRemoteFontFileLoader **loader) +static HRESULT WINAPI dwritefactory6_CreateFontFaceReference(IDWriteFactory7 *iface, IDWriteFontFile *file, + UINT32 face_index, DWRITE_FONT_SIMULATIONS simulations, DWRITE_FONT_AXIS_VALUE const *axis_values, + UINT32 num_axis, IDWriteFontFaceReference1 **ref) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + FIXME("%p, %p, %u, %#x, %p, %u, %p.\n", iface, file, face_index, simulations, axis_values, num_axis, ref);
- FIXME("(%p)->(%s %s %p): stub\n", This, debugstr_w(referrer_url), wine_dbgstr_w(extra_headers), loader); + return E_NOTIMPL; +} + +static HRESULT WINAPI dwritefactory6_CreateFontResource(IDWriteFactory7 *iface, IDWriteFontFile *file, + UINT32 face_index, IDWriteFontResource **resource) +{ + FIXME("%p, %p, %u, %p.\n", iface, file, face_index, resource);
return E_NOTIMPL; }
-static DWRITE_CONTAINER_TYPE WINAPI dwritefactory5_AnalyzeContainerType(IDWriteFactory5 *iface, void const *data, UINT32 data_size) +static HRESULT WINAPI dwritefactory6_GetSystemFontSet(IDWriteFactory7 *iface, BOOL include_downloadable, + IDWriteFontSet1 **fontset) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + FIXME("%p, %d, %p.\n", iface, include_downloadable, fontset);
- TRACE("(%p)->(%p %u)\n", This, data, data_size); + return E_NOTIMPL; +}
- return opentype_analyze_container_type(data, data_size); +static HRESULT WINAPI dwritefactory6_GetSystemFontCollection(IDWriteFactory7 *iface, BOOL include_downloadable, + DWRITE_FONT_FAMILY_MODEL family_model, IDWriteFontCollection2 **collection) +{ + FIXME("%p, %d, %d, %p.\n", iface, include_downloadable, family_model, collection); + + return E_NOTIMPL; }
-static HRESULT WINAPI dwritefactory5_UnpackFontFile(IDWriteFactory5 *iface, DWRITE_CONTAINER_TYPE container_type, void const *data, - UINT32 data_size, IDWriteFontFileStream **stream) +static HRESULT WINAPI dwritefactory6_CreateFontCollectionFromFontSet(IDWriteFactory7 *iface, IDWriteFontSet *fontset, + DWRITE_FONT_FAMILY_MODEL family_model, IDWriteFontCollection2 **collection) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + FIXME("%p, %p, %d, %p.\n", iface, fontset, family_model, collection);
- FIXME("(%p)->(%d %p %u %p): stub\n", This, container_type, data, data_size, stream); + return E_NOTIMPL; +} + +static HRESULT WINAPI dwritefactory6_CreateFontSetBuilder(IDWriteFactory7 *iface, IDWriteFontSetBuilder2 **builder) +{ + FIXME("%p, %p.\n", iface, builder);
return E_NOTIMPL; }
-static const struct IDWriteFactory5Vtbl dwritefactoryvtbl = { +static HRESULT WINAPI dwritefactory6_CreateTextFormat(IDWriteFactory7 *iface, const WCHAR *familyname, + IDWriteFontCollection *collection, DWRITE_FONT_AXIS_VALUE const *axis_values, UINT32 num_axis, + FLOAT fontsize, const WCHAR *localename, IDWriteTextFormat3 **format) +{ + FIXME("%p, %s, %p, %p, %u, %.8e, %s, %p.\n", iface, debugstr_w(familyname), collection, axis_values, num_axis, + fontsize, debugstr_w(localename), format); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dwritefactory7_GetSystemFontSet(IDWriteFactory7 *iface, BOOL include_downloadable, + IDWriteFontSet2 **fontset) +{ + FIXME("%p, %d, %p.\n", iface, include_downloadable, fontset); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dwritefactory7_GetSystemFontCollection(IDWriteFactory7 *iface, BOOL include_downloadable, + DWRITE_FONT_FAMILY_MODEL family_model, IDWriteFontCollection3 **collection) +{ + FIXME("%p, %d, %d, %p.\n", iface, include_downloadable, family_model, collection); + + return E_NOTIMPL; +} + +static const struct IDWriteFactory7Vtbl dwritefactoryvtbl = +{ dwritefactory_QueryInterface, dwritefactory_AddRef, dwritefactory_Release, @@ -1744,23 +1778,33 @@ static const struct IDWriteFactory5Vtbl dwritefactoryvtbl = { dwritefactory5_CreateHttpFontFileLoader, dwritefactory5_AnalyzeContainerType, dwritefactory5_UnpackFontFile, + dwritefactory6_CreateFontFaceReference, + dwritefactory6_CreateFontResource, + dwritefactory6_GetSystemFontSet, + dwritefactory6_GetSystemFontCollection, + dwritefactory6_CreateFontCollectionFromFontSet, + dwritefactory6_CreateFontSetBuilder, + dwritefactory6_CreateTextFormat, + dwritefactory7_GetSystemFontSet, + dwritefactory7_GetSystemFontCollection, };
-static ULONG WINAPI shareddwritefactory_AddRef(IDWriteFactory5 *iface) +static ULONG WINAPI shareddwritefactory_AddRef(IDWriteFactory7 *iface) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - TRACE("(%p)\n", This); + TRACE("%p.\n", iface); + return 2; }
-static ULONG WINAPI shareddwritefactory_Release(IDWriteFactory5 *iface) +static ULONG WINAPI shareddwritefactory_Release(IDWriteFactory7 *iface) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); - TRACE("(%p)\n", This); + TRACE("%p.\n", iface); + return 1; }
-static const struct IDWriteFactory5Vtbl shareddwritefactoryvtbl = { +static const struct IDWriteFactory7Vtbl shareddwritefactoryvtbl = +{ dwritefactory_QueryInterface, shareddwritefactory_AddRef, shareddwritefactory_Release, @@ -1809,13 +1853,22 @@ static const struct IDWriteFactory5Vtbl shareddwritefactoryvtbl = { dwritefactory5_CreateHttpFontFileLoader, dwritefactory5_AnalyzeContainerType, dwritefactory5_UnpackFontFile, + dwritefactory6_CreateFontFaceReference, + dwritefactory6_CreateFontResource, + dwritefactory6_GetSystemFontSet, + dwritefactory6_GetSystemFontCollection, + dwritefactory6_CreateFontCollectionFromFontSet, + dwritefactory6_CreateFontSetBuilder, + dwritefactory6_CreateTextFormat, + dwritefactory7_GetSystemFontSet, + dwritefactory7_GetSystemFontCollection, };
static void init_dwritefactory(struct dwritefactory *factory, DWRITE_FACTORY_TYPE type) { - factory->IDWriteFactory5_iface.lpVtbl = type == DWRITE_FACTORY_TYPE_SHARED ? + factory->IDWriteFactory7_iface.lpVtbl = type == DWRITE_FACTORY_TYPE_SHARED ? &shareddwritefactoryvtbl : &dwritefactoryvtbl; - factory->ref = 1; + factory->refcount = 1; factory->localfontfileloader = get_local_fontfile_loader(); factory->system_collection = NULL; factory->eudc_collection = NULL; @@ -1832,7 +1885,7 @@ static void init_dwritefactory(struct dwritefactory *factory, DWRITE_FACTORY_TYP
void factory_detach_fontcollection(IDWriteFactory5 *iface, IDWriteFontCollection3 *collection) { - struct dwritefactory *factory = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7((IDWriteFactory7 *)iface); InterlockedCompareExchangePointer((void **)&factory->system_collection, NULL, collection); InterlockedCompareExchangePointer((void **)&factory->eudc_collection, NULL, collection); IDWriteFactory5_Release(iface); @@ -1840,7 +1893,7 @@ void factory_detach_fontcollection(IDWriteFactory5 *iface, IDWriteFontCollection
void factory_detach_gdiinterop(IDWriteFactory5 *iface, IDWriteGdiInterop1 *interop) { - struct dwritefactory *factory = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory7((IDWriteFactory7 *)iface); factory->gdiinterop = NULL; IDWriteFactory5_Release(iface); } @@ -1855,7 +1908,7 @@ HRESULT WINAPI DWriteCreateFactory(DWRITE_FACTORY_TYPE type, REFIID riid, IUnkno *ret = NULL;
if (type == DWRITE_FACTORY_TYPE_SHARED && shared_factory) - return IDWriteFactory5_QueryInterface(shared_factory, riid, (void**)ret); + return IDWriteFactory7_QueryInterface(shared_factory, riid, (void**)ret);
factory = heap_alloc(sizeof(struct dwritefactory)); if (!factory) return E_OUTOFMEMORY; @@ -1863,12 +1916,13 @@ HRESULT WINAPI DWriteCreateFactory(DWRITE_FACTORY_TYPE type, REFIID riid, IUnkno init_dwritefactory(factory, type);
if (type == DWRITE_FACTORY_TYPE_SHARED) - if (InterlockedCompareExchangePointer((void**)&shared_factory, &factory->IDWriteFactory5_iface, NULL)) { - release_shared_factory(&factory->IDWriteFactory5_iface); - return IDWriteFactory5_QueryInterface(shared_factory, riid, (void**)ret); + if (InterlockedCompareExchangePointer((void **)&shared_factory, &factory->IDWriteFactory7_iface, NULL)) + { + release_shared_factory(&factory->IDWriteFactory7_iface); + return IDWriteFactory7_QueryInterface(shared_factory, riid, (void**)ret); }
- hr = IDWriteFactory5_QueryInterface(&factory->IDWriteFactory5_iface, riid, (void**)ret); - IDWriteFactory5_Release(&factory->IDWriteFactory5_iface); + hr = IDWriteFactory7_QueryInterface(&factory->IDWriteFactory7_iface, riid, (void**)ret); + IDWriteFactory7_Release(&factory->IDWriteFactory7_iface); return hr; } diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index d565eee331..58f2af6e7a 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -9248,7 +9248,7 @@ static void test_font_resource(void)
if (!(factory = create_factory_iid(&IID_IDWriteFactory6))) { - skip("IDWriteFactory6 is not supported.\n"); + win_skip("IDWriteFactory6 is not supported.\n"); return; }
@@ -9259,8 +9259,17 @@ static void test_font_resource(void) ok(hr == S_OK, "Failed to get file object, hr %#x.\n", hr);
hr = IDWriteFactory6_CreateFontResource(factory, fontfile, 0, &resource); +todo_wine ok(hr == S_OK, "Failed to create font resource, hr %#x.\n", hr);
+ if (FAILED(hr)) + { + IDWriteFactory6_Release(factory); + IDWriteFontFile_Release(fontfile); + IDWriteFontFace_Release(fontface); + return; + } + hr = IDWriteFactory6_CreateFontResource(factory, fontfile, 0, &resource2); ok(hr == S_OK, "Failed to create font resource, hr %#x.\n", hr); ok(resource != resource2, "Unexpected instance.\n");