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

dwrite: Check for vertical variants only when asked.

parent a8e29f0e
...@@ -182,11 +182,12 @@ struct fontfacecached ...@@ -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 ...@@ -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;
......
...@@ -1217,7 +1217,7 @@ static BOOL WINAPI dwritefontface1_HasVerticalGlyphVariants(IDWriteFontFace5 *if ...@@ -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 ...@@ -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:
......
...@@ -6342,6 +6342,9 @@ BOOL opentype_has_vertical_variants(struct dwrite_fontface *fontface) ...@@ -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) ...@@ -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 ...@@ -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);
......
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