dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnetlib ChangeLog System.Drawing/Graphics.cs Sy...


From: Radek Polak
Subject: [dotgnu-pnet-commits] pnetlib ChangeLog System.Drawing/Graphics.cs Sy...
Date: Thu, 12 Jul 2007 13:08:48 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    pnetlib
Changes by:     Radek Polak <radekp>    07/07/12 13:08:48

Modified files:
        .              : ChangeLog 
        System.Drawing : Graphics.cs StringFormat.cs 

Log message:
        do not count insets around text when using typographic string format

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnetlib/ChangeLog?cvsroot=dotgnu-pnet&r1=1.2509&r2=1.2510
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System.Drawing/Graphics.cs?cvsroot=dotgnu-pnet&r1=1.55&r2=1.56
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System.Drawing/StringFormat.cs?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/ChangeLog,v
retrieving revision 1.2509
retrieving revision 1.2510
diff -u -b -r1.2509 -r1.2510
--- ChangeLog   4 Jul 2007 08:38:48 -0000       1.2509
+++ ChangeLog   12 Jul 2007 13:08:47 -0000      1.2510
@@ -1,3 +1,11 @@
+2007-07-12  Radek Polak  <address@hidden>
+
+       * System.Drawing/StringFormat.cs: Remember and internally expose whether
+       this StringFormat is typographic.
+
+       * System.Drawing/Graphics.cs: Do not count with insets around text when
+       using typographic StringFormat.
+
 2007-07-04  Heiko Weiss <address@hidden>
 
        * System.Windows.Forms/Form.cs: Do not destroy form, when shown Modal, 
only

Index: System.Drawing/Graphics.cs
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/System.Drawing/Graphics.cs,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- System.Drawing/Graphics.cs  25 Jan 2007 20:08:50 -0000      1.55
+++ System.Drawing/Graphics.cs  12 Jul 2007 13:08:48 -0000      1.56
@@ -1566,7 +1566,12 @@
                                if(((Object)s) == null || s.Length == 0) { 
return; }
 
                                // make a little inset around the text 
dependent of the font size
-                               
layoutRectangle.Inflate((int)(-font.SizeInPoints*DpiX/369.7184), 0);
+                               // (only for non-typographic format) 
+                               if(format == null || !format.IsTypographic)
+                               {
+                                       layoutRectangle.Inflate(
+                                                               
(int)(-font.SizeInPoints*DpiX/369.7184), 0);
+                               }
 
                                // convert the layout into device coordinates
                                Point[] rect = ConvertRectangle
@@ -2916,7 +2921,11 @@
                                        else
                                        {
                                                // set the maximum x to the 
maximum width
-                                               xMax = (layout.Width - 1 - 
(int)(font.SizeInPoints*graphics.DpiX/369.7184));
+                                               xMax = (layout.Width - 1);
+                                               if(!format.IsTypographic)
+                                               {
+                                                       xMax -= 
(int)(font.SizeInPoints*graphics.DpiX/369.7184);
+                                               }
 
                                                // set the maximum y to the 
maximum height
                                                yMax = (layout.Height - 1);
@@ -3088,7 +3097,15 @@
                                        int initialPos = currentPos;
 
                                        // set the default x position
-                                       int x = 
(int)(f.SizeInPoints*g.DpiX/369.7184);
+                                       int x;
+                                       if(format.IsTypographic)
+                                       {
+                                               x = 0;
+                                       }
+                                       else
+                                       {
+                                               x = 
(int)(f.SizeInPoints*g.DpiX/369.7184);
+                                       }
 
                                        // set the default y position
                                        int y = 0;
@@ -3274,6 +3291,17 @@
                                // get the layout width
                                float width = layoutArea.Width;
 
+                               // constant that is added (only for 
non-typographic formats)
+                               float inset;
+                               if(format.IsTypographic)
+                               {
+                                       inset = 0;
+                               }
+                               else
+                               {
+                                       inset = 
font.SizeInPoints*DpiX/184.8592F;
+                               }
+
                                // return the size information based on 
wrapping behavior
                                if((format.FormatFlags & 
StringFormatFlags.NoWrap) == 0 &&
                                   ((size.Width >= width && width != 0.0f) || 
containsNL))
@@ -3295,7 +3323,7 @@
                                        // calculate and return the bounds of 
the text
                                        SizeF s = calculator.GetBounds
                                                (out charactersFitted, out 
linesFilled);
-                                       s.Width += 
font.SizeInPoints*DpiX/184.8592F;
+                                       s.Width += inset;
                                        return s;
                                }
                                else
@@ -3314,7 +3342,7 @@
                                        linesFilled = 1;
 
                                        // return the size of the text
-                                       return new SizeF(size.Width + 
font.SizeInPoints*DpiX/184.8592f, font.Height);
+                                       return new SizeF(size.Width + inset, 
font.Height);
                                }
                        }
 

Index: System.Drawing/StringFormat.cs
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/System.Drawing/StringFormat.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- System.Drawing/StringFormat.cs      5 Jun 2006 11:58:18 -0000       1.8
+++ System.Drawing/StringFormat.cs      12 Jul 2007 13:08:48 -0000      1.9
@@ -38,7 +38,7 @@
        internal CharacterRange[] ranges;
        private float firstTabOffset;
        private float[] tabStops;
-
+       internal bool IsTypographic;
 
        // Constructors.
        public StringFormat()
@@ -61,6 +61,7 @@
                                this.ranges = format.ranges;
                                this.firstTabOffset = format.firstTabOffset;
                                this.tabStops = format.tabStops;
+                               this.IsTypographic = format.IsTypographic;
                        }
        public StringFormat(StringFormatFlags options)
                        {
@@ -80,6 +81,7 @@
                                {
                                        this.options = 
(StringFormatFlags.LineLimit |
                                                        
StringFormatFlags.NoClip);
+                                       this.IsTypographic = true;
                                }
                                else
                                {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]