From 375aa0fc51d2a620710140a6b496b2ed202aebf4 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Mon, 23 May 2011 16:35:41 -0500 Subject: [PATCH 2/2] gdiplus: Implement DriverStringOptionsRealizedAdvance in software. --- dlls/gdiplus/graphics.c | 43 ++++++++++++++++++++++++++----------------- 1 files changed, 26 insertions(+), 17 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 1c7c7f4..5a2d477 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5661,9 +5661,9 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix ) { - static const INT unsupported_flags = ~(DriverStringOptionsCmapLookup); + static const INT unsupported_flags = ~(DriverStringOptionsCmapLookup|DriverStringOptionsRealizedAdvance); GpStatus stat; - PointF *real_positions; + PointF *real_positions, real_position; POINT *pti; HFONT hfont; HDC hdc; @@ -5682,12 +5682,6 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI if (length <= 0) return Ok; - if (flags & DriverStringOptionsRealizedAdvance) - { - FIXME("Not implemented for DriverStringOptionsRealizedAdvance\n"); - return NotImplemented; - } - if (!(flags & DriverStringOptionsCmapLookup)) ggo_flags |= GGO_GLYPH_INDEX; @@ -5697,22 +5691,31 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI if (matrix) FIXME("Ignoring matrix\n"); - real_positions = GdipAlloc(sizeof(PointF) * length); - if (!real_positions) - return OutOfMemory; - pti = GdipAlloc(sizeof(POINT) * length); if (!pti) - { - GdipFree(real_positions); return OutOfMemory; + + if (flags & DriverStringOptionsRealizedAdvance) + { + real_position = positions[0]; + + transform_and_round_points(graphics, pti, &real_position, 1); } + else + { + real_positions = GdipAlloc(sizeof(PointF) * length); + if (!real_positions) + { + GdipFree(pti); + return OutOfMemory; + } - memcpy(real_positions, positions, sizeof(PointF) * length); + memcpy(real_positions, positions, sizeof(PointF) * length); - transform_and_round_points(graphics, pti, real_positions, length); + transform_and_round_points(graphics, pti, real_positions, length); - GdipFree(real_positions); + GdipFree(real_positions); + } get_font_hfont(graphics, font, &hfont); @@ -5749,6 +5752,12 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI if (top < min_y) min_y = top; if (right > max_x) max_x = right; if (bottom > max_y) max_y = bottom; + + if (i+1 < length && (flags & DriverStringOptionsRealizedAdvance) == DriverStringOptionsRealizedAdvance) + { + pti[i+1].x = pti[i].x + glyphmetrics.gmCellIncX; + pti[i+1].y = pti[i].y + glyphmetrics.gmCellIncY; + } } glyph_mask = GdipAlloc(max_glyphsize); -- 1.7.1