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
This commit is contained in:
Manolo Gouy 2016-09-24 06:21:37 +00:00
parent cccb475fa8
commit b3c16b4911
3 changed files with 18 additions and 9 deletions

View File

@ -25,6 +25,7 @@
#define FL_FONT_
#include <config.h>
#include "Fl_Quartz_Graphics_Driver.H"
#include <ApplicationServices/ApplicationServices.h>
/**
@ -40,20 +41,21 @@ 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;
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
# if HAS_ATSU
ATSUTextLayout layout;
ATSUStyle style;
short ascent, descent, q_width;
# endif
# if HAVE_GL
unsigned int listbase;// base of display list, 0 = none
# endif // HAVE_GL
FL_EXPORT ~Fl_Font_Descriptor();
#endif // FL_DOXYGEN
};

View File

@ -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() {

View File

@ -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);