bug-gnustep
[Top][All Lists]
Advanced

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

Fix, NSView (Text Rotation)


From: Georg Fleischmann
Subject: Fix, NSView (Text Rotation)
Date: Sun, 14 Mar 2004 01:57:20 GMT

Hi,

here is one of two patches to make text rotation work with Cenon and the Art backend.

This is a patch for NSView. The other patch for NSAffineTransform is in a second mail.
Now, the first problem in NSView was that the visible rect wasn't rotated/flipped correctly. As a result, the rotated text was clipped from the screen.
The second problem was in lockFocusInRect. There was an extra function call just for rotated views, which only destroyed the rect.

I only tested text rotation with Cenon, as I'm not aware of any other application using rotated text.
Georg



2004-03-14  Georg Fleischmann
	* gui/Source/NSView.m [NSView convertRect:fromView:]:
	  better conversion of flipped + rotated views
	* gui/Source/NSView.m [NSView lockFocus:inRect:]:
	  removed a problematic bounding rect call for rotated views



*** gui/Source/NSView.m.old	2004-03-14 01:10:15.000000000 +0100
--- gui/Source/NSView.m	2004-03-14 01:12:09.000000000 +0100
***************
*** 1250,1262 ****
      {
        matrix = [self _matrixFromWindow];
      }
-   r.origin = [matrix pointInMatrixSpace: r.origin];
-   r.size = [matrix sizeInMatrixSpace: r.size];
  
!   if (aView->_rFlags.flipped_view  != _rFlags.flipped_view)
      {
!       r.origin.y -= r.size.height;
      }
    return r;
  }
  
--- 1250,1285 ----
      {
        matrix = [self _matrixFromWindow];
      }
  
!   if (aView->_rFlags.flipped_view != _rFlags.flipped_view)
!     { NSPoint	p[4];
! 
!       if (aView->_rFlags.flipped_view)	// aView is flipped
!         {
!           r.origin.y -= r.size.height;
!         }
! 
!       p[0] = r.origin;
!       p[1] = NSMakePoint(r.origin.x + r.size.width, r.origin.y);
!       p[2] = NSMakePoint(r.origin.x + r.size.width, r.origin.y + r.size.height);
!       p[3] = NSMakePoint(r.origin.x, r.origin.y + r.size.height);
! 
!       p[0] = [matrix pointInMatrixSpace: p[0]];
!       p[1] = [matrix pointInMatrixSpace: p[1]];
!       p[2] = [matrix pointInMatrixSpace: p[2]];
!       p[3] = [matrix pointInMatrixSpace: p[3]];
! 
!       r.origin.x = MIN( MIN( MIN(p[0].x, p[1].x), p[2].x), p[3].x);
!       r.origin.y = MIN( MIN( MIN(p[0].y, p[1].y), p[2].y), p[3].y);
! r.size.width = MAX( MAX( MAX(p[0].x, p[1].x), p[2].x), p[3].x) - r.origin.x;
! r.size.height = MAX( MAX( MAX(p[0].y, p[1].y), p[2].y), p[3].y) - r.origin.y;
!     }
!   else
      {
!       r.origin = [matrix pointInMatrixSpace: r.origin];
!       r.size = [matrix sizeInMatrixSpace: r.size];
      }
+ 
    return r;
  }
  
***************
*** 1597,1606 ****
      {
        NSAffineTransform *matrix;
        matrix = [self _matrixToWindow];
-       if ([matrix isRotated])
- 	{
- 	  [matrix boundingRectFor: rect result: &rect];
- 	}
  
        if (_gstate)
  	{
--- 1620,1625 ----




reply via email to

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