Commit b0f50e7e authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Partially implement GetGlyphImageFormats().

parent 377d0e26
......@@ -229,6 +229,7 @@ extern UINT32 opentype_get_cpal_paletteentrycount(const void*) DECLSPEC_HIDDEN;
extern HRESULT opentype_get_cpal_entries(const void*,UINT32,UINT32,UINT32,DWRITE_COLOR_F*) DECLSPEC_HIDDEN;
extern HRESULT opentype_get_font_signature(struct file_stream_desc*,FONTSIGNATURE*) DECLSPEC_HIDDEN;
extern BOOL opentype_has_vertical_variants(IDWriteFontFace4*) DECLSPEC_HIDDEN;
extern UINT32 opentype_get_glyph_image_formats(IDWriteFontFace4*) DECLSPEC_HIDDEN;
struct dwrite_colorglyph {
USHORT layer; /* [0, num_layers) index indicating current layer */
......
......@@ -242,6 +242,7 @@ struct dwrite_fontface {
DWRITE_FONT_STRETCH stretch;
DWRITE_FONT_WEIGHT weight;
DWRITE_PANOSE panose;
UINT32 glyph_image_formats;
LOGFONTW lf;
};
......@@ -1278,8 +1279,10 @@ static HRESULT WINAPI dwritefontface4_GetGlyphImageFormats_(IDWriteFontFace4 *if
static DWRITE_GLYPH_IMAGE_FORMATS WINAPI dwritefontface4_GetGlyphImageFormats(IDWriteFontFace4 *iface)
{
struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface);
FIXME("(%p): stub\n", This);
return DWRITE_GLYPH_IMAGE_FORMATS_NONE;
TRACE("(%p)\n", This);
return This->glyph_image_formats;
}
static HRESULT WINAPI dwritefontface4_GetGlyphImageData(IDWriteFontFace4 *iface, UINT16 glyph,
......@@ -4345,6 +4348,7 @@ HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_li
fontface->flags |= FONTFACE_IS_MONOSPACED;
if (opentype_has_vertical_variants(&fontface->IDWriteFontFace4_iface))
fontface->flags |= FONTFACE_HAS_VERTICAL_VARIANTS;
fontface->glyph_image_formats = opentype_get_glyph_image_formats(&fontface->IDWriteFontFace4_iface);
/* Font properties are reused from font object when 'normal' face creation path is used:
collection -> family -> matching font -> fontface.
......
......@@ -34,6 +34,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
#define MS_GPOS_TAG DWRITE_MAKE_OPENTYPE_TAG('G','P','O','S')
#define MS_GSUB_TAG DWRITE_MAKE_OPENTYPE_TAG('G','S','U','B')
#define MS_NAME_TAG DWRITE_MAKE_OPENTYPE_TAG('n','a','m','e')
#define MS_GLYF_TAG DWRITE_MAKE_OPENTYPE_TAG('g','l','y','f')
#define MS_CFF__TAG DWRITE_MAKE_OPENTYPE_TAG('C','F','F',' ')
#define MS_COLR_TAG DWRITE_MAKE_OPENTYPE_TAG('C','O','L','R')
#ifdef WORDS_BIGENDIAN
#define GET_BE_WORD(x) (x)
......@@ -2034,3 +2037,38 @@ BOOL opentype_has_vertical_variants(IDWriteFontFace4 *fontface)
return ret;
}
static BOOL opentype_has_font_table(IDWriteFontFace4 *fontface, UINT32 tag)
{
BOOL exists = FALSE;
const void *data;
void *context;
UINT32 size;
HRESULT hr;
hr = IDWriteFontFace4_TryGetFontTable(fontface, tag, &data, &size, &context, &exists);
if (FAILED(hr))
return FALSE;
if (exists)
IDWriteFontFace4_ReleaseFontTable(fontface, context);
return exists;
}
UINT32 opentype_get_glyph_image_formats(IDWriteFontFace4 *fontface)
{
UINT32 ret = DWRITE_GLYPH_IMAGE_FORMATS_NONE;
if (opentype_has_font_table(fontface, MS_GLYF_TAG))
ret |= DWRITE_GLYPH_IMAGE_FORMATS_TRUETYPE;
if (opentype_has_font_table(fontface, MS_CFF__TAG))
ret |= DWRITE_GLYPH_IMAGE_FORMATS_CFF;
if (opentype_has_font_table(fontface, MS_COLR_TAG))
ret |= DWRITE_GLYPH_IMAGE_FORMATS_COLR;
/* TODO: handle SVG and bitmap data */
return ret;
}
......@@ -7504,7 +7504,6 @@ static void test_GetGlyphImageFormats(void)
/* Mask describes font as a whole. */
formats = IDWriteFontFace4_GetGlyphImageFormats(fontface4);
expected_formats = get_face_glyph_image_formats(fontface4);
todo_wine
ok(formats == expected_formats, "%s - %s, expected formats %#x, got formats %#x.\n",
wine_dbgstr_w(familynameW), wine_dbgstr_w(facenameW), expected_formats, formats);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment