#67298 closed defect (fixed)

R 4.3.0 is broken on 10.6.8: Symbol not found: _CTFontDrawGlyphs

Reported by: barracuda156 Owned by: barracuda156
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: snowleopard, leopard Cc:
Port: R

Description

byte-compiling package 'graphics'
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_R/R/work/R-4.3.0/library/grDevices/libs/grDevices.so':
  dlopen(/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_R/R/work/R-4.3.0/library/grDevices/libs/grDevices.so, 6): Symbol not found: _CTFontDrawGlyphs
  Referenced from: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_R/R/work/R-4.3.0/library/grDevices/libs/grDevices.so
  Expected in: dynamic lookup
Calls: <Anonymous> ... namespaceImport -> loadNamespace -> library.dynam -> dyn.load
Execution halted

Attachments (1)

R_4.3.0_log.txt (216.1 KB) - added by barracuda156 19 months ago.

Download all attachments as: .zip

Change History (8)

Changed 19 months ago by barracuda156

Attachment: R_4.3.0_log.txt added

comment:2 Changed 19 months ago by barracuda156

Owner: set to ryandesign
Status: newassigned

Ryan, could we do something about this? My main system is 10.6, it is a trouble for testing if 4.3.0 is broken.

_CTFontDrawGlyphs is available 10.7+: https://developer.apple.com/documentation/coretext/1509850-ctfontdrawglyphs

comment:3 Changed 19 months ago by barracuda156

The only instance of this symbol is in src/library/grDevices/src/devQuartz.c. And that file doubled (!) in size since 4.2.3.

Code chunk in question:

void RQuartz_glyph(int n, int *glyphs, double *x, double *y, 
                   SEXP font, double size,
                   int colour, double rot, pDevDesc dd)
{
    DRAWSPEC;
    if (!ctx) NOCTX;
    CGContextRef savedCTX = ctx;
    CGLayerRef layer;

    if (n < 1) 
        return;

    /* Not able to add glyphs to the current path. */
    if (xd->appending) 
        return;

    Rboolean grouping = QuartzBegin(&ctx, &layer, xd);

    char url[501];
    snprintf(url, 500, "file://%s", R_GE_glyphFontFile(font));
    CFStringRef cfFontFileName = 
        CFStringCreateWithCString(NULL, url, kCFStringEncodingUTF8);
    CFURLRef cfFontURL = CFURLCreateWithString(NULL, cfFontFileName, NULL);
    CFArrayRef cfFontDescriptors = 
        CTFontManagerCreateFontDescriptorsFromURL(cfFontURL);
    CFRelease(cfFontFileName);
    CFRelease(cfFontURL);
    int n_fonts = CFArrayGetCount(cfFontDescriptors);
    if (n_fonts > 0) {
        /* NOTE: that the font needs an inversion (in y) matrix
           because the device has an inversion in user space 
           (for bitmap devices anyway) */
        CGAffineTransform trans = CGAffineTransformMakeScale(1.0, -1.0);
	if (rot != 0.0) trans = CGAffineTransformRotate(trans, rot/180.*M_PI);
        CTFontRef ctFont = 
            CTFontCreateWithFontDescriptor((CTFontDescriptorRef) CFArrayGetValueAtIndex(cfFontDescriptors, 0), size, &trans);

        CGColorSpaceRef cs = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
        CGFloat fillColor[] = { R_RED(colour)/255.0, 
                                R_GREEN(colour)/255.0, 
                                R_BLUE(colour)/255.0, 
                                R_ALPHA(colour)/255.0 };
        CGColorRef fillColorRef = CGColorCreate(cs, fillColor);
        CGContextSetFillColorWithColor(ctx, fillColorRef);
        int i;
        for (i=0; i<n; i++) {
            CGGlyph glyph = glyphs[i];
            CGPoint loc = CGPointMake(x[i], y[i]);
            CTFontDrawGlyphs(ctFont, &glyph, &loc, 1, ctx);
        }
        CGColorRelease(fillColorRef);
        CFRelease(ctFont);
    } else {
        warning(_("Failed to load font"));
    }
    CFRelease(cfFontDescriptors);
    
    QuartzEnd(grouping, layer, ctx, savedCTX, xd);
}

comment:4 Changed 19 months ago by barracuda156

Resolution: fixed
Status: assignedclosed

In 2ab63f45d7f8525589eac92def5868ef4bae1b20/macports-ports (master):

R: fix build on 10.6

Fixes: #67298

comment:5 Changed 19 months ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: closedreopened

Sorry, I don't know anything about R.

comment:6 Changed 19 months ago by ryandesign (Ryan Carsten Schmidt)

Owner: changed from ryandesign to barracuda156
Status: reopenedassigned

comment:7 Changed 19 months ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.