summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-12-28 12:02:23 +0000
committerManolo Gouy <Manolo>2010-12-28 12:02:23 +0000
commitb431c1e0e7cec74dfe55d558a42a0f162079b0c1 (patch)
treecfda391b077654629ea20a6edbde5590e45c09e9 /src
parentf3e04b8b87a7acd6a46486bd21258d4bf3a6b06d (diff)
Use device abstraction for font and text drawing.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8126 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/fl_font.cxx2
-rw-r--r--src/fl_font_mac.cxx8
-rw-r--r--src/fl_font_win32.cxx8
-rw-r--r--src/fl_font_x.cxx14
-rw-r--r--src/fl_font_xft.cxx12
5 files changed, 18 insertions, 26 deletions
diff --git a/src/fl_font.cxx b/src/fl_font.cxx
index 91f5ea54e..2a6833adf 100644
--- a/src/fl_font.cxx
+++ b/src/fl_font.cxx
@@ -81,7 +81,7 @@ void fl_text_extents(const char *c, int &dx, int &dy, int &w, int &h) {
} // 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);
}
diff --git a/src/fl_font_mac.cxx b/src/fl_font_mac.cxx
index b5749f0dd..414dc7a84 100644
--- a/src/fl_font_mac.cxx
+++ b/src/fl_font_mac.cxx
@@ -237,7 +237,7 @@ Fl_Font fl_font_ = 0;
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_text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h) {
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 @@ void fl_draw(const char *str, int n, float x, float y) {
#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 @@ void Fl_Graphics_Driver::draw(int angle, const char *str, int n, int x, int y) {
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);
}
diff --git a/src/fl_font_win32.cxx b/src/fl_font_win32.cxx
index f1f545bb8..285ff8bad 100644
--- a/src/fl_font_win32.cxx
+++ b/src/fl_font_win32.cxx
@@ -146,7 +146,7 @@ void fl_font(Fl_Font fnum, Fl_Fontsize size, int angle) {
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 @@ exit_error:
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 @@ void Fl_Graphics_Driver::draw(const char* str, int n, int x, int y) {
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 @@ void Fl_Graphics_Driver::draw(int angle, const char* str, int n, int x, int y) {
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;
diff --git a/src/fl_font_x.cxx b/src/fl_font_x.cxx
index 8ac870d79..247770ede 100644
--- a/src/fl_font_x.cxx
+++ b/src/fl_font_x.cxx
@@ -269,7 +269,7 @@ XFontStruct* Fl_XFont_On_Demand::value() {
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 @@ void fl_text_extents(const char *c, int n, int &dx, int &dy, int &W, int &H) {
} // 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;
diff --git a/src/fl_font_xft.cxx b/src/fl_font_xft.cxx
index f6cebde0b..f0f0aece6 100644
--- a/src/fl_font_xft.cxx
+++ b/src/fl_font_xft.cxx
@@ -152,7 +152,7 @@ void fl_font(Fl_Font fnum, Fl_Fontsize size, int angle) {
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 @@ void fl_destroy_xft_draw(Window id) {
#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 @@ void Fl_Graphics_Driver::draw(const char *str, int n, int x, int y) {
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 @@ static void fl_drawUCS4(const FcChar32 *str, int 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 defined(__GNUC__)
// FIXME: warning Need to improve this XFT right to left draw function