From b3c16b49113529a6ab9c42df8f237edc0c6352f9 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Sat, 24 Sep 2016 06:21:37 +0000 Subject: [PATCH] Mac OS platform: restore usability with SDK 10.3 and 10.4 git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11973 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/Quartz/Fl_Font.H | 18 ++++++++++-------- .../Quartz/Fl_Quartz_Graphics_Driver.cxx | 3 ++- .../Quartz/Fl_Quartz_Graphics_Driver_font.cxx | 6 ++++++ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/drivers/Quartz/Fl_Font.H b/src/drivers/Quartz/Fl_Font.H index 2a7c10232..00a96370c 100644 --- a/src/drivers/Quartz/Fl_Font.H +++ b/src/drivers/Quartz/Fl_Font.H @@ -25,6 +25,7 @@ #define FL_FONT_ #include +#include "Fl_Quartz_Graphics_Driver.H" #include /** @@ -40,19 +41,20 @@ public: Fl_Fontsize size; /**< font size */ #ifndef FL_DOXYGEN // don't bother with platorm dependant details in the doc. Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size); - ATSUTextLayout layout; -# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 + FL_EXPORT ~Fl_Font_Descriptor(); + short ascent, descent, q_width; +# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 CTFontRef fontref; // the unicode span is divided in 512 blocks of 128 characters float *width[512]; // array of arrays of character widths -# endif +# endif +# if HAS_ATSU + ATSUTextLayout layout; ATSUStyle style; - short ascent, descent, q_width; -# if HAVE_GL +# endif +# if HAVE_GL unsigned int listbase;// base of display list, 0 = none -# endif // HAVE_GL - - FL_EXPORT ~Fl_Font_Descriptor(); +# endif // HAVE_GL #endif // FL_DOXYGEN }; diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx index fd31e7030..4dd21f587 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx @@ -40,8 +40,9 @@ Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver() #endif // HAS_ATSU #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 return new Fl_CoreText_Graphics_Driver(); -#endif +#else return NULL; // should not happen +#endif } char Fl_Quartz_Graphics_Driver::can_do_alpha_blending() { diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx index 0e2177e03..2271bc52d 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx @@ -126,8 +126,12 @@ Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) { # endif // OpenGL needs those for its font handling size = Size; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 fontref = NULL; +#endif +#if HAS_ATSU layout = NULL; +#endif Fl_Quartz_Graphics_Driver *driver = (Fl_Quartz_Graphics_Driver*)Fl_Display_Device::display_device()->driver(); driver->descriptor_init(name, size, this); } @@ -149,12 +153,14 @@ Fl_Font_Descriptor::~Fl_Font_Descriptor() { #endif */ if (this == fl_graphics_driver->font_descriptor()) fl_graphics_driver->font_descriptor(NULL); +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 if (fontref) { CFRelease(fontref); for (unsigned i = 0; i < sizeof(width)/sizeof(float*); i++) { if (width[i]) free(width[i]); } } +#endif #if HAS_ATSU if (layout) { ATSUDisposeTextLayout(layout);