[PATCH 2/5] dwrite: Set initial canBreakShapingAfter flags.

Nikolay Sivov nsivov at codeweavers.com
Thu Jun 11 07:08:57 CDT 2020


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/dwrite/analyzer.c       | 22 +++++++++++-----------
 dlls/dwrite/dwrite_private.h |  3 +++
 dlls/dwrite/opentype.c       |  6 +++++-
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c
index af4325248a7..f3eca12f96b 100644
--- a/dlls/dwrite/analyzer.c
+++ b/dlls/dwrite/analyzer.c
@@ -1167,9 +1167,6 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphs(IDWriteTextAnalyzer2 *iface,
 
     get_number_substitutes(substitution, is_rtl, digits);
 
-    /* FIXME: have the shaping engine set this */
-    memset(text_props, 0, length * sizeof(*text_props));
-
     font_obj = unsafe_impl_from_IDWriteFontFace(fontface);
 
     context.cache = fontface_get_shaping_cache(font_obj);
@@ -1179,6 +1176,7 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphs(IDWriteTextAnalyzer2 *iface,
     context.is_sideways = is_sideways;
     context.u.subst.glyphs = heap_calloc(max_glyph_count, sizeof(*glyphs));
     context.u.subst.glyph_props = heap_calloc(max_glyph_count, sizeof(*glyph_props));
+    context.u.subst.text_props = text_props;
     context.u.subst.clustermap = clustermap;
     context.u.subst.max_glyph_count = max_glyph_count;
     context.u.subst.capacity = max_glyph_count;
@@ -1208,7 +1206,7 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphs(IDWriteTextAnalyzer2 *iface,
 }
 
 static HRESULT WINAPI dwritetextanalyzer_GetGlyphPlacements(IDWriteTextAnalyzer2 *iface,
-    WCHAR const* text, UINT16 const* clustermap, DWRITE_SHAPING_TEXT_PROPERTIES* props,
+    WCHAR const* text, UINT16 const* clustermap, DWRITE_SHAPING_TEXT_PROPERTIES *text_props,
     UINT32 text_len, UINT16 const* glyphs, DWRITE_SHAPING_GLYPH_PROPERTIES const* glyph_props,
     UINT32 glyph_count, IDWriteFontFace *fontface, float emSize, BOOL is_sideways, BOOL is_rtl,
     DWRITE_SCRIPT_ANALYSIS const* analysis, WCHAR const* locale, DWRITE_TYPOGRAPHIC_FEATURES const** features,
@@ -1220,8 +1218,8 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphPlacements(IDWriteTextAnalyzer2
     unsigned int i, script;
     HRESULT hr;
 
-    TRACE("(%s %p %p %u %p %p %u %p %.2f %d %d %s %s %p %p %u %p %p)\n", debugstr_wn(text, text_len),
-        clustermap, props, text_len, glyphs, glyph_props, glyph_count, fontface, emSize, is_sideways,
+    TRACE("%s, %p, %p, %u, %p, %p, %u, %p, %.2f, %d, %d, %s, %s, %p, %p, %u, %p, %p.\n", debugstr_wn(text, text_len),
+        clustermap, text_props, text_len, glyphs, glyph_props, glyph_count, fontface, emSize, is_sideways,
         is_rtl, debugstr_sa_script(analysis->script), debugstr_w(locale), features, feature_range_lengths,
         feature_ranges, advances, offsets);
 
@@ -1253,6 +1251,7 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphPlacements(IDWriteTextAnalyzer2
     context.is_sideways = is_sideways;
     context.u.pos.glyphs = glyphs;
     context.u.pos.glyph_props = glyph_props;
+    context.u.pos.text_props = text_props;
     context.u.pos.clustermap = clustermap;
     context.glyph_count = glyph_count;
     context.emsize = emSize;
@@ -1274,7 +1273,7 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphPlacements(IDWriteTextAnalyzer2
 }
 
 static HRESULT WINAPI dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(IDWriteTextAnalyzer2 *iface,
-    WCHAR const* text, UINT16 const* clustermap, DWRITE_SHAPING_TEXT_PROPERTIES* props,
+    WCHAR const* text, UINT16 const* clustermap, DWRITE_SHAPING_TEXT_PROPERTIES *text_props,
     UINT32 text_len, UINT16 const* glyphs, DWRITE_SHAPING_GLYPH_PROPERTIES const* glyph_props,
     UINT32 glyph_count, IDWriteFontFace *fontface, float emSize, float ppdip,
     DWRITE_MATRIX const* transform, BOOL use_gdi_natural, BOOL is_sideways, BOOL is_rtl,
@@ -1288,10 +1287,10 @@ static HRESULT WINAPI dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(IDWrite
     unsigned int i, script;
     HRESULT hr;
 
-    TRACE("(%s %p %p %u %p %p %u %p %.2f %.2f %p %d %d %d %s %s %p %p %u %p %p)\n", debugstr_wn(text, text_len),
-        clustermap, props, text_len, glyphs, glyph_props, glyph_count, fontface, emSize, ppdip,
-        transform, use_gdi_natural, is_sideways, is_rtl, debugstr_sa_script(analysis->script), debugstr_w(locale),
-        features, feature_range_lengths, feature_ranges, advances, offsets);
+    TRACE("%s, %p, %p, %u, %p, %p, %u, %p, %.2f, %.2f, %p, %d, %d, %d, %s, %s, %p, %p, %u, %p, %p.\n",
+            debugstr_wn(text, text_len), clustermap, text_props, text_len, glyphs, glyph_props, glyph_count, fontface,
+            emSize, ppdip, transform, use_gdi_natural, is_sideways, is_rtl, debugstr_sa_script(analysis->script),
+            debugstr_w(locale), features, feature_range_lengths, feature_ranges, advances, offsets);
 
     analyzer_dump_user_features(features, feature_range_lengths, feature_ranges);
 
@@ -1323,6 +1322,7 @@ static HRESULT WINAPI dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(IDWrite
     context.is_sideways = is_sideways;
     context.u.pos.glyphs = glyphs;
     context.u.pos.glyph_props = glyph_props;
+    context.u.pos.text_props = text_props;
     context.u.pos.clustermap = clustermap;
     context.glyph_count = glyph_count;
     context.emsize = emSize * ppdip;
diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h
index 7c8a5c9d896..4cb35a44e49 100644
--- a/dlls/dwrite/dwrite_private.h
+++ b/dlls/dwrite/dwrite_private.h
@@ -552,6 +552,7 @@ struct scriptshaping_context
         {
             const UINT16 *glyphs;
             const DWRITE_SHAPING_GLYPH_PROPERTIES *glyph_props;
+            DWRITE_SHAPING_TEXT_PROPERTIES *text_props;
             const UINT16 *clustermap;
             p_apply_context_lookup apply_context_lookup;
         } pos;
@@ -559,6 +560,7 @@ struct scriptshaping_context
         {
             UINT16 *glyphs;
             DWRITE_SHAPING_GLYPH_PROPERTIES *glyph_props;
+            DWRITE_SHAPING_TEXT_PROPERTIES *text_props;
             UINT16 *clustermap;
             p_apply_context_lookup apply_context_lookup;
             unsigned int max_glyph_count;
@@ -569,6 +571,7 @@ struct scriptshaping_context
         {
             UINT16 *glyphs;
             struct shaping_glyph_properties *glyph_props;
+            DWRITE_SHAPING_TEXT_PROPERTIES *text_props;
             UINT16 *clustermap;
             p_apply_context_lookup apply_context_lookup;
         } buffer;
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index e58ff34cb34..5def6042bee 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -5823,6 +5823,7 @@ static void opentype_get_nominal_glyphs(struct scriptshaping_context *context, c
     BOOL bmp;
 
     memset(context->u.subst.glyph_props, 0, context->u.subst.max_glyph_count * sizeof(*context->u.subst.glyph_props));
+    memset(context->u.buffer.text_props, 0, context->length * sizeof(*context->u.buffer.text_props));
 
     for (i = 0; i < context->length; ++i)
     {
@@ -5869,9 +5870,12 @@ static void opentype_get_nominal_glyphs(struct scriptshaping_context *context, c
 
         /* Set initial cluster map here, it's used for setting user features masks. */
         clustermap[i] = cluster_start_idx;
-        if (!bmp)
+        if (bmp)
+            context->u.buffer.text_props[i].canBreakShapingAfter = 1;
+        else
         {
             clustermap[i + 1] = cluster_start_idx;
+            context->u.buffer.text_props[i + 1].canBreakShapingAfter = 1;
             ++i;
         }
     }
-- 
2.26.2




More information about the wine-devel mailing list