From: Paul Gofman <pgofman@codeweavers.com> --- dlls/dwrite/dwrite_private.h | 1 + dlls/dwrite/font.c | 7 ++++++- dlls/dwrite/opentype.c | 9 ++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 2d7987d5159..393477e2a5b 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -205,6 +205,7 @@ enum font_flags FONTFACE_NO_KERNING_PAIRS = 0x00000010, FONTFACE_VERTICAL_VARIANTS = 0x00000020, FONTFACE_NO_VERTICAL_VARIANTS = 0x00000040, + FONT_COLR_V1_ONLY = 0x00000080, }; struct dwrite_cmap; diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index f207bade10e..3baa8d2d920 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -4370,7 +4370,12 @@ static HRESULT init_font_data(const struct fontface_desc *desc, DWRITE_FONT_FAMI fontstrings_get_en_string(data->family_names, familyW, ARRAY_SIZE(familyW)); fontstrings_get_en_string(data->names, faceW, ARRAY_SIZE(faceW)); - + if (props.flags & FONT_COLR_V1_ONLY) + { + FIXME("%s/%s COLRv1 is not supported.\n", debugstr_w(familyW), debugstr_w(faceW)); + release_font_data(data); + return DWRITE_E_FILEFORMAT; + } if (family_model == DWRITE_FONT_FAMILY_MODEL_WEIGHT_STRETCH_STYLE && font_apply_differentiation_rules(data, familyW, faceW)) { diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index 380732a8c85..c84f9103ea8 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -2091,6 +2091,7 @@ void opentype_get_font_metrics(struct file_stream_desc *stream_desc, DWRITE_FONT void opentype_get_font_properties(const struct file_stream_desc *stream_desc, struct dwrite_font_props *props) { struct dwrite_fonttable os2, head, post, colr, cpal; + const struct colr_header *header; BOOL is_symbol, is_monospaced; opentype_get_font_table(stream_desc, MS_OS2_TAG, &os2); @@ -2213,12 +2214,18 @@ void opentype_get_font_properties(const struct file_stream_desc *stream_desc, st /* FONT_IS_COLORED */ opentype_get_font_table(stream_desc, MS_COLR_TAG, &colr); - if (colr.data) + if (colr.data && (header = table_read_ensure(&colr, 0, sizeof(*header)))) { opentype_get_font_table(stream_desc, MS_CPAL_TAG, &cpal); if (cpal.data) { props->flags |= FONT_IS_COLORED; + /* COLRv1 may still have v0 data for backwards compat, so check num_baseglyph_records. */ + if (header->version && !header->num_baseglyph_records) + { + WARN("COLR version %d.\n", GET_BE_WORD(header->version)); + props->flags |= FONT_COLR_V1_ONLY; + } IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, cpal.context); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10388