Commit 76b1f3fd authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Use temporary buffers for GetGlyphs().

parent 5625a8e5
......@@ -1173,10 +1173,11 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphs(IDWriteTextAnalyzer2 *iface,
context.length = length;
context.is_rtl = is_rtl;
context.is_sideways = is_sideways;
context.u.subst.glyphs = glyphs;
context.u.subst.glyph_props = glyph_props;
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.clustermap = clustermap;
context.u.subst.max_glyph_count = max_glyph_count;
context.u.subst.capacity = max_glyph_count;
context.u.subst.digits = digits;
context.language_tag = get_opentype_language(locale);
context.user_features.features = features;
......@@ -1190,10 +1191,14 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphs(IDWriteTextAnalyzer2 *iface,
if (SUCCEEDED(hr))
{
*actual_glyph_count = context.glyph_count;
memcpy(glyphs, context.u.subst.glyphs, context.glyph_count * sizeof(*glyphs));
memcpy(glyph_props, context.u.subst.glyph_props, context.glyph_count * sizeof(*glyph_props));
hr = default_shaping_ops.set_text_glyphs_props(&context, clustermap, glyphs, *actual_glyph_count,
text_props, glyph_props);
}
heap_free(context.u.subst.glyph_props);
heap_free(context.u.subst.glyphs);
heap_free(context.glyph_infos);
return hr;
......
......@@ -491,6 +491,7 @@ struct scriptshaping_context
DWRITE_SHAPING_GLYPH_PROPERTIES *glyph_props;
UINT16 *clustermap;
unsigned int max_glyph_count;
unsigned int capacity;
const WCHAR *digits;
} subst;
} u;
......
......@@ -400,5 +400,5 @@ HRESULT shape_get_glyphs(struct scriptshaping_context *context, const unsigned i
heap_free(features.features);
return S_OK;
return (context->glyph_count <= context->u.subst.max_glyph_count) ? S_OK : E_NOT_SUFFICIENT_BUFFER;
}
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