Author: toshok
Date: 2006-07-06 16:23:13 -0400 (Thu, 06 Jul 2006)
New Revision: 62329

Modified:
   trunk/libgdiplus/src/ChangeLog
   trunk/libgdiplus/src/graphics.c
Log:
2006-07-06  Chris Toshok  <[EMAIL PROTECTED]>

        * graphics.c (CalculateStringWidths): don't do the cairo call if
        we're dealing with a \n, as cairo says its extent is 7 pixels
        wide.
        (MeasureOrDrawString): add LineHeight to CursorY on a NEWLINE, not
        LineHeight * LineFeeds.
        (MeasureString): same.
        (GdipMeasureCharacterRanges): don't add strDetail[j].X/Y twice
        when creating the charRect.



Modified: trunk/libgdiplus/src/ChangeLog
===================================================================
--- trunk/libgdiplus/src/ChangeLog      2006-07-06 20:13:27 UTC (rev 62328)
+++ trunk/libgdiplus/src/ChangeLog      2006-07-06 20:23:13 UTC (rev 62329)
@@ -1,3 +1,14 @@
+2006-07-06  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * graphics.c (CalculateStringWidths): don't do the cairo call if
+       we're dealing with a \n, as cairo says its extent is 7 pixels
+       wide.
+       (MeasureOrDrawString): add LineHeight to CursorY on a NEWLINE, not
+       LineHeight * LineFeeds.
+       (MeasureString): same.
+       (GdipMeasureCharacterRanges): don't add strDetail[j].X/Y twice
+       when creating the charRect.
+
 2006-07-06  Sebastien Pouliot  <[EMAIL PROTECTED]> 
 
        * brush.c: Remove empty and unused gdip_brush_destroy;

Modified: trunk/libgdiplus/src/graphics.c
===================================================================
--- trunk/libgdiplus/src/graphics.c     2006-07-06 20:13:27 UTC (rev 62328)
+++ trunk/libgdiplus/src/graphics.c     2006-07-06 20:23:13 UTC (rev 62329)
@@ -2096,9 +2096,11 @@
        CurrentDetail = StringDetails;
 
        for (i = 0; i < StringDetailElements; i++) {
-               utf8[utf8_encode_ucs2char(*(stringUnicode + i), utf8)] = '\0';
-               cairo_text_extents(ct, (const char *) utf8, &ext);
-               CurrentDetail->Width = ext.x_advance;
+               if ((CurrentDetail->Flags & STRING_DETAIL_LF) == 0) {
+                       utf8[utf8_encode_ucs2char(*(stringUnicode + i), utf8)] 
= '\0';
+                       cairo_text_extents(ct, (const char *) utf8, &ext);
+                       CurrentDetail->Width = ext.x_advance;
+               }
                CurrentDetail++;
        }
 
@@ -2451,7 +2453,7 @@
                }
                if (CurrentDetail->Flags & STRING_DETAIL_LF) {
                        CursorX = 0;
-                       CursorY += CurrentDetail->Linefeeds*LineHeight;
+                       CursorY += LineHeight;
                        CurrentDetail->Flags |= STRING_DETAIL_LINESTART;
                        CurrentLineStart = CurrentDetail;
 #ifdef DRAWSTRING_DEBUG
@@ -3248,7 +3250,7 @@
                }
                if (CurrentDetail->Flags & STRING_DETAIL_LF) {
                        CursorX=0;
-                       CursorY+=CurrentDetail->Linefeeds*LineHeight;
+                       CursorY+=LineHeight;
                        CurrentDetail->Flags|=STRING_DETAIL_LINESTART;
                        CurrentLineStart=CurrentDetail;
 #ifdef DRAWSTRING_DEBUG
@@ -3697,15 +3699,15 @@
                                } else {
                                        /* Horizontal text */
                                        switch(format->alignment) {
-                                               case StringAlignmentNear: 
OffsetX = layoutRect->X + strDetails[j].PosX; break;
-                                               case StringAlignmentCenter: 
OffsetX = layoutRect->X + strDetails[j].PosX + (layoutRect->Width-strDetails[j 
+ strDetails[j].LineLen - 1].PosX - strDetails[j + strDetails[j].LineLen - 
1].Width)/2; break;
-                                               case StringAlignmentFar: 
OffsetX = layoutRect->X + strDetails[j].PosX + layoutRect->Width - strDetails[j 
+ strDetails[j].LineLen - 1].PosX - strDetails[j + strDetails[i].LineLen - 
1].Width; break;
+                                               case StringAlignmentNear: 
OffsetX = layoutRect->X; break;
+                                               case StringAlignmentCenter: 
OffsetX = layoutRect->X + (layoutRect->Width-strDetails[j + 
strDetails[j].LineLen - 1].PosX - strDetails[j + strDetails[j].LineLen - 
1].Width)/2; break;
+                                               case StringAlignmentFar: 
OffsetX = layoutRect->X + layoutRect->Width - strDetails[j + 
strDetails[j].LineLen - 1].PosX - strDetails[j + strDetails[i].LineLen - 
1].Width; break;
                                        }
 
                                        switch (format->lineAlignment) {
-                                               case StringAlignmentNear: 
OffsetY = layoutRect->Y + strDetails[j].PosY; break;
-                                               case StringAlignmentCenter: 
OffsetY = layoutRect->Y + (layoutRect->Height - maxY) / 2 + strDetails[j].PosY 
; break;
-                                               case StringAlignmentFar: 
OffsetY = layoutRect->Height - maxY + strDetails[j].PosY; break;
+                                               case StringAlignmentNear: 
OffsetY = layoutRect->Y; break;
+                                               case StringAlignmentCenter: 
OffsetY = layoutRect->Y + (layoutRect->Height - maxY) / 2 ; break;
+                                               case StringAlignmentFar: 
OffsetY = layoutRect->Height - maxY; break;
                                        }
                                }
                        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to