Skip to content

Commit

Permalink
Mac OS platform: restore usability with SDK 10.3 and 10.4
Browse files Browse the repository at this point in the history
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11973 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Sep 24, 2016
1 parent cccb475 commit b3c16b4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
18 changes: 10 additions & 8 deletions src/drivers/Quartz/Fl_Font.H
Expand Up @@ -25,6 +25,7 @@
#define FL_FONT_

#include <config.h>
#include "Fl_Quartz_Graphics_Driver.H"
#include <ApplicationServices/ApplicationServices.h>

/**
Expand All @@ -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
};
Expand Down
3 changes: 2 additions & 1 deletion src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
Expand Up @@ -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() {
Expand Down
6 changes: 6 additions & 0 deletions src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx
Expand Up @@ -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);
}
Expand All @@ -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);
Expand Down

0 comments on commit b3c16b4

Please sign in to comment.