diff options
| author | Manolo Gouy <Manolo> | 2016-10-14 09:17:15 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-10-14 09:17:15 +0000 |
| commit | 7a81273a0cfe5128ce7b6454dbd325d6461fd5cd (patch) | |
| tree | 587160d37000fad63db08a498532cd82d7cec0de /src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H | |
| parent | 2b5fbbacfcfe6465feb8ca3be65931e42c22f2dd (diff) | |
MacOS: finer control of the compilation conditions under which Core text and ATSU are used or not.
The compilation conditions depend on the targeted architecture, what version of the SDK is used,
and what MacOS deployment version is used. Under most conditions, a single API is possible,
and no pointer-to-member function is used.
But the code supports building apps that can run both APIs depending on the version of the
running MacOS.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12025 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 | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H index 8c18c9b06..b54653807 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H @@ -30,7 +30,8 @@ #include <ApplicationServices/ApplicationServices.h> // condition for the ATSU API to be available at compile time -#define HAS_ATSU (!defined(__LP64__) || !__LP64__) && MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_11 +#define HAS_ATSU ((!defined(__LP64__) || !__LP64__) && MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_11 && \ + MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) struct Fl_Fontdesc; @@ -152,33 +153,35 @@ protected: virtual const char *font_name(int num); virtual void font_name(int num, const char *name); Fl_Fontdesc* calc_fl_fonts(void); - enum {use_CoreText = 1, use_ATSU}; - static int CoreText_or_ATSU; - static void init_CoreText_or_ATSU(); - // Next group of functions have alternative CoreText- and ATSU-based implementations. + virtual void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h); virtual Fl_Font set_fonts(const char* xstarname); void set_fontname_in_fontdesc(Fl_Fontdesc *f); -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 + +#if HAS_ATSU && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 + enum {use_CoreText = 1, use_ATSU}; + static int CoreText_or_ATSU; + static void init_CoreText_or_ATSU(); void draw_CoreText(const char *str, int n, float x, float y); double width_CoreText(const UniChar* txt, int n); - void text_extents_CoreText(const char*, int n, int& dx, int& dy, int& w, int& h); void descriptor_init_CoreText(const char* name, Fl_Fontsize Size, Fl_Font_Descriptor *d); + void text_extents_CoreText(const char*, int n, int& dx, int& dy, int& w, int& h); Fl_Font set_fonts_CoreText(const char* xstarname); -#endif -#if HAS_ATSU + void draw_ATSU(const char *str, int n, float x, float y); double width_ATSU(const UniChar* txt, int n); - void text_extents_ATSU(const char*, int n, int& dx, int& dy, int& w, int& h); void descriptor_init_ATSU(const char* name, Fl_Fontsize Size, Fl_Font_Descriptor *d); + void text_extents_ATSU(const char*, int n, int& dx, int& dy, int& w, int& h); Fl_Font set_fonts_ATSU(const char* xstarname); -#endif - // end of function group + // define 2 kinds of pointers to member function typedef void (Fl_Quartz_Graphics_Driver::*pter_to_draw_member)(const char *str, int n, float x, float y); typedef double (Fl_Quartz_Graphics_Driver::*pter_to_width_member)(const UniChar *str, int n); static pter_to_draw_member CoreText_or_ATSU_draw; static pter_to_width_member CoreText_or_ATSU_width; +#else + void descriptor_init(const char* name, Fl_Fontsize Size, Fl_Font_Descriptor *d); +#endif }; class Fl_Quartz_Printer_Graphics_Driver : public Fl_Quartz_Graphics_Driver { |
