Module: wine Branch: master Commit: 8a0b57a9a1d1611f0b00170841fc526e3344d6c2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8a0b57a9a1d1611f0b00170841...
Author: Vincent Povirk vincent@codeweavers.com Date: Wed Mar 21 14:09:27 2012 -0500
gdiplus: Draw hotkey underlines in GdipDrawString.
---
dlls/gdiplus/graphics.c | 35 +++++++++++++++++++++++++++++++---- 1 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index c5ac9d1..89ed61b 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5038,16 +5038,43 @@ static GpStatus draw_string_callback(HDC hdc, { struct draw_string_args *args = user_data; PointF position; - - if (underlined_index_count) - FIXME("hotkey underlines not drawn yet\n"); + GpStatus stat;
position.X = args->x + bounds->X / args->rel_width; position.Y = args->y + bounds->Y / args->rel_height + args->ascent;
- return GdipDrawDriverString(args->graphics, &string[index], length, font, + stat = GdipDrawDriverString(args->graphics, &string[index], length, font, args->brush, &position, DriverStringOptionsCmapLookup|DriverStringOptionsRealizedAdvance, NULL); + + if (stat == Ok && underlined_index_count) + { + OUTLINETEXTMETRICW otm; + REAL underline_y, underline_height; + int i; + + GetOutlineTextMetricsW(hdc, sizeof(otm), &otm); + + underline_height = otm.otmsUnderscoreSize / args->rel_height; + underline_y = position.Y - otm.otmsUnderscorePosition / args->rel_height - underline_height / 2; + + for (i=0; i<underlined_index_count; i++) + { + REAL start_x, end_x; + SIZE text_size; + INT ofs = underlined_indexes[i] - index; + + GetTextExtentExPointW(hdc, string + index, ofs, INT_MAX, NULL, NULL, &text_size); + start_x = text_size.cx / args->rel_width; + + GetTextExtentExPointW(hdc, string + index, ofs+1, INT_MAX, NULL, NULL, &text_size); + end_x = text_size.cx / args->rel_width; + + GdipFillRectangle(args->graphics, (GpBrush*)args->brush, position.X+start_x, underline_y, end_x-start_x, underline_height); + } + } + + return stat; }
GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string,