Commit 6ab04040 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

gdiplus: GdipMeasureCharacterRanges should treat empty layout extents as…

gdiplus: GdipMeasureCharacterRanges should treat empty layout extents as infinite when StringFormatFlagsNoClip is specified. Unlike GdipMeasureString which always treats empty layout extents as infinite.
parent db746fe8
......@@ -442,7 +442,7 @@ typedef GpStatus (*gdip_format_string_callback)(HDC hdc,
GpStatus gdip_format_string(HDC hdc,
GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font,
GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format,
GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip,
gdip_format_string_callback callback, void *user_data) DECLSPEC_HIDDEN;
void get_log_fontW(const GpFont *, GpGraphics *, LOGFONTW *) DECLSPEC_HIDDEN;
......
......@@ -4418,7 +4418,7 @@ GpStatus WINGDIPAPI GdipIsVisibleRectI(GpGraphics *graphics, INT x, INT y, INT w
GpStatus gdip_format_string(HDC hdc,
GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font,
GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format,
GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip,
gdip_format_string_callback callback, void *user_data)
{
WCHAR* stringdup;
......@@ -4441,6 +4441,11 @@ GpStatus gdip_format_string(HDC hdc,
nwidth = rect->Width;
nheight = rect->Height;
if (ignore_empty_clip)
{
if (!nwidth) nwidth = INT_MAX;
if (!nheight) nheight = INT_MAX;
}
if (format)
hkprefix = format->hkprefix;
......@@ -4698,7 +4703,7 @@ GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
args.regions = regions;
stat = gdip_format_string(hdc, string, length, font, &scaled_rect, stringFormat,
measure_ranges_callback, &args);
(stringFormat->attr & StringFormatFlagsNoClip) != 0, measure_ranges_callback, &args);
SelectObject(hdc, oldfont);
DeleteObject(gdifont);
......@@ -4806,8 +4811,8 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
if (scaled_rect.Width < 0.5) return Ok; /* doesn't fit */
}
if (scaled_rect.Width >= 1 << 23 || scaled_rect.Width < 0.5) scaled_rect.Width = 1 << 23;
if (scaled_rect.Height >= 1 << 23 || scaled_rect.Height < 0.5) scaled_rect.Height = 1 << 23;
if (scaled_rect.Width >= 1 << 23) scaled_rect.Width = 1 << 23;
if (scaled_rect.Height >= 1 << 23) scaled_rect.Height = 1 << 23;
get_font_hfont(graphics, font, format, &gdifont, NULL);
oldfont = SelectObject(hdc, gdifont);
......@@ -4822,7 +4827,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
args.linesfilled = &lines;
lines = glyphs = 0;
gdip_format_string(hdc, string, length, font, &scaled_rect, format,
gdip_format_string(hdc, string, length, font, &scaled_rect, format, TRUE,
measure_string_callback, &args);
if (linesfilled) *linesfilled = lines;
......@@ -4979,8 +4984,8 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
if (scaled_rect.Width < 0.5) return Ok; /* doesn't fit */
}
if (scaled_rect.Width >= 1 << 23 || scaled_rect.Width < 0.5) scaled_rect.Width = 1 << 23;
if (scaled_rect.Height >= 1 << 23 || scaled_rect.Height < 0.5) scaled_rect.Height = 1 << 23;
if (scaled_rect.Width >= 1 << 23) scaled_rect.Width = 1 << 23;
if (scaled_rect.Height >= 1 << 23) scaled_rect.Height = 1 << 23;
if (!(format_flags & StringFormatFlagsNoClip) &&
scaled_rect.Width != 1 << 23 && scaled_rect.Height != 1 << 23)
......@@ -5005,7 +5010,7 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string
GetTextMetricsW(hdc, &textmetric);
args.ascent = textmetric.tmAscent / rel_height;
gdip_format_string(hdc, string, length, font, &scaled_rect, format,
gdip_format_string(hdc, string, length, font, &scaled_rect, format, TRUE,
draw_string_callback, &args);
DeleteObject(rgn);
......
......@@ -1009,7 +1009,8 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT
args.maxY = 0;
args.scale = emSize / native_height;
args.ascent = textmetric.tmAscent * args.scale;
status = gdip_format_string(dc, string, length, NULL, &scaled_layout_rect, format, format_string_callback, &args);
status = gdip_format_string(dc, string, length, NULL, &scaled_layout_rect,
format, TRUE, format_string_callback, &args);
DeleteDC(dc);
DeleteObject(hfont);
......
......@@ -4050,13 +4050,9 @@ todo_wine
set_rect_empty(&bounds);
status = GdipGetRegionBounds(region, graphics, &bounds);
expect(Ok, status);
todo_wine
expectf_(5.0 + margin_x, bounds.X, 1.0);
todo_wine
expectf(5.0, bounds.Y);
todo_wine
expectf(width_rgn, bounds.Width);
todo_wine
expectf(height_rgn, bounds.Height);
rect.X = 5.0;
......@@ -4247,9 +4243,7 @@ todo_wine
expectf_(5.0 - width_rgn/2.0, bounds.X, 1.0);
todo_wine
expectf_(5.0 - height_rgn/2.0, bounds.Y, 1.0);
todo_wine
expectf_(width_rgn, bounds.Width, 1.0);
todo_wine
expectf_(height_rgn, bounds.Height, 1.0);
/* Far alignment */
......@@ -4317,9 +4311,7 @@ todo_wine
expectf_(5.0 - width_rgn, bounds.X, 2.0);
todo_wine
expectf_(5.0 - height_rgn, bounds.Y, 1.0);
todo_wine
expectf_(width_rgn, bounds.Width, 1.0);
todo_wine
expectf_(height_rgn, bounds.Height, 1.0);
status = GdipDeleteFont(font);
......
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