diff options
| author | Manolo Gouy <Manolo> | 2016-09-26 06:26:59 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-09-26 06:26:59 +0000 |
| commit | 7698a4b98e089cf83ea201f6483558fa71b3ac04 (patch) | |
| tree | 61b439be6e13987fba54f36564924057cd495de0 /src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H | |
| parent | 34f5e4f752b49efe750072b6f09fd451af891513 (diff) | |
MacOS platform: centralize check whether a font has been set before drawing text
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11979 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H')
| -rw-r--r-- | src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H index a0a028dfc..216554f86 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H @@ -40,6 +40,7 @@ struct Fl_Fontdesc; This class is implemented only on the Mac OS X platform. */ class Fl_Quartz_Graphics_Driver : public Fl_Graphics_Driver { + friend class Fl_Font_Descriptor; protected: CGContextRef gc_; int p_size; @@ -140,6 +141,7 @@ protected: int descent(); virtual bool high_resolution() { return high_resolution_; } virtual void global_gc(); + inline Fl_Font_Descriptor *valid_font_descriptor(); virtual const char* get_font_name(Fl_Font fnum, int* ap); virtual int get_font_sizes(Fl_Font fnum, int*& sizep); virtual unsigned font_desc_size(); @@ -147,9 +149,7 @@ protected: virtual void font_name(int num, const char *name); // Next group of virtual functions have at least one alternative // CoreText- or ATSU-based implementation. - virtual void draw_float(float x, float y, const char *str, int n) {} - virtual double width(const UniChar* txt, int n, Fl_Font_Descriptor *fl_fontsize) {return 0;} -public: + virtual double width(const UniChar* txt, int n) {return 0;} virtual Fl_Font set_fonts(const char* xstarname) {return 0;} virtual void set_fontname_in_fontdesc(Fl_Fontdesc *f); virtual void descriptor_init(const char* name, Fl_Fontsize Size, Fl_Font_Descriptor *d) {} @@ -159,8 +159,8 @@ public: #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 class Fl_CoreText_Graphics_Driver : public Fl_Quartz_Graphics_Driver { void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h); - virtual void draw_float(float x, float y, const char *str, int n); - virtual double width(const UniChar* txt, int n, Fl_Font_Descriptor *fl_fontsize); + virtual void draw(const char *str, int n, float x, float y); + virtual double width(const UniChar* txt, int n); virtual Fl_Font set_fonts(const char* xstarname); virtual Fl_Fontdesc* calc_fl_fonts(void); virtual void set_fontname_in_fontdesc(Fl_Fontdesc *f); @@ -171,8 +171,8 @@ class Fl_CoreText_Graphics_Driver : public Fl_Quartz_Graphics_Driver { #ifdef HAS_ATSU class Fl_ATSU_Graphics_Driver : public Fl_Quartz_Graphics_Driver { void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h); - virtual void draw_float(float x, float y, const char *str, int n); - virtual double width(const UniChar* txt, int n, Fl_Font_Descriptor *fl_fontsize); + virtual void draw(const char *str, int n, float x, float y); + virtual double width(const UniChar* txt, int n); virtual Fl_Font set_fonts(const char* xstarname); virtual Fl_Fontdesc* calc_fl_fonts(void); virtual void descriptor_init(const char* name, Fl_Fontsize Size, Fl_Font_Descriptor *d); |
