2008-12-08 Carlos Alberto Cortez <calberto.cortez@gmail.com>
authorCarlos Alberto Cortez <calberto.cortez@gmail.com>
Mon, 8 Dec 2008 06:58:33 +0000 (06:58 -0000)
committerCarlos Alberto Cortez <calberto.cortez@gmail.com>
Mon, 8 Dec 2008 06:58:33 +0000 (06:58 -0000)
* 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

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Line.cs

index d1a1c4008e6e18637ca58463b90a0892fa8ff922..2eadfb02a51fdda1d390e246d2dc7163a9c04a04 100644 (file)
@@ -1,3 +1,10 @@
+2008-12-08  Carlos Alberto Cortez <calberto.cortez@gmail.com>
+
+       * 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  <contact@i-nz.net>
 
        * DataGridViewCheckBoxCell.cs: Fix to make it work. Wrong value was 
index 8266c58728ecdfc90387c4581072867fa72e9fcc..6089a5696f9f4d4e599401983962495ae910d73f 100644 (file)
@@ -467,7 +467,7 @@ namespace System.Windows.Forms
                        prev_ascent = this.ascent;\r
                        this.height = 0;                // Reset line height\r
                        this.ascent = 0;                // Reset the ascent for the line\r
-                       tag.Shift = 0;\r
+                       tag.Shift = 0;                  // Reset shift (which should be stored as pixels, not as points)\r
 \r
                        if (ending == LineEnding.Wrap)\r
                                widths[0] = document.left_margin + hanging_indent;\r
@@ -484,7 +484,7 @@ namespace System.Windows.Forms
 \r
                                while (tag.Length == 0) {       // We should always have tags after a tag.length==0 unless len==0\r
                                        //tag.Ascent = 0;\r
-                                       tag.Shift = tag.Line.ascent - tag.Ascent;\r
+                                       tag.Shift = (tag.Line.ascent - tag.Ascent) / 72;\r
                                        tag = tag.Next;\r
                                }\r
 \r
@@ -552,14 +552,14 @@ namespace System.Windows.Forms
                                                // We have a tag that has a taller ascent than the line;\r
                                                t = tags;\r
                                                while (t != null && t != tag) {\r
-                                                       t.Shift = tag.Ascent - t.Ascent;\r
+                                                       t.Shift = (tag.Ascent - t.Ascent) / 72;\r
                                                        t = t.Next;\r
                                                }\r
 \r
                                                // Save on our line\r
                                                this.ascent = tag.Ascent;\r
                                        } else {\r
-                                               tag.Shift = this.ascent - tag.Ascent;\r
+                                               tag.Shift = (this.ascent - tag.Ascent) / 72;\r
                                        }\r
 \r
                                        tag = tag.Next;\r
@@ -571,7 +571,7 @@ namespace System.Windows.Forms
                        }\r
 \r
                        while (tag != null) {   \r
-                               tag.Shift = tag.Line.ascent - tag.Ascent;\r
+                               tag.Shift = (tag.Line.ascent - tag.Ascent) / 72;\r
                                tag = tag.Next;\r
                        }\r
 \r