summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2011-02-05 13:54:56 +0000
committerManolo Gouy <Manolo>2011-02-05 13:54:56 +0000
commit777ee1b8223d3ae17baf0b26d8fde4d7db5ac119 (patch)
tree7b1a22875da65651eb241c85f732e09a6ab7a2a3 /src
parent668dfd109f183ad8c4731f7fb8af39977ea89920 (diff)
Removed global variables fl_font_ and fl_size_ that are now distinct for each graphics device.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8374 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Device.cxx12
-rw-r--r--src/Fl_PostScript.cxx7
-rw-r--r--src/fl_font_mac.cxx10
-rw-r--r--src/fl_font_win32.cxx7
-rw-r--r--src/fl_font_x.cxx8
-rw-r--r--src/fl_font_xft.cxx5
-rw-r--r--src/gl_draw.cxx4
7 files changed, 24 insertions, 29 deletions
diff --git a/src/Fl_Device.cxx b/src/Fl_Device.cxx
index 790545703..87c2d28ee 100644
--- a/src/Fl_Device.cxx
+++ b/src/Fl_Device.cxx
@@ -54,11 +54,13 @@ void Fl_Surface_Device::set_current(void)
static matrix m0 = {1, 0, 0, 1, 0, 0};
Fl_Graphics_Driver::Fl_Graphics_Driver() {
- sptr=0; rstackptr=0;
- fl_clip_state_number=0;
- m = m0;
- fl_matrix = &m;
- p = (XPOINT *)0;
+ font_ = 0;
+ size_ = 0;
+ sptr=0; rstackptr=0;
+ fl_clip_state_number=0;
+ m = m0;
+ fl_matrix = &m;
+ p = (XPOINT *)0;
};
//
diff --git a/src/Fl_PostScript.cxx b/src/Fl_PostScript.cxx
index aecfe9af8..178d2b479 100644
--- a/src/Fl_PostScript.cxx
+++ b/src/Fl_PostScript.cxx
@@ -589,15 +589,14 @@ int Fl_PostScript_Graphics_Driver::start_postscript (int pagecount,
void Fl_PostScript_Graphics_Driver::recover(){
color(cr_,cg_,cb_);
line_style(linestyle_,linewidth_,linedash_);
- font(font_,size_);
+ font(Fl_Graphics_Driver::font(), Fl_Graphics_Driver::size());
}
void Fl_PostScript_Graphics_Driver::reset(){
gap_=1;
clip_=0;
cr_=cg_=cb_=0;
- font_=FL_HELVETICA;
- size_=12;
+ Fl_Graphics_Driver::font(FL_HELVETICA, 12);
linewidth_=0;
linestyle_=FL_SOLID;
strcpy(linedash_,"");
@@ -932,7 +931,7 @@ void Fl_PostScript_Graphics_Driver::font(int f, int s) {
fprintf(output, "/%s SF\n" , _fontNames[f]);
fprintf(output,"%i FS\n", s);
Fl_Display_Device::display_device()->driver()->font(f,s); // Use display fonts for font measurement
- font_ = f; size_ = s;
+ Fl_Graphics_Driver::font(f, s);
}
void Fl_PostScript_Graphics_Driver::color(Fl_Color c) {
diff --git a/src/fl_font_mac.cxx b/src/fl_font_mac.cxx
index 5312c6fe4..5e6d2f5ff 100644
--- a/src/fl_font_mac.cxx
+++ b/src/fl_font_mac.cxx
@@ -250,18 +250,12 @@ static Fl_Font_Descriptor* find(Fl_Font fnum, Fl_Fontsize size) {
////////////////////////////////////////////////////////////////
// Public interface:
-Fl_Font fl_font_ = 0;
-Fl_Fontsize fl_size_ = 0;
-
-
void Fl_Quartz_Graphics_Driver::font(Fl_Font fnum, Fl_Fontsize size) {
if (fnum==-1) {
- fl_font_ = 0;
- fl_size_ = 0;
+ Fl_Graphics_Driver::font(0, 0);
return;
}
- fl_font_ = fnum;
- fl_size_ = size;
+ Fl_Graphics_Driver::font(fnum, size);
fl_font(find(fnum, size));
}
diff --git a/src/fl_font_win32.cxx b/src/fl_font_win32.cxx
index 5c5238605..c35625d13 100644
--- a/src/fl_font_win32.cxx
+++ b/src/fl_font_win32.cxx
@@ -132,11 +132,11 @@ static Fl_Font_Descriptor* find(Fl_Font fnum, Fl_Fontsize size, int angle) {
////////////////////////////////////////////////////////////////
// Public interface:
-Fl_Font fl_font_ = 0;
-Fl_Fontsize fl_size_ = 0;
+static Fl_Font fl_font_ = 0;
+static Fl_Fontsize fl_size_ = 0;
//static HDC font_gc;
-void fl_font(Fl_Font fnum, Fl_Fontsize size, int angle) {
+static void fl_font(Fl_Font fnum, Fl_Fontsize size, int angle) {
if (fnum==-1) { // just make sure that we will load a new font next time
fl_font_ = 0; fl_size_ = 0; fl_angle_ = 0;
return;
@@ -148,6 +148,7 @@ void fl_font(Fl_Font fnum, Fl_Fontsize size, int angle) {
void Fl_GDI_Graphics_Driver::font(Fl_Font fnum, Fl_Fontsize size) {
fl_font(fnum, size, 0);
+ Fl_Graphics_Driver::font(fl_font_, fl_size_);
}
int fl_height() {
diff --git a/src/fl_font_x.cxx b/src/fl_font_x.cxx
index 247770ede..6983aff1e 100644
--- a/src/fl_font_x.cxx
+++ b/src/fl_font_x.cxx
@@ -260,8 +260,6 @@ static Fl_Font_Descriptor* find(int fnum, int size) {
////////////////////////////////////////////////////////////////
// Public interface:
-Fl_Font fl_font_ = 0;
-Fl_Fontsize fl_size_ = 0;
void *fl_xftfont = 0;
static GC font_gc;
@@ -271,11 +269,11 @@ XFontStruct* Fl_XFont_On_Demand::value() {
void Fl_Xlib_Graphics_Driver::font(Fl_Font fnum, Fl_Fontsize size) {
if (fnum==-1) {
- fl_font_ = 0; fl_size_ = 0;
+ Fl_Graphics_Driver::font(0, 0);
return;
}
- if (fnum == fl_font_ && size == fl_size_) return;
- fl_font_ = fnum; fl_size_ = size;
+ if (fnum == Fl_Graphics_Driver::font() && size == Fl_Graphics_Driver::size()) return;
+ Fl_Graphics_Driver::font(fnum, size);
Fl_Font_Descriptor* f = find(fnum, size);
if (f != fl_fontsize) {
fl_fontsize = f;
diff --git a/src/fl_font_xft.cxx b/src/fl_font_xft.cxx
index 08953e95b..e6036f9a5 100644
--- a/src/fl_font_xft.cxx
+++ b/src/fl_font_xft.cxx
@@ -110,8 +110,8 @@ Fl_Fontdesc* fl_fonts = built_in_table;
#define current_font (fl_fontsize->font)
-Fl_Font fl_font_ = 0;
-Fl_Fontsize fl_size_ = 0;
+static Fl_Font fl_font_ = 0;
+static Fl_Fontsize fl_size_ = 0;
int fl_angle_ = 0; // internal for rotating text support
Fl_XFont_On_Demand fl_xfont;
void *fl_xftfont = 0;
@@ -154,6 +154,7 @@ void fl_font(Fl_Font fnum, Fl_Fontsize size, int angle) {
void Fl_Xlib_Graphics_Driver::font(Fl_Font fnum, Fl_Fontsize size) {
fl_font(fnum,size,0);
+ Fl_Graphics_Driver::font(fl_font_, fl_size_);
}
static XftFont* fontopen(const char* name, bool core, int angle) {
diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx
index 8086afa09..95f9a37ce 100644
--- a/src/gl_draw.cxx
+++ b/src/gl_draw.cxx
@@ -35,6 +35,7 @@
#include <FL/gl.h>
#include <FL/x.H>
#include <FL/fl_draw.H>
+#include <FL/Fl_Device.H>
#include "Fl_Gl_Choice.H"
#include "Fl_Font.H"
#include <FL/fl_utf8.h>
@@ -161,8 +162,7 @@ void gl_remove_displaylist_fonts()
# if HAVE_GL
// clear variables used mostly in fl_font
- fl_font_ = 0;
- fl_size_ = 0;
+ fl_graphics_driver->font(0, 0);
for (int j = 0 ; j < FL_FREE_FONT ; ++j)
{