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

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

[Dotgnu-pnet-commits] CVS: pnetlib/Xsharp FontStyle.cs,1.1,1.2 XsharpSu


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/Xsharp FontStyle.cs,1.1,1.2 XsharpSupport.c,1.3,1.4
Date: Mon, 09 Jun 2003 17:25:40 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/Xsharp
In directory subversions:/tmp/cvs-serv18924/Xsharp

Modified Files:
        FontStyle.cs XsharpSupport.c 
Log Message:


Font management; texture brushes; some type converters;
system brushes and pens.


Index: FontStyle.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/FontStyle.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** FontStyle.cs        28 May 2003 04:17:53 -0000      1.1
--- FontStyle.cs        9 Jun 2003 21:25:37 -0000       1.2
***************
*** 35,39 ****
        Bold            = (1<<0),
        Italic          = (1<<1),
!       Underlined      = (1<<2)
  
  } // enum FontStyle
--- 35,40 ----
        Bold            = (1<<0),
        Italic          = (1<<1),
!       Underlined      = (1<<2),
!       StrikeOut       = (1<<3),
  
  } // enum FontStyle

Index: XsharpSupport.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/XsharpSupport.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** XsharpSupport.c     7 Jun 2003 09:59:18 -0000       1.3
--- XsharpSupport.c     9 Jun 2003 21:25:37 -0000       1.4
***************
*** 88,91 ****
--- 88,92 ----
  #define       FontStyle_Italic                2
  #define       FontStyle_Underline             4
+ #define       FontStyle_StrikeOut             8
  
  /*
***************
*** 205,219 ****
                                          const char *str, int style)
  {
        XmbDrawString(dpy, drawable, fontSet, gc, x, y,
                                  str, strlen(str));
        if((style & FontStyle_Underline) != 0)
        {
!               XRectangle overall_ink_return;
!               XRectangle overall_logical_return;
                XmbTextExtents(fontSet, str, strlen(str),
                                           &overall_ink_return, 
&overall_logical_return);
                XSetLineAttributes(dpy, gc, 1, LineSolid, CapNotLast, 
JoinMiter);
!               XDrawLine(dpy, drawable, gc, x, y + 2,
!                                 x + overall_logical_return.width, y + 2);
        }
  }
--- 206,260 ----
                                          const char *str, int style)
  {
+       XRectangle overall_ink_return;
+       XRectangle overall_logical_return;
+       XFontSetExtents *extents;
+       int line1, line2;
+ 
+       /* Draw the string itself */
        XmbDrawString(dpy, drawable, fontSet, gc, x, y,
                                  str, strlen(str));
+ 
+       /* Calculate the positions of the underline and strike-out */
        if((style & FontStyle_Underline) != 0)
        {
!               line1 = y + 2;
!       }
!       else
!       {
!               line1 = y;
!       }
!       if((style & FontStyle_StrikeOut) != 0)
!       {
!               extents = XExtentsOfFontSet(fontSet);
!               if(extents)
!               {
!                       line2 = y + (extents->max_logical_extent.y / 2);
!               }
!               else
!               {
!                       line2 = y;
!               }
!       }
!       else
!       {
!               line2 = y;
!       }
! 
!       /* Draw the underline and strike-out */
!       if(line1 != y || line2 != y)
!       {
                XmbTextExtents(fontSet, str, strlen(str),
                                           &overall_ink_return, 
&overall_logical_return);
                XSetLineAttributes(dpy, gc, 1, LineSolid, CapNotLast, 
JoinMiter);
!               if(line1 != y)
!               {
!                       XDrawLine(dpy, drawable, gc, x, line1,
!                                         x + overall_logical_return.width, 
line1);
!               }
!               if(line2 != y)
!               {
!                       XDrawLine(dpy, drawable, gc, x, line2,
!                                         x + overall_logical_return.width, 
line2);
!               }
        }
  }





reply via email to

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