Author: jpobst
Date: 2007-10-08 11:34:03 -0400 (Mon, 08 Oct 2007)
New Revision: 87100
Modified:
trunk/mcs/class/Managed.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Line.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LineTag.cs
Log:
2007-10-08 Jonathan Pobst <[EMAIL PROTECTED]>
* TextBoxTextRenderer.cs: Abstract text measuring and drawing to this
class to allow us to use different backends on different platforms.
Linux uses the current [Draw|Measure]String backend. Windows uses
the TextRenderer.[Draw|Measure]Text backend, which uses GDI instead
of GDI+. This leads to better looking text and more accurate
measurements
on Windows, fixing many of the reported issues.
* Line.cs, LineTag.cs: Update to use TextBoxTextRenderer.
2007-10-08 Jonathan Pobst <[EMAIL PROTECTED]>
* System.Windows.Forms.dll.sources: Added TextBoxTextRenderer.cs.
Modified: trunk/mcs/class/Managed.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/ChangeLog 2007-10-08 15:19:23 UTC
(rev 87099)
+++ trunk/mcs/class/Managed.Windows.Forms/ChangeLog 2007-10-08 15:34:03 UTC
(rev 87100)
@@ -1,3 +1,7 @@
+2007-10-08 Jonathan Pobst <[EMAIL PROTECTED]>
+
+ * System.Windows.Forms.dll.sources: Added TextBoxTextRenderer.cs.
+
2007-10-07 Andreia Gaita <[EMAIL PROTECTED]>
* System.Windows.Forms.dll.sources: Added WebBrowserDialogs
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-10-08 15:19:23 UTC (rev 87099)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-10-08 15:34:03 UTC (rev 87100)
@@ -1,3 +1,13 @@
+2007-10-08 Jonathan Pobst <[EMAIL PROTECTED]>
+
+ * TextBoxTextRenderer.cs: Abstract text measuring and drawing to this
+ class to allow us to use different backends on different platforms.
+ Linux uses the current [Draw|Measure]String backend. Windows uses
+ the TextRenderer.[Draw|Measure]Text backend, which uses GDI instead
+ of GDI+. This leads to better looking text and more accurate
measurements
+ on Windows, fixing many of the reported issues.
+ * Line.cs, LineTag.cs: Update to use TextBoxTextRenderer.
+
2007-10-07 Carlos Alberto Cortez <[EMAIL PROTECTED]>
* FolderBrowserDialog.cs: When running on Windows,
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Line.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Line.cs
2007-10-08 15:19:23 UTC (rev 87099)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Line.cs
2007-10-08 15:34:03 UTC (rev 87100)
@@ -224,8 +224,8 @@
end_str = "\u0013\u0013\u0013";
break;
}
- dc.DrawString (end_str, last.font, last.color, X +
widths [TextLengthWithoutEnding ()] - document.viewport_x,
- y, Document.string_format);
+
+ TextBoxTextRenderer.DrawText (dc, end_str, last.font,
last.color, X + widths [TextLengthWithoutEnding ()] - document.viewport_x, y,
true);
}
/// <summary> Find the tag on a line based on the character
position, pos is 0-based</summary>
@@ -437,7 +437,7 @@
this.recalc = false;
widths[0] = document.left_margin + indent;
- w = g.MeasureString (doc.password_char, tags.font,
10000, Document.string_format).Width;
+ w = TextBoxTextRenderer.MeasureText (g,
doc.password_char, tags.font).Width;
if (this.height != (int)tag.font.Height)
ret = true;
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LineTag.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LineTag.cs
2007-10-08 15:19:23 UTC (rev 87099)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LineTag.cs
2007-10-08 15:34:03 UTC (rev 87100)
@@ -174,7 +174,7 @@
internal virtual void Draw (Graphics dc, Brush brush, float x,
float y, int start, int end)
{
- dc.DrawString (line.text.ToString (start, end), font,
brush, x, y, StringFormat.GenericTypographic);
+ TextBoxTextRenderer.DrawText (dc, line.text.ToString
(start, end), font, brush, x, y, false);
}
internal virtual void Draw (Graphics dc, Brush brush, float
xoff, float y, int start, int end, string text)
@@ -183,12 +183,12 @@
int tab_index = text.IndexOf ("\t", start);
if (tab_index == -1)
tab_index = end;
- dc.DrawString (text.Substring (start, tab_index
- start), font, brush, xoff + line.widths[start],
- y,
StringFormat.GenericTypographic);
+ TextBoxTextRenderer.DrawText (dc,
text.Substring (start, tab_index - start), font, brush, xoff +
line.widths[start], y, false);
+
// non multilines get the unknown char
if (!line.document.multiline && tab_index !=
end)
- dc.DrawString ("\u0013", font, brush,
xoff + line.widths[tab_index], y, Document.string_format);
+ TextBoxTextRenderer.DrawText (dc,
"\u0013", font, brush, xoff + line.widths[tab_index], y, true);
start = tab_index + 1;
}
@@ -351,15 +351,15 @@
case '\t':
if (!line.document.multiline)
goto case 10;
- SizeF res = dc.MeasureString (" ", font, 10000,
Document.string_format);
+ SizeF res = TextBoxTextRenderer.MeasureText
(dc, " ", font);
res.Width *= 8.0F;
return res;
case 10:
case 13:
- return dc.MeasureString ("\u0013", font, 10000,
Document.string_format);
+ return TextBoxTextRenderer.MeasureText (dc,
"\u0013", font);
}
- return dc.MeasureString (text, font, 10000,
Document.string_format);
+ return TextBoxTextRenderer.MeasureText (dc, text, font);
}
public virtual string Text ()
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
2007-10-08 15:19:23 UTC (rev 87099)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
2007-10-08 15:34:03 UTC (rev 87100)
@@ -647,6 +647,7 @@
System.Windows.Forms/TextBox.cs
System.Windows.Forms/TextBoxBase.cs
System.Windows.Forms/TextBoxRenderer.cs
+System.Windows.Forms/TextBoxTextRenderer.cs
System.Windows.Forms/TextControl.cs
System.Windows.Forms/TextDataFormat.cs
System.Windows.Forms/TextFormatFlags.cs
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches