Nikolay Sivov : dwrite: Check for vertical variants only when asked.

Alexandre Julliard julliard at winehq.org
Tue Mar 9 14:55:17 CST 2021


Module: wine
Branch: master
Commit: f8e3cba7462eaa936a14add168ffe2fcb7d839ef
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f8e3cba7462eaa936a14add168ffe2fcb7d839ef

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Mar  8 11:30:49 2021 +0300

dwrite: Check for vertical variants only when asked.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dwrite/dwrite_private.h | 13 +++++++------
 dlls/dwrite/font.c           |  4 +---
 dlls/dwrite/opentype.c       | 12 ++++++++++--
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h
index 4628a2a3704..27f4906a00d 100644
--- a/dlls/dwrite/dwrite_private.h
+++ b/dlls/dwrite/dwrite_private.h
@@ -182,11 +182,12 @@ struct fontfacecached
 
 enum font_flags
 {
-    FONT_IS_SYMBOL                 = 1 << 0,
-    FONT_IS_MONOSPACED             = 1 << 1,
-    FONT_IS_COLORED                = 1 << 2, /* CPAL/COLR support */
-    FONTFACE_HAS_KERNING_PAIRS     = 1 << 3,
-    FONTFACE_HAS_VERTICAL_VARIANTS = 1 << 4
+    FONT_IS_SYMBOL                 = 0x00000001,
+    FONT_IS_MONOSPACED             = 0x00000002,
+    FONT_IS_COLORED                = 0x00000004, /* CPAL/COLR support */
+    FONTFACE_HAS_KERNING_PAIRS     = 0x00000008,
+    FONTFACE_VERTICAL_VARIANTS     = 0x00000010,
+    FONTFACE_NO_VERTICAL_VARIANTS  = 0x00000020,
 };
 
 struct dwrite_cmap;
@@ -257,7 +258,7 @@ struct dwrite_fontface
         unsigned int ascent;
         unsigned int descent;
     } typo_metrics;
-    UINT32 flags;
+    unsigned int flags;
 
     struct dwrite_cmap cmap;
 
diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c
index 9386e9bec3f..5a96ccc71a0 100644
--- a/dlls/dwrite/font.c
+++ b/dlls/dwrite/font.c
@@ -1217,7 +1217,7 @@ static BOOL WINAPI dwritefontface1_HasVerticalGlyphVariants(IDWriteFontFace5 *if
 
     TRACE("%p.\n", iface);
 
-    return !!(fontface->flags & FONTFACE_HAS_VERTICAL_VARIANTS);
+    return opentype_has_vertical_variants(fontface);
 }
 
 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))
         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);
 
     /* Font properties are reused from font object when 'normal' face creation path is used:
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index 39943c52c9a..45967a12f0a 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -6342,6 +6342,9 @@ BOOL opentype_has_vertical_variants(struct dwrite_fontface *fontface)
     struct lookups lookups = { 0 };
     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.table = &context.cache->gsub;
 
@@ -6384,7 +6387,12 @@ BOOL opentype_has_vertical_variants(struct dwrite_fontface *fontface)
 
     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,
@@ -6398,7 +6406,7 @@ HRESULT opentype_get_vertical_glyph_variants(struct dwrite_fontface *fontface, u
 
     memcpy(glyphs, nominal_glyphs, glyph_count * sizeof(*glyphs));
 
-    if (!(fontface->flags & FONTFACE_HAS_VERTICAL_VARIANTS))
+    if (!opentype_has_vertical_variants(fontface))
         return S_OK;
 
     context.cache = fontface_get_shaping_cache(fontface);




More information about the wine-cvs mailing list