summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-10-10 21:19:39 +0000
committerManolo Gouy <Manolo>2016-10-10 21:19:39 +0000
commita6a79d80f380ef0b45e8144159ba72c452300511 (patch)
tree7502f4fefa817c01a2bf67c3f3ce50daec93bac1
parent0250b4af12b044158ea3921d3ca17e86f0756383 (diff)
Re-organisation of code to support CoreText and ATSU for drawing text.
We avoid using one CoreText-related and one ATSU-related derived classes of class Fl_Quartz_Graphics_Driver. Thus, class Fl_Quartz_Graphics_Driver can be derived if useful and still support both text APIs. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12022 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm4
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx2
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H75
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx56
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx104
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx2
6 files changed, 148 insertions, 95 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm
index 8792214ad..a3fb55034 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm
+++ b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm
@@ -79,9 +79,7 @@ Fl_Cocoa_Printer_Driver::Fl_Cocoa_Printer_Driver(void)
x_offset = 0;
y_offset = 0;
scale_x = scale_y = 1.;
- Fl_Quartz_Graphics_Driver *d = (Fl_Quartz_Graphics_Driver*)Fl_Graphics_Driver::newMainGraphicsDriver();
- d->is_printer_ = Fl_Graphics_Driver::PRINTER;
- driver(d);
+ driver(new Fl_Quartz_Printer_Graphics_Driver);
}
Fl_Paged_Device* Fl_Paged_Device::newPrinterDriver(void)
diff --git a/src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx
index 0b33cec43..06f9a2514 100644
--- a/src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx
@@ -30,7 +30,7 @@ Fl_Copy_Surface_Driver *Fl_Copy_Surface_Driver::newCopySurfaceDriver(int w, int
}
Fl_Quartz_Copy_Surface_Driver::Fl_Quartz_Copy_Surface_Driver(int w, int h) : Fl_Copy_Surface_Driver(w, h) {
- driver(Fl_Graphics_Driver::newMainGraphicsDriver());
+ driver(new Fl_Quartz_Graphics_Driver);
prepare_copy_pdf_and_tiff(w, h);
}
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H
index 0e01a4c94..3cf1c03b5 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H
@@ -48,26 +48,15 @@ protected:
typedef struct { float x; float y; } XPOINT;
XPOINT *p;
bool high_resolution_;
- driver_feature is_printer_;
float quartz_line_width_;
CGLineCap quartz_line_cap_;
CGLineJoin quartz_line_join_;
CGFloat *quartz_line_pattern;
int quartz_line_pattern_size;
-// protected constructor to ensure only derived classes are allocated
- Fl_Quartz_Graphics_Driver() : Fl_Graphics_Driver(), gc_(NULL), p_size(0), p(NULL) {
- quartz_line_width_ = 1.f;
- quartz_line_cap_ = kCGLineCapButt;
- quartz_line_join_ = kCGLineJoinMiter;
- quartz_line_pattern = 0;
- quartz_line_pattern_size = 0;
- high_resolution_ = false;
- is_printer_ = (driver_feature)0;
- }
public:
- static const int CoreText_threshold; // min Mac OS version for CoreText
+ Fl_Quartz_Graphics_Driver();
virtual ~Fl_Quartz_Graphics_Driver() { if (p) free(p); }
- virtual int has_feature(driver_feature mask) { return mask & (NATIVE | is_printer_); }
+ virtual int has_feature(driver_feature mask) { return mask & NATIVE; }
virtual void gc(void *ctxt) { gc_ = (CGContextRef)ctxt; global_gc(); }
virtual void *gc() {return gc_;}
char can_do_alpha_blending();
@@ -146,6 +135,7 @@ protected:
void draw(const char *str, int n, int x, int y);
void draw(const char *str, int n, float x, float y);
void draw(int angle, const char *str, int n, int x, int y);
+ double width(const UniChar* txt, int n);
void rtl_draw(const char *str, int n, int x, int y);
void font(Fl_Font face, Fl_Fontsize fsize);
double width(const char *str, int n);
@@ -154,45 +144,46 @@ protected:
int descent();
virtual bool high_resolution() { return high_resolution_; }
virtual void global_gc();
+ void quartz_restore_line_style();
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();
virtual const char *font_name(int num);
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 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) {}
- // end of function group
- void quartz_restore_line_style();
-};
-
-#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(const char *str, int n, float x, float y);
- virtual double width(const UniChar* txt, int n);
+ 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);
- virtual Fl_Fontdesc* calc_fl_fonts(void);
- virtual void set_fontname_in_fontdesc(Fl_Fontdesc *f);
- virtual void descriptor_init(const char* name, Fl_Fontsize Size, Fl_Font_Descriptor *d);
-};
+ void set_fontname_in_fontdesc(Fl_Fontdesc *f);
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+ 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);
+ Fl_Font set_fonts_CoreText(const char* xstarname);
#endif
-
-#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(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);
-};
+#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);
+ 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;
+};
+class Fl_Quartz_Printer_Graphics_Driver : public Fl_Quartz_Graphics_Driver {
+ virtual int has_feature(driver_feature mask) { return mask & (NATIVE | PRINTER); }
+};
#endif // FL_QUARTZ_GRAPHICS_DRIVER_H
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
index 4dd21f587..5fd811e1a 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
@@ -16,33 +16,57 @@
// http://www.fltk.org/str.php
//
-
#include "../../config_lib.h"
#include "Fl_Quartz_Graphics_Driver.H"
#include "../Darwin/Fl_Darwin_System_Driver.H"
#include <FL/x.H>
+Fl_Quartz_Graphics_Driver::pter_to_draw_member Fl_Quartz_Graphics_Driver::CoreText_or_ATSU_draw;
+Fl_Quartz_Graphics_Driver::pter_to_width_member Fl_Quartz_Graphics_Driver::CoreText_or_ATSU_width;
+
+int Fl_Quartz_Graphics_Driver::CoreText_or_ATSU = 0;
+
+void Fl_Quartz_Graphics_Driver::init_CoreText_or_ATSU()
+{
+#if HAS_ATSU && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+ if (Fl_Darwin_System_Driver::calc_mac_os_version() < 100500) {
+ // before Mac OS 10.5, only ATSU is available
+ CoreText_or_ATSU = use_ATSU;
+ CoreText_or_ATSU_draw = &Fl_Quartz_Graphics_Driver::draw_ATSU;
+ CoreText_or_ATSU_width = &Fl_Quartz_Graphics_Driver::width_ATSU;
+ } else {
+ CoreText_or_ATSU = use_CoreText;
+ CoreText_or_ATSU_draw = &Fl_Quartz_Graphics_Driver::draw_CoreText;
+ CoreText_or_ATSU_width = &Fl_Quartz_Graphics_Driver::width_CoreText;
+ }
+#elif MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
+ CoreText_or_ATSU = use_ATSU;
+ CoreText_or_ATSU_draw = &Fl_Quartz_Graphics_Driver::draw_ATSU;
+ CoreText_or_ATSU_width = &Fl_Quartz_Graphics_Driver::width_ATSU;
+#else
+ CoreText_or_ATSU = use_CoreText;
+ CoreText_or_ATSU_draw = &Fl_Quartz_Graphics_Driver::draw_CoreText;
+ CoreText_or_ATSU_width = &Fl_Quartz_Graphics_Driver::width_CoreText;
+#endif
+}
+
/*
* By linking this module, the following static method will instantiate the
* OS X Quartz Graphics driver as the main display driver.
*/
Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver()
{
-#if HAS_ATSU
- static int option = 0; // 0: not initialized, 1: use CoreText, 2: use ATSU
- if (!option) {
- option = 2;
- if (Fl_Darwin_System_Driver::calc_mac_os_version() >= Fl_Quartz_Graphics_Driver::CoreText_threshold) {
- option = 1;
- }
- }
- if (option == 2) return new Fl_ATSU_Graphics_Driver();
-#endif // HAS_ATSU
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- return new Fl_CoreText_Graphics_Driver();
-#else
- return NULL; // should not happen
-#endif
+ return new Fl_Quartz_Graphics_Driver();
+}
+
+Fl_Quartz_Graphics_Driver::Fl_Quartz_Graphics_Driver() : Fl_Graphics_Driver(), gc_(NULL), p_size(0), p(NULL) {
+ quartz_line_width_ = 1.f;
+ quartz_line_cap_ = kCGLineCapButt;
+ quartz_line_join_ = kCGLineJoinMiter;
+ quartz_line_pattern = 0;
+ quartz_line_pattern_size = 0;
+ high_resolution_ = false;
+ if (!CoreText_or_ATSU) init_CoreText_or_ATSU();
}
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 197ce63f2..2a263e2fb 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx
@@ -31,8 +31,6 @@ Fl_Fontdesc* fl_fonts = NULL;
static CGAffineTransform font_mx = { 1, 0, 0, -1, 0, 0 };
-const int Fl_Quartz_Graphics_Driver::CoreText_threshold = 100500; // this represents Mac OS 10.5
-
static int fl_free_font = FL_FREE_FONT;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
@@ -133,7 +131,15 @@ Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) {
layout = NULL;
#endif
Fl_Quartz_Graphics_Driver *driver = (Fl_Quartz_Graphics_Driver*)&Fl_Graphics_Driver::default_driver();
- driver->descriptor_init(name, size, this);
+#if HAS_ATSU
+ if (Fl_Quartz_Graphics_Driver::CoreText_or_ATSU == Fl_Quartz_Graphics_Driver::use_ATSU) {
+ driver->descriptor_init_ATSU(name, size, this);
+ return;
+ }
+#endif
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+ driver->descriptor_init_CoreText(name, size, this);
+#endif
}
@@ -227,7 +233,12 @@ int Fl_Quartz_Graphics_Driver::descent() {
return fl_fontsize->descent + 1;
}
-void Fl_Quartz_Graphics_Driver::draw(const char *str, int n, float x, float y) { // is never called
+void Fl_Quartz_Graphics_Driver::draw(const char *str, int n, float x, float y) {
+ (this->*CoreText_or_ATSU_draw)(str, n, x, y);
+}
+
+double Fl_Quartz_Graphics_Driver::width(const UniChar* txt, int n) {
+ return (this->*CoreText_or_ATSU_width)(txt, n);
}
void Fl_Quartz_Graphics_Driver::draw(const char* str, int n, int x, int y) {
@@ -268,7 +279,21 @@ double Fl_Quartz_Graphics_Driver::width(unsigned int wc) {
void Fl_Quartz_Graphics_Driver::set_fontname_in_fontdesc(Fl_Fontdesc *f) {
- strlcpy(f->fontname, f->name, ENDOFBUFFER);
+#if HAS_ATSU
+ if (CoreText_or_ATSU == use_ATSU) {
+ strlcpy(f->fontname, f->name, ENDOFBUFFER);
+ return;
+ }
+#endif
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+ CFStringRef cfname = CFStringCreateWithCString(NULL, f->name, kCFStringEncodingUTF8);
+ CTFontRef ctfont = CTFontCreateWithName(cfname, 0, NULL);
+ CFRelease(cfname);
+ cfname = CTFontCopyFullName(ctfont);
+ CFRelease(ctfont);
+ CFStringGetCString(cfname, f->fontname, ENDOFBUFFER, kCFStringEncodingUTF8);
+ CFRelease(cfname);
+#endif
}
@@ -296,17 +321,46 @@ void Fl_Quartz_Graphics_Driver::font_name(int num, const char *name) {
}
+Fl_Fontdesc* Fl_Quartz_Graphics_Driver::calc_fl_fonts(void)
+{
+#if HAS_ATSU
+ if (CoreText_or_ATSU == use_ATSU) return built_in_table_full;
+#endif
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+ return built_in_table_PS;
+#endif
+}
+
+Fl_Font Fl_Quartz_Graphics_Driver::set_fonts(const char* xstarname)
+{
+#if HAS_ATSU
+ if (CoreText_or_ATSU == use_ATSU) return set_fonts_ATSU(xstarname);
+#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-/// CoreText-based code
+ return set_fonts_CoreText(xstarname);
+#endif
+}
+
-Fl_Fontdesc* Fl_CoreText_Graphics_Driver::calc_fl_fonts(void)
+void Fl_Quartz_Graphics_Driver::text_extents(const char* txt, int n, int& dx, int& dy, int& w, int& h)
{
- return built_in_table_PS;
+#if HAS_ATSU
+ if (CoreText_or_ATSU == use_ATSU) {
+ text_extents_ATSU(txt, n, dx, dy, w, h);
+ return;
+ }
+#endif
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+ text_extents_CoreText(txt, n, dx, dy, w, h);
+#endif
}
-void Fl_CoreText_Graphics_Driver::descriptor_init(const char* name, Fl_Fontsize size, Fl_Font_Descriptor *d) {
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+/// CoreText-based code
+
+void Fl_Quartz_Graphics_Driver::descriptor_init_CoreText(const char* name, Fl_Fontsize size, Fl_Font_Descriptor *d) {
CFStringRef str = CFStringCreateWithCString(NULL, name, kCFStringEncodingUTF8);
d->fontref = CTFontCreateWithName(str, size, NULL);
CGGlyph glyph[2];
@@ -387,7 +441,7 @@ static CGFloat variation_selector_width(CFStringRef str16, Fl_Font_Descriptor *f
return retval;
}
-double Fl_CoreText_Graphics_Driver::width(const UniChar* txt, int n) {
+double Fl_Quartz_Graphics_Driver::width_CoreText(const UniChar* txt, int n) {
double retval = 0;
UniChar uni;
int i;
@@ -457,7 +511,7 @@ double Fl_CoreText_Graphics_Driver::width(const UniChar* txt, int n) {
// text extent calculation
-void Fl_CoreText_Graphics_Driver::text_extents(const char *str8, int n, int &dx, int &dy, int &w, int &h) {
+void Fl_Quartz_Graphics_Driver::text_extents_CoreText(const char *str8, int n, int &dx, int &dy, int &w, int &h) {
Fl_Font_Descriptor *fl_fontsize = valid_font_descriptor();
UniChar *txt = mac_Utf8_to_Utf16(str8, n, &n);
CFStringRef str16 = CFStringCreateWithCharactersNoCopy(NULL, txt, n, kCFAllocatorNull);
@@ -490,7 +544,7 @@ static CGColorRef flcolortocgcolor(Fl_Color i)
return CGColorCreate(cspace, components);
}
-void Fl_CoreText_Graphics_Driver::draw(const char *str, int n, float x, float y) {
+void Fl_Quartz_Graphics_Driver::draw_CoreText(const char *str, int n, float x, float y) {
Fl_Font_Descriptor *fl_fontsize = valid_font_descriptor();
// convert to UTF-16 first
UniChar *uniStr = mac_Utf8_to_Utf16(str, n, &n);
@@ -547,7 +601,7 @@ static int name_compare(const void *a, const void *b)
}
}
-Fl_Font Fl_CoreText_Graphics_Driver::set_fonts(const char* xstarname) {
+Fl_Font Fl_Quartz_Graphics_Driver::set_fonts_CoreText(const char* xstarname) {
#pragma unused ( xstarname )
if (fl_free_font > FL_FREE_FONT) return (Fl_Font)fl_free_font; // if already called
@@ -581,15 +635,6 @@ Fl_Font Fl_CoreText_Graphics_Driver::set_fonts(const char* xstarname) {
return (Fl_Font)fl_free_font;
}
-void Fl_CoreText_Graphics_Driver::set_fontname_in_fontdesc(Fl_Fontdesc *f) {
- CFStringRef cfname = CFStringCreateWithCString(NULL, f->name, kCFStringEncodingUTF8);
- CTFontRef ctfont = CTFontCreateWithName(cfname, 0, NULL);
- CFRelease(cfname);
- cfname = CTFontCopyFullName(ctfont);
- CFRelease(ctfont);
- CFStringGetCString(cfname, f->fontname, ENDOFBUFFER, kCFStringEncodingUTF8);
- CFRelease(cfname);
-}
#endif // >= 10.5
@@ -597,7 +642,7 @@ void Fl_CoreText_Graphics_Driver::set_fontname_in_fontdesc(Fl_Fontdesc *f) {
#if HAS_ATSU
/// ATSU-based code to support Mac OS < 10.5
-void Fl_ATSU_Graphics_Driver::descriptor_init(const char* name, Fl_Fontsize size, Fl_Font_Descriptor *d) {
+void Fl_Quartz_Graphics_Driver::descriptor_init_ATSU(const char* name, Fl_Fontsize size, Fl_Font_Descriptor *d) {
OSStatus err;
// fill our structure with a few default values
d->ascent = size*3/4.;
@@ -650,7 +695,7 @@ void Fl_ATSU_Graphics_Driver::descriptor_init(const char* name, Fl_Fontsize size
ATSUSetTransientFontMatching (d->layout, true);
}
-void Fl_ATSU_Graphics_Driver::draw(const char *str, int n, float x, float y) {
+void Fl_Quartz_Graphics_Driver::draw_ATSU(const char *str, int n, float x, float y) {
Fl_Font_Descriptor *fl_fontsize = valid_font_descriptor();
// convert to UTF-16 first
UniChar *uniStr = mac_Utf8_to_Utf16(str, n, &n);
@@ -670,7 +715,7 @@ void Fl_ATSU_Graphics_Driver::draw(const char *str, int n, float x, float y) {
CGContextSetShouldAntialias(gc, false);
}
-double Fl_ATSU_Graphics_Driver::width(const UniChar* txt, int n) {
+double Fl_Quartz_Graphics_Driver::width_ATSU(const UniChar* txt, int n) {
OSStatus err;
Fixed bBefore, bAfter, bAscent, bDescent;
ATSUTextLayout layout;
@@ -696,7 +741,7 @@ double Fl_ATSU_Graphics_Driver::width(const UniChar* txt, int n) {
return len;
}
-void Fl_ATSU_Graphics_Driver::text_extents(const char *str8, int n, int &dx, int &dy, int &w, int &h) {
+void Fl_Quartz_Graphics_Driver::text_extents_ATSU(const char *str8, int n, int &dx, int &dy, int &w, int &h) {
Fl_Font_Descriptor *fl_fontsize = valid_font_descriptor();
UniChar *txt = mac_Utf8_to_Utf16(str8, n, &n);
OSStatus err;
@@ -725,7 +770,7 @@ void Fl_ATSU_Graphics_Driver::text_extents(const char *str8, int n, int &dx, int
//printf("r: %d l: %d t: %d b: %d w: %d h: %d\n", bbox.right, bbox.left, bbox.top, bbox.bottom, w, h);
}
-Fl_Font Fl_ATSU_Graphics_Driver::set_fonts(const char* xstarname) {
+Fl_Font Fl_Quartz_Graphics_Driver::set_fonts_ATSU(const char* xstarname) {
#pragma unused ( xstarname )
if (fl_free_font > FL_FREE_FONT) return (Fl_Font)fl_free_font; // if already called
@@ -765,11 +810,6 @@ Fl_Font Fl_ATSU_Graphics_Driver::set_fonts(const char* xstarname) {
return (Fl_Font)fl_free_font;
}
-Fl_Fontdesc* Fl_ATSU_Graphics_Driver::calc_fl_fonts(void)
-{
- return built_in_table_full;
-}
-
#endif // HAS_ATSU
#endif // FL_CFG_GFX_QUARTZ
diff --git a/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx
index fe2f3d435..59a3b5e93 100644
--- a/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx
@@ -53,7 +53,7 @@ Fl_Quartz_Image_Surface_Driver::Fl_Quartz_Image_Surface_Driver(int w, int h, int
CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
offscreen = CGBitmapContextCreate(calloc(W*H,4), W, H, 8, W*4, lut, kCGImageAlphaPremultipliedLast);
CGColorSpaceRelease(lut);
- driver(Fl_Graphics_Driver::newMainGraphicsDriver());
+ driver(new Fl_Quartz_Graphics_Driver);
CGContextTranslateCTM(offscreen, 0.5, -0.5); // as when drawing to a window
if (high_res) {
CGContextScaleCTM(offscreen, 2, 2);