Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
-- v2: dwrite/opentype: Use mask shifts only for non-zero masks. dwrite/layout: Do not shadow output parameter. dwrite/layout: Always initialize effective run bounding box. dwrite: Always initialize 'contours' flag.
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/font.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 65bf7021938..0f1e57eb179 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -133,6 +133,8 @@ static int fontface_get_glyph_advance(struct dwrite_fontface *fontface, float fo struct cache_entry *entry; unsigned int value;
+ *has_contours = FALSE; + if (!(entry = fontface_get_cache_entry(fontface, 0, &key))) return 0;
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/layout.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 342f7e10886..03ab0bff31e 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -3762,6 +3762,8 @@ static void layout_get_erun_bbox(struct dwrite_textlayout *layout, struct layout unsigned int i; HRESULT hr;
+ memset(bbox, 0, sizeof(*bbox)); + if (run->bbox.top == run->bbox.bottom) { struct dwrite_glyphbitmap glyph_bitmap;
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/layout.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 03ab0bff31e..aefb49296b3 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -3767,7 +3767,6 @@ static void layout_get_erun_bbox(struct dwrite_textlayout *layout, struct layout if (run->bbox.top == run->bbox.bottom) { struct dwrite_glyphbitmap glyph_bitmap; - RECT *bbox;
glyph_run = regular->run; glyph_run.glyphCount = run->glyphcount; @@ -3779,8 +3778,6 @@ static void layout_get_erun_bbox(struct dwrite_textlayout *layout, struct layout glyph_bitmap.simulations = IDWriteFontFace_GetSimulations(glyph_run.fontFace); glyph_bitmap.emsize = glyph_run.fontEmSize;
- bbox = &glyph_bitmap.bbox; - if (!(origins = calloc(glyph_run.glyphCount, sizeof(*origins)))) return;
@@ -3798,10 +3795,10 @@ static void layout_get_erun_bbox(struct dwrite_textlayout *layout, struct layout glyph_bitmap.glyph = glyph_run.glyphIndices[i]; dwrite_fontface_get_glyph_bbox(glyph_run.fontFace, &glyph_bitmap);
- glyph_bbox.left = bbox->left; - glyph_bbox.top = bbox->top; - glyph_bbox.right = bbox->right; - glyph_bbox.bottom = bbox->bottom; + glyph_bbox.left = glyph_bitmap.bbox.left; + glyph_bbox.top = glyph_bitmap.bbox.top; + glyph_bbox.right = glyph_bitmap.bbox.right; + glyph_bbox.bottom = glyph_bitmap.bbox.bottom;
d2d_rect_offset(&glyph_bbox, origins[i].x, origins[i].y); d2d_rect_union(&run->bbox, &glyph_bbox);
From: Nikolay Sivov nsivov@codeweavers.com
Otherwise it's undefined.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/opentype.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index 51563cb2ea8..c36f7ba1f77 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -4822,7 +4822,7 @@ static unsigned int shaping_features_get_mask(const struct shaping_features *fea unsigned int shape_get_feature_1_mask(const struct shaping_features *features, unsigned int tag) { unsigned int shift, mask = shaping_features_get_mask(features, tag, &shift); - return (1 << shift) & mask; + return mask ? ((1 << shift) & mask) : 0; }
static void opentype_layout_get_glyph_range_for_text(struct scriptshaping_context *context, unsigned int start_char,