dwrite: Check for vertical variants only when asked.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-03-08 11:30:49 +03:00 committed by Alexandre Julliard
parent a8e29f0ed7
commit f8e3cba746
3 changed files with 18 additions and 11 deletions

View File

@ -182,11 +182,12 @@ struct fontfacecached
enum font_flags enum font_flags
{ {
FONT_IS_SYMBOL = 1 << 0, FONT_IS_SYMBOL = 0x00000001,
FONT_IS_MONOSPACED = 1 << 1, FONT_IS_MONOSPACED = 0x00000002,
FONT_IS_COLORED = 1 << 2, /* CPAL/COLR support */ FONT_IS_COLORED = 0x00000004, /* CPAL/COLR support */
FONTFACE_HAS_KERNING_PAIRS = 1 << 3, FONTFACE_HAS_KERNING_PAIRS = 0x00000008,
FONTFACE_HAS_VERTICAL_VARIANTS = 1 << 4 FONTFACE_VERTICAL_VARIANTS = 0x00000010,
FONTFACE_NO_VERTICAL_VARIANTS = 0x00000020,
}; };
struct dwrite_cmap; struct dwrite_cmap;
@ -257,7 +258,7 @@ struct dwrite_fontface
unsigned int ascent; unsigned int ascent;
unsigned int descent; unsigned int descent;
} typo_metrics; } typo_metrics;
UINT32 flags; unsigned int flags;
struct dwrite_cmap cmap; struct dwrite_cmap cmap;

View File

@ -1217,7 +1217,7 @@ static BOOL WINAPI dwritefontface1_HasVerticalGlyphVariants(IDWriteFontFace5 *if
TRACE("%p.\n", iface); TRACE("%p.\n", iface);
return !!(fontface->flags & FONTFACE_HAS_VERTICAL_VARIANTS); return opentype_has_vertical_variants(fontface);
} }
static BOOL WINAPI dwritefontface2_IsColorFont(IDWriteFontFace5 *iface) static BOOL WINAPI dwritefontface2_IsColorFont(IDWriteFontFace5 *iface)
@ -5004,8 +5004,6 @@ HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_li
if (freetype_has_kerning_pairs(&fontface->IDWriteFontFace5_iface)) if (freetype_has_kerning_pairs(&fontface->IDWriteFontFace5_iface))
fontface->flags |= FONTFACE_HAS_KERNING_PAIRS; fontface->flags |= FONTFACE_HAS_KERNING_PAIRS;
if (opentype_has_vertical_variants(fontface))
fontface->flags |= FONTFACE_HAS_VERTICAL_VARIANTS;
fontface->glyph_image_formats = opentype_get_glyph_image_formats(&fontface->IDWriteFontFace5_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: /* Font properties are reused from font object when 'normal' face creation path is used:

View File

@ -6342,6 +6342,9 @@ BOOL opentype_has_vertical_variants(struct dwrite_fontface *fontface)
struct lookups lookups = { 0 }; struct lookups lookups = { 0 };
UINT16 format; UINT16 format;
if (fontface->flags & (FONTFACE_VERTICAL_VARIANTS | FONTFACE_NO_VERTICAL_VARIANTS))
return !!(fontface->flags & FONTFACE_VERTICAL_VARIANTS);
context.cache = fontface_get_shaping_cache(fontface); context.cache = fontface_get_shaping_cache(fontface);
context.table = &context.cache->gsub; context.table = &context.cache->gsub;
@ -6384,7 +6387,12 @@ BOOL opentype_has_vertical_variants(struct dwrite_fontface *fontface)
heap_free(lookups.lookups); heap_free(lookups.lookups);
return !!count; if (count)
fontface->flags |= FONTFACE_VERTICAL_VARIANTS;
else
fontface->flags |= FONTFACE_NO_VERTICAL_VARIANTS;
return !!(fontface->flags & FONTFACE_VERTICAL_VARIANTS);
} }
HRESULT opentype_get_vertical_glyph_variants(struct dwrite_fontface *fontface, unsigned int glyph_count, HRESULT opentype_get_vertical_glyph_variants(struct dwrite_fontface *fontface, unsigned int glyph_count,
@ -6398,7 +6406,7 @@ HRESULT opentype_get_vertical_glyph_variants(struct dwrite_fontface *fontface, u
memcpy(glyphs, nominal_glyphs, glyph_count * sizeof(*glyphs)); memcpy(glyphs, nominal_glyphs, glyph_count * sizeof(*glyphs));
if (!(fontface->flags & FONTFACE_HAS_VERTICAL_VARIANTS)) if (!opentype_has_vertical_variants(fontface))
return S_OK; return S_OK;
context.cache = fontface_get_shaping_cache(fontface); context.cache = fontface_get_shaping_cache(fontface);