Permalink
Browse files

2008-12-23 Sebastien Pouliot <sebastien@ximian.com>

	* text.c (GdipMeasureCharacterRanges): Don't handle empty (zero)
	width or height at this early stage.
	* text-cairo.c: Handle negative/zero width/height to match MS GDI+
	[Fix bug #449971]


svn path=/trunk/libgdiplus/; revision=122059
  • Loading branch information...
1 parent 224e7c7 commit 450f8d368676f6d893d5fe41cdd672b7083d3567 Sebastien Pouliot committed Dec 23, 2008
Showing with 22 additions and 1 deletion.
  1. +7 −0 src/ChangeLog
  2. +14 −0 src/text-cairo.c
  3. +1 −1 src/text.c
View
@@ -1,3 +1,10 @@
+2008-12-23 Sebastien Pouliot <sebastien@ximian.com>
+
+ * text.c (GdipMeasureCharacterRanges): Don't handle empty (zero)
+ width or height at this early stage.
+ * text-cairo.c: Handle negative/zero width/height to match MS GDI+
+ [Fix bug #449971]
+
2008-11-07 Sebastien Pouliot <sebastien@ximian.com>
* graphics-cairo.c (make_arc): Only compute start points if we
View
@@ -1124,6 +1124,20 @@ cairo_MeasureCharacterRanges (GpGraphics *graphics, GDIPCONST WCHAR *stringUnico
layoutRect->Height = gdip_unity_convgr (graphics, layout->Height);
}
+ if (layoutRect->Width <= 0.0) {
+ if (layoutRect->Height < 0.0) {
+ /* special case only if BOTH values are negative */
+ for (i = 0; i < format->charRangeCount; i++)
+ GdipSetInfinite (regions [i]);
+ return Ok;
+ } else {
+ layoutRect->Width = REGION_INFINITE_LENGTH;
+ }
+ }
+ if (layoutRect->Height <= 0.0) {
+ layoutRect->Height = REGION_INFINITE_LENGTH;
+ }
+
/* string measurements */
status = MeasureString (graphics, stringUnicode, &StringLen, font, layoutRect, format, NULL, NULL, NULL, NULL,
CleanString, StringDetails, &data);
View
@@ -107,7 +107,7 @@ GdipMeasureCharacterRanges (GpGraphics *graphics, GDIPCONST WCHAR *string, int l
return InvalidParameter;
/* No char range or bounding rect is set for measurements */
- if ((stringFormat->charRangeCount == 0) || (layoutRect->Width == 0) || (layoutRect->Height == 0)) {
+ if (stringFormat->charRangeCount == 0) {
*regions = NULL;
return Ok;
}

0 comments on commit 450f8d3

Please sign in to comment.