Permalink
Browse files

2007-08-13 Sebastien Pouliot <sebastien@ximian.com>

	* text-pango.c: Ensure we can use the results of MeasureString to 
	DrawString and get the same results.


svn path=/trunk/libgdiplus/; revision=83952
  • Loading branch information...
1 parent 76067f6 commit 04c64a40a2afe372c59ba52701be99d4bb5b08eb Sebastien Pouliot committed Aug 13, 2007
Showing with 8 additions and 2 deletions.
  1. +5 −0 src/ChangeLog
  2. +3 −2 src/text-pango.c
View
@@ -1,3 +1,8 @@
+2007-08-13 Sebastien Pouliot <sebastien@ximian.com>
+
+ * text-pango.c: Ensure we can use the results of MeasureString to
+ DrawString and get the same results.
+
2007-08-13 Sebastien Pouliot <sebastien@ximian.com>
* text.notes: New. Notes about text rendering.
View
@@ -268,7 +268,8 @@ gdip_pango_setup_layout (cairo_t *ct, GDIPCONST WCHAR *stringUnicode, int length
box->X = rc->X;
box->Y = rc->Y;
box->Height = logical.height;
- box->Width = logical.width;
+ /* add an extra pixel for our AA hack + 2 more if we don't draw on the box itself */
+ box->Width = logical.width + (fmt->formatFlags & StringFormatFlagsNoFitBlackBox) ? 1 : 3;
//g_warning ("\tbox\t[x %g, y %g, w %g, h %g]", box->X, box->Y, box->Width, box->Height);
/* vertical alignment*/
@@ -401,7 +402,7 @@ pango_MeasureCharacterRanges (GpGraphics *graphics, GDIPCONST WCHAR *stringUnico
charRect.Y = (float)box.y / PANGO_SCALE;
charRect.Width = (float)box.width / PANGO_SCALE;
charRect.Height = (float)box.height / PANGO_SCALE;
-
+//g_warning ("[%d] [%d : %d-%d] %c [x %g y %g w %g h %g]", i, j, start, end, (char)stringUnicode[j], charRect.X, charRect.Y, charRect.Width, charRect.Height);
status = GdipCombineRegionRect (regions [i], &charRect, CombineModeUnion);
if (status != Ok)
break;

0 comments on commit 04c64a4

Please sign in to comment.