[System.Net] Add support for .pac proxy config scripts on mac
[mono.git] / mcs / class / System.Drawing / System.Drawing.Text / TextLineIterator.jvm.cs
index 1928f51ed92073d691245cdf246833c63ba3bd42..6be27b7029317b52b6778e59c8360359f0a0cdd2 100644 (file)
@@ -84,14 +84,28 @@ namespace System.Drawing.Text {
 
                #endregion
 
-               #region Properties
-
-               float WrapWidth {
-                       get { return (_format.IsVertical ? Height : Width) - (Margin * 2); }
+               #region Properties\r
+\r
+               float WrapWidth\r
+               {\r
+                       get {\r
+                               float widthOrHeight = _format.IsVertical ? Height : Width;\r
+                               if (!_format.IsGenericTypographic) {\r
+                                       widthOrHeight =\r
+                                               ((_format.IsVertical ? Height : Width) - (0.463f * FontSize)) / 1.028f;\r
+                               }\r
+                               return widthOrHeight;\r
+                       }\r
                }
 
-               internal float WrapHeight {
-                       get { return (_format.IsVertical ? Width : Height); }
+               internal float WrapHeight {\r
+                       get {\r
+                               float widthOrHeight = _format.IsVertical ? Width : Height;\r
+                               if (!_format.IsGenericTypographic) {\r
+                                       widthOrHeight = (_format.IsVertical ? Width : Height) / 1.08864f;\r
+                               }\r
+                               return widthOrHeight;
+                       }
                }
 
                internal float Width {
@@ -104,10 +118,31 @@ namespace System.Drawing.Text {
 
                internal StringFormat Format {
                        get { return _format; }
-               }
-
-               internal float Margin {
-                       get { return _margin; }
+               }\r
+\r
+               internal float PadWidth (float origWidth)\r
+               {\r
+                       if (Format.IsGenericTypographic)\r
+                               return origWidth;\r
+\r
+                       //This is a proximity to .NET calculated Width.\r
+                       return origWidth * 1.028f + 0.463f * FontSize;\r
+               }\r
+\r
+               internal float PadHeight (float origHeight)\r
+               {\r
+                       if (Format.IsGenericTypographic)\r
+                               return origHeight;\r
+\r
+                       //This is a proximity to .NET calculated Height.\r
+                       return 1.08864f * origHeight;\r
+               }               \r
+\r
+               internal float FontSize\r
+               {\r
+                       get {\r
+                               return _font.Size;\r
+                       }\r
                }
 
                internal int CharsConsumed {
@@ -159,9 +194,9 @@ namespace System.Drawing.Text {
                        LineLayout lineLayout = new LineLayout(
                                layout,
                                this,
-                               _accumulatedHeight);
-
-                       float lineHeight = lineLayout.Ascent + lineLayout.Descent;
+                               _accumulatedHeight);\r
+\r
+                       float lineHeight = PadHeight (lineLayout.Ascent + lineLayout.Descent + lineLayout.Leading);
                        
                        if (Format.LineLimit && (_accumulatedHeight + lineHeight > WrapHeight)) {
                                _charsConsumed += _currentPos;