Author: matt
Date: 2012-05-09 08:19:24 -0700 (Wed, 09 May 2012)
New Revision: 9475
Log:
Fixed rotated text (OS X)

Modified:
   branches/branch-3.0/src/fltk3/cocoa_font.cxx
   branches/branch-3.0/test/rotated_text.cxx

Modified: branches/branch-3.0/src/fltk3/cocoa_font.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/cocoa_font.cxx        2012-05-09 15:07:24 UTC 
(rev 9474)
+++ branches/branch-3.0/src/fltk3/cocoa_font.cxx        2012-05-09 15:19:24 UTC 
(rev 9475)
@@ -535,8 +535,9 @@
 
 void fltk3::QuartzGraphicsDriver::draw(int angle, const char *str, int n, int 
x, int y) {
   CGContextSaveGState(fl_gc);
-  CGContextTranslateCTM(fl_gc, x, y);
+  CGContextTranslateCTM(fl_gc, x+origin_x(), y+origin_y());
   CGContextRotateCTM(fl_gc, - angle*(M_PI/180) );
+  CGContextTranslateCTM(fl_gc, -origin_x(), -origin_y());
   draw(str, n, 0, 0);
   CGContextRestoreGState(fl_gc);
 }
@@ -544,7 +545,7 @@
 void fltk3::QuartzGraphicsDriver::rtl_draw(const char* c, int n, int x, int y) 
{
   int dx, dy, w, h;
   text_extents(c, n, dx, dy, w, h);
-  draw(c, n, x - w - dx, y);
+  draw(c, n, x+origin_x() - w - dx, y+origin_y());
 }
 
 //

Modified: branches/branch-3.0/test/rotated_text.cxx
===================================================================
--- branches/branch-3.0/test/rotated_text.cxx   2012-05-09 15:07:24 UTC (rev 
9474)
+++ branches/branch-3.0/test/rotated_text.cxx   2012-05-09 15:19:24 UTC (rev 
9475)
@@ -56,7 +56,7 @@
     fltk3::color(labelcolor());
     int dx(0),dy(0);
      
-    if(rt_align&fltk3::ALIGN_CLIP)fltk3::push_clip(x(),y(),w(),h());
+    if(rt_align&fltk3::ALIGN_CLIP)fltk3::push_clip(0,0,w(),h());
     else fltk3::push_no_clip();
     fltk3::measure(rt_text,dx,dy);
     if(rt_align&fltk3::ALIGN_LEFT){
@@ -69,11 +69,11 @@
       dx=(int)(-cos(M_PI*(double)rt_angle/180.)*(double)dx);
       dx/=2;dy/=2;
     }
-    
if(labeltype()==fltk3::SHADOW_LABEL)shadow_label(x()+w()/2+dx,y()+h()/2+dy);
-    else 
if(labeltype()==fltk3::ENGRAVED_LABEL)engraved_label(x()+w()/2+dx,y()+h()/2+dy);
-    else 
if(labeltype()==fltk3::EMBOSSED_LABEL)embossed_label(x()+w()/2+dx,y()+h()/2+dy);
+    if(labeltype()==fltk3::SHADOW_LABEL)shadow_label(w()/2+dx,h()/2+dy);
+    else 
if(labeltype()==fltk3::ENGRAVED_LABEL)engraved_label(w()/2+dx,h()/2+dy);
+    else 
if(labeltype()==fltk3::EMBOSSED_LABEL)embossed_label(w()/2+dx,h()/2+dy);
     else{
-     fltk3::draw(rt_angle,rt_text,x()+w()/2+dx,y()+h()/2+dy);
+     fltk3::draw(rt_angle,rt_text,w()/2+dx,h()/2+dy);
     }
     fltk3::pop_clip();
     draw_label();

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to