From: Carlos Alberto Cortez Date: Mon, 8 Dec 2008 06:58:33 +0000 (-0000) Subject: 2008-12-08 Carlos Alberto Cortez X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=83dc4b9b721719b49dd88faeebaf1fa76a71a1b9;p=mono.git 2008-12-08 Carlos Alberto Cortez * Line.cs: When calculating the text tags's Shift value, store it as pixels instead of points. This way we can actually handle different fonts in the same RichTextBox, as well as the right size of the caret. Fixes part of #351938. svn path=/trunk/mcs/; revision=120979 --- diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog index d1a1c4008e6..2eadfb02a51 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog @@ -1,3 +1,10 @@ +2008-12-08 Carlos Alberto Cortez + + * Line.cs: When calculating the text tags's Shift value, store it as + pixels instead of points. This way we can actually handle different + fonts in the same RichTextBox, as well as the right size of the caret. + Fixes part of #351938. + 2008-12-08 Ivan N. Zlatev * DataGridViewCheckBoxCell.cs: Fix to make it work. Wrong value was diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Line.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Line.cs index 8266c58728e..6089a5696f9 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Line.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Line.cs @@ -467,7 +467,7 @@ namespace System.Windows.Forms prev_ascent = this.ascent; this.height = 0; // Reset line height this.ascent = 0; // Reset the ascent for the line - tag.Shift = 0; + tag.Shift = 0; // Reset shift (which should be stored as pixels, not as points) if (ending == LineEnding.Wrap) widths[0] = document.left_margin + hanging_indent; @@ -484,7 +484,7 @@ namespace System.Windows.Forms while (tag.Length == 0) { // We should always have tags after a tag.length==0 unless len==0 //tag.Ascent = 0; - tag.Shift = tag.Line.ascent - tag.Ascent; + tag.Shift = (tag.Line.ascent - tag.Ascent) / 72; tag = tag.Next; } @@ -552,14 +552,14 @@ namespace System.Windows.Forms // We have a tag that has a taller ascent than the line; t = tags; while (t != null && t != tag) { - t.Shift = tag.Ascent - t.Ascent; + t.Shift = (tag.Ascent - t.Ascent) / 72; t = t.Next; } // Save on our line this.ascent = tag.Ascent; } else { - tag.Shift = this.ascent - tag.Ascent; + tag.Shift = (this.ascent - tag.Ascent) / 72; } tag = tag.Next; @@ -571,7 +571,7 @@ namespace System.Windows.Forms } while (tag != null) { - tag.Shift = tag.Line.ascent - tag.Ascent; + tag.Shift = (tag.Line.ascent - tag.Ascent) / 72; tag = tag.Next; }