Author: manolo
Date: 2010-12-28 04:02:23 -0800 (Tue, 28 Dec 2010)
New Revision: 8126
Log:
Use device abstraction for font and text drawing.

Modified:
   branches/branch-1.3/FL/Fl_Device.H
   branches/branch-1.3/src/fl_font.cxx
   branches/branch-1.3/src/fl_font_mac.cxx
   branches/branch-1.3/src/fl_font_win32.cxx
   branches/branch-1.3/src/fl_font_x.cxx
   branches/branch-1.3/src/fl_font_xft.cxx

Modified: branches/branch-1.3/FL/Fl_Device.H
===================================================================
--- branches/branch-1.3/FL/Fl_Device.H  2010-12-27 17:53:56 UTC (rev 8125)
+++ branches/branch-1.3/FL/Fl_Device.H  2010-12-28 12:02:23 UTC (rev 8126)
@@ -122,9 +122,6 @@
   friend void fl_line(int x, int y, int x1, int y1);
   friend void fl_line(int x, int y, int x1, int y1, int x2, int y2);
   friend void fl_draw(const char *str, int n, int x, int y);
-#ifdef __APPLE__
-  friend void fl_draw(const char *str, int n, float x, float y);
-#endif
   friend void fl_draw(int angle, const char *str, int n, int x, int y);
   friend void fl_rtl_draw(const char *str, int n, int x, int y);
   friend void fl_font(Fl_Font face, Fl_Fontsize size);
@@ -188,13 +185,13 @@
   /** \brief see fl_line(int x, int y, int x1, int y1, int x2, int y2). */
   virtual void line(int x, int y, int x1, int y1, int x2, int y2);
   /** \brief see fl_draw(const char *str, int n, int x, int y). */
-  virtual void draw(const char *str, int n, int x, int y);
+  virtual void draw(const char *str, int n, int x, int y) {};
   /** \brief see fl_draw(int angle, const char *str, int n, int x, int y). */
-  virtual void draw(int angle, const char *str, int n, int x, int y);
+  virtual void draw(int angle, const char *str, int n, int x, int y) {};
   /** \brief see fl_rtl_draw(const char *str, int n, int x, int y). */
-  virtual void rtl_draw(const char *str, int n, int x, int y);
+  virtual void rtl_draw(const char *str, int n, int x, int y) {};
   /** \brief see fl_font(Fl_Font face, Fl_Fontsize size). */
-  virtual void font(Fl_Font face, Fl_Fontsize size);
+  virtual void font(Fl_Font face, Fl_Fontsize size) {};
   /** \brief see fl_color(Fl_Color c). */
   virtual void color(Fl_Color c);
   /** \brief see fl_color(uchar r, uchar g, uchar b). */
@@ -301,6 +298,10 @@
   /** \brief The constructor. */
   Fl_Quartz_Graphics_Driver() { type_ = device_type; };
   static const char *device_type;
+  void draw(const char* str, int n, int x, int y);
+  void draw(int angle, const char *str, int n, int x, int y);
+  void rtl_draw(const char* str, int n, int x, int y);
+  void font(Fl_Font face, Fl_Fontsize size);
   void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
   void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
   void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
@@ -317,6 +318,10 @@
   /** \brief The constructor. */
   Fl_GDI_Graphics_Driver() { type_ = device_type; };
   static const char *device_type;
+  void draw(const char* str, int n, int x, int y);
+  void draw(int angle, const char *str, int n, int x, int y);
+  void rtl_draw(const char* str, int n, int x, int y);
+  void font(Fl_Font face, Fl_Fontsize size);
   void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
   void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
   void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
@@ -333,6 +338,10 @@
   /** \brief The constructor. */
   Fl_Xlib_Graphics_Driver() { type_ = device_type; };
   static const char *device_type;
+  void draw(const char* str, int n, int x, int y);
+  void draw(int angle, const char *str, int n, int x, int y);
+  void rtl_draw(const char* str, int n, int x, int y);
+  void font(Fl_Font face, Fl_Fontsize size);
   void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
   void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
   void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);

Modified: branches/branch-1.3/src/fl_font.cxx
===================================================================
--- branches/branch-1.3/src/fl_font.cxx 2010-12-27 17:53:56 UTC (rev 8125)
+++ branches/branch-1.3/src/fl_font.cxx 2010-12-28 12:02:23 UTC (rev 8126)
@@ -81,7 +81,7 @@
 } // fl_text_extents
 
 
-#if !USE_XFT && !__APPLE__
+#ifndef __APPLE__
 void fl_draw(const char* str, int l, float x, float y) {
   fl_draw(str, l, (int)x, (int)y);
 }

Modified: branches/branch-1.3/src/fl_font_mac.cxx
===================================================================
--- branches/branch-1.3/src/fl_font_mac.cxx     2010-12-27 17:53:56 UTC (rev 
8125)
+++ branches/branch-1.3/src/fl_font_mac.cxx     2010-12-28 12:02:23 UTC (rev 
8126)
@@ -237,7 +237,7 @@
 Fl_Fontsize fl_size_ = 0;
 
 
-void Fl_Graphics_Driver::font(Fl_Font fnum, Fl_Fontsize size) {
+void Fl_Quartz_Graphics_Driver::font(Fl_Font fnum, Fl_Fontsize size) {
   if (fnum==-1) {
     fl_font_ = 0; 
     fl_size_ = 0;
@@ -400,7 +400,7 @@
 
 void fl_draw(const char *str, int n, float x, float y);
 
-void Fl_Graphics_Driver::draw(const char* str, int n, int x, int y) {
+void Fl_Quartz_Graphics_Driver::draw(const char* str, int n, int x, int y) {
   fl_draw(str, n, (float)x-0.0f, (float)y+0.5f);
 }
 
@@ -476,7 +476,7 @@
 #endif
 }
 
-void Fl_Graphics_Driver::draw(int angle, const char *str, int n, int x, int y) 
{
+void Fl_Quartz_Graphics_Driver::draw(int angle, const char *str, int n, int x, 
int y) {
   CGContextSaveGState(fl_gc);
   CGContextTranslateCTM(fl_gc, x, y);
   CGContextRotateCTM(fl_gc, - angle*(M_PI/180) );
@@ -484,7 +484,7 @@
   CGContextRestoreGState(fl_gc);
 }
 
-void Fl_Graphics_Driver::rtl_draw(const char* c, int n, int x, int y) {
+void Fl_Quartz_Graphics_Driver::rtl_draw(const char* c, int n, int x, int y) {
   draw(c, n, int(x - fl_width(c, n)), y);
 }
 

Modified: branches/branch-1.3/src/fl_font_win32.cxx
===================================================================
--- branches/branch-1.3/src/fl_font_win32.cxx   2010-12-27 17:53:56 UTC (rev 
8125)
+++ branches/branch-1.3/src/fl_font_win32.cxx   2010-12-28 12:02:23 UTC (rev 
8126)
@@ -146,7 +146,7 @@
   fl_fontsize = find(fnum, size, angle);
 }
 
-void Fl_Graphics_Driver::font(Fl_Font fnum, Fl_Fontsize size) {
+void Fl_GDI_Graphics_Driver::font(Fl_Font fnum, Fl_Fontsize size) {
   fl_font(fnum, size, 0);
 }
 
@@ -334,7 +334,7 @@
   return;
 } // fl_text_extents
 
-void Fl_Graphics_Driver::draw(const char* str, int n, int x, int y) {
+void Fl_GDI_Graphics_Driver::draw(const char* str, int n, int x, int y) {
   int i = 0;
   int lx = 0;
   char *end = (char *)&str[n];
@@ -362,7 +362,7 @@
   SetTextColor(fl_gc, oldColor);
 }
 
-void Fl_Graphics_Driver::draw(int angle, const char* str, int n, int x, int y) 
{
+void Fl_GDI_Graphics_Driver::draw(int angle, const char* str, int n, int x, 
int y) {
   fl_font(fl_font_, fl_size_, angle);
 //  fl_draw(str, n, (int)x, (int)y);
   int i = 0, i2=0;
@@ -386,7 +386,7 @@
   fl_font(fl_font_, fl_size_);
 }
 
-void Fl_Graphics_Driver::rtl_draw(const char* c, int n, int x, int y) {
+void Fl_GDI_Graphics_Driver::rtl_draw(const char* c, int n, int x, int y) {
   int wn;
   int i = 0;
   int lx = 0;

Modified: branches/branch-1.3/src/fl_font_x.cxx
===================================================================
--- branches/branch-1.3/src/fl_font_x.cxx       2010-12-27 17:53:56 UTC (rev 
8125)
+++ branches/branch-1.3/src/fl_font_x.cxx       2010-12-28 12:02:23 UTC (rev 
8126)
@@ -269,7 +269,7 @@
   return ptr;
 }
 
-void Fl_Graphics_Driver::font(Fl_Font fnum, Fl_Fontsize size) {
+void Fl_Xlib_Graphics_Driver::font(Fl_Font fnum, Fl_Fontsize size) {
   if (fnum==-1) {
     fl_font_ = 0; fl_size_ = 0;
     return;
@@ -318,24 +318,20 @@
 } // fl_text_extents
 
 
-void Fl_Graphics_Driver::draw(const char* c, int n, int x, int y) {
+void Fl_Xlib_Graphics_Driver::draw(const char* c, int n, int x, int y) {
   if (font_gc != fl_gc) {
     if (!current_font) fl_font(FL_HELVETICA, 14);
     font_gc = fl_gc;
     XSetFont(fl_display, fl_gc, current_font->fid);
   }
-//  XDrawString(fl_display, fl_window, fl_gc, x, y, c, n);
   XUtf8DrawString(fl_display, fl_window, current_font, fl_gc, x, y, c, n);
 }
-void Fl_Graphics_Driver::draw(int angle, const char *str, int n, int x, int y) 
{
-  fprintf(stderr,"ROTATING TEXT NOT IMPLIMENTED\n");
+void Fl_Xlib_Graphics_Driver::draw(int angle, const char *str, int n, int x, 
int y) {
+  fprintf(stderr,"ROTATING TEXT NOT IMPLEMENTED\n");
   fl_draw(str, n, (int)x, (int)y);
 }
-//void fl_draw(const char* str, int n, float x, float y) {
-//  fl_draw(str, n, (int)x, (int)y);
-//}
 
-void Fl_Graphics_Driver::rtl_draw(const char* c, int n, int x, int y) {
+void Fl_Xlib_Graphics_Driver::rtl_draw(const char* c, int n, int x, int y) {
   if (font_gc != fl_gc) {
     if (!current_font) fl_font(FL_HELVETICA, 12);
     font_gc = fl_gc;

Modified: branches/branch-1.3/src/fl_font_xft.cxx
===================================================================
--- branches/branch-1.3/src/fl_font_xft.cxx     2010-12-27 17:53:56 UTC (rev 
8125)
+++ branches/branch-1.3/src/fl_font_xft.cxx     2010-12-28 12:02:23 UTC (rev 
8126)
@@ -152,7 +152,7 @@
   fl_xftfont = (void*)f->font;
 }
 
-void Fl_Graphics_Driver::font(Fl_Font fnum, Fl_Fontsize size) {
+void Fl_Xlib_Graphics_Driver::font(Fl_Font fnum, Fl_Fontsize size) {
   fl_font(fnum,size,0);
 }
 
@@ -552,7 +552,7 @@
 #endif
 }
 
-void Fl_Graphics_Driver::draw(const char *str, int n, int x, int y) {
+void Fl_Xlib_Graphics_Driver::draw(const char *str, int n, int x, int y) {
   if ( !current_font ) {
     fl_font(FL_HELVETICA, 14);
   }
@@ -589,16 +589,12 @@
   XftDrawStringUtf8(draw_, &color, current_font, x, y, (XftChar8 *)str, n);
 }
 
-void Fl_Graphics_Driver::draw(int angle, const char *str, int n, int x, int y) 
{
+void Fl_Xlib_Graphics_Driver::draw(int angle, const char *str, int n, int x, 
int y) {
   fl_font(fl_font_, fl_size_, angle);
   fl_draw(str, n, (int)x, (int)y);
   fl_font(fl_font_, fl_size_);
 }
 
-void fl_draw(const char* str, int n, float x, float y) {
-  fl_draw(str, n, (int)x, (int)y);
-}
-
 static void fl_drawUCS4(const FcChar32 *str, int n, int x, int y) {
 #if USE_OVERLAY
   XftDraw*& draw_ = fl_overlay ? draw_overlay : ::draw_;
@@ -634,7 +630,7 @@
 }
 
 
-void Fl_Graphics_Driver::rtl_draw(const char* c, int n, int x, int y) {
+void Fl_Xlib_Graphics_Driver::rtl_draw(const char* c, int n, int x, int y) {
 
 #if defined(__GNUC__)
 // FIXME: warning Need to improve this XFT right to left draw function

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

Reply via email to