diff options
| author | Manolo Gouy <Manolo> | 2011-02-05 13:54:56 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2011-02-05 13:54:56 +0000 |
| commit | 777ee1b8223d3ae17baf0b26d8fde4d7db5ac119 (patch) | |
| tree | 7b1a22875da65651eb241c85f732e09a6ab7a2a3 /FL | |
| parent | 668dfd109f183ad8c4731f7fb8af39977ea89920 (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 'FL')
| -rw-r--r-- | FL/Fl_Device.H | 12 | ||||
| -rw-r--r-- | FL/Fl_PostScript.H | 4 | ||||
| -rw-r--r-- | FL/fl_draw.H | 7 |
3 files changed, 12 insertions, 11 deletions
diff --git a/FL/Fl_Device.H b/FL/Fl_Device.H index c51e99c1d..42b386e9c 100644 --- a/FL/Fl_Device.H +++ b/FL/Fl_Device.H @@ -59,6 +59,8 @@ typedef void (*Fl_Draw_Image_Cb)(void* data,int x,int y,int w,uchar* buf); #define MATRIX_STACK_SIZE 32 #define MATRIX_STACK_MAX (MATRIX_STACK_SIZE - 1) +/** A 2D coordinate transformation matrix + */ struct matrix {double a, b, c, d, x, y;}; // typedef what the x,y fields in a point are: @@ -110,6 +112,8 @@ public: in the \ref fl_drawings and \ref fl_attributes modules. */ class FL_EXPORT Fl_Graphics_Driver : public Fl_Device { + Fl_Font font_; // current font + Fl_Fontsize size_; // current font size enum {LINE, LOOP, POLYGON, POINT_}; int sptr; matrix stack[MATRIX_STACK_SIZE]; @@ -199,7 +203,7 @@ protected: friend FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D); friend void gl_start(); - matrix *fl_matrix; + matrix *fl_matrix; /**< Points to the current coordinate transformation matrix */ /** \brief The constructor. */ Fl_Graphics_Driver(); @@ -345,7 +349,11 @@ protected: public: static const char *class_id; /** \brief see fl_font(Fl_Font face, Fl_Fontsize size). */ - virtual void font(Fl_Font face, Fl_Fontsize size) = 0; + virtual void font(Fl_Font face, Fl_Fontsize size) {font_ = face; size_ = size;} + /** \brief see fl_font(). */ + Fl_Font font() {return font_; } + /** \brief see fl_size(). */ + Fl_Fontsize size() {return size_; } /** \brief The destructor */ virtual ~Fl_Graphics_Driver() {}; }; diff --git a/FL/Fl_PostScript.H b/FL/Fl_PostScript.H index 80c5bd5c1..56b05234e 100644 --- a/FL/Fl_PostScript.H +++ b/FL/Fl_PostScript.H @@ -76,8 +76,6 @@ class Clip { Clip * clip_; int lang_level_; - int font_; - int size_; int gap_; int pages_; @@ -182,8 +180,6 @@ class Clip { void transformed_vertex(double x, double y); void font(int face, int size); - int font(){return font_;}; - int size(){return size_;}; void draw_image(const uchar* d, int x,int y,int w,int h, int delta=3, int ldelta=0){draw_scaled_image(d,x,y,w,h,w,h,delta,ldelta);}; void draw_image_mono(const uchar* d, int x,int y,int w,int h, int delta=1, int ld=0){draw_scaled_image_mono(d,x,y,w,h,w,h,delta,ld);}; diff --git a/FL/fl_draw.H b/FL/fl_draw.H index a17737d3f..5d197e403 100644 --- a/FL/fl_draw.H +++ b/FL/fl_draw.H @@ -480,20 +480,17 @@ inline void fl_transformed_vertex(double xf, double yf) {fl_graphics_driver->tra Lines should be spaced \p size pixels apart or more. */ inline void fl_font(Fl_Font face, Fl_Fontsize size) { fl_graphics_driver->font(face,size); } -extern FL_EXPORT Fl_Font fl_font_; ///< current font index /** Returns the \p face set by the most recent call to fl_font(). This can be used to save/restore the font. */ -inline Fl_Font fl_font() {return fl_font_;} -/** \brief current font size */ -extern FL_EXPORT Fl_Fontsize fl_size_; +inline Fl_Font fl_font() {return fl_graphics_driver->font();} /** Returns the \p size set by the most recent call to fl_font(). This can be used to save/restore the font. */ -inline Fl_Fontsize fl_size() {return fl_size_;} +inline Fl_Fontsize fl_size() {return fl_graphics_driver->size();} // information you can get about the current font: /** |
