wch / extrafont

Tools for using fonts in R graphics
315 stars 48 forks source link

font_import segfaults. #89

Closed shabbychef closed 3 years ago

shabbychef commented 3 years ago

Using extrafont 0.17 on a new Macbook pro with R 4.1.0, font_import segfaults with messages like:

/System/Library/Fonts/Symbol.ttfsh: line 1: 63067 Segmentation fault: 11  '/usr/local/lib/R/4.1/site-library/Rttf2pt1/exec//ttf2pt1' -a -GfAe '/System/Library/Fonts/Symbol.ttf' '/var/folders/mh/7yrr1szn11d93_xgxgw55p1r0000gp/T//RtmpVegOGc/fonts/Symbol' 2>&1
 : No FontName. Skipping.
/System/Library/Fonts/ZapfDingbats.ttfsh: line 1: 63069 Segmentation fault: 11  '/usr/local/lib/R/4.1/site-library/Rttf2pt1/exec//ttf2pt1' -a -GfAe '/System/Library/Fonts/ZapfDingbats.ttf' '/var/folders/mh/7yrr1szn11d93_xgxgw55p1r0000gp/T//RtmpVegOGc/fonts/ZapfDingbats' 2>&1
 : No FontName. Skipping.

Indeed, running that command on the command line yields:

Using language 'latin1' for Unicode fonts
Auto-detected front-end parser 'ttf'
 (use ttf2pt1 -p? to get the full list of available front-ends)
Processing file /System/Library/Fonts/ZapfDingbats.ttf
Some font name strings are in Unicode, may not show properly
Font name is unknown, setting to "Unknown"
numglyphs = 208
No Microsoft encoding, looking for MAC encoding
Glyph .notdef has >= two encodings (B), 0001 & 0002
Glyph .notdef has >= two encodings (B), 0001 & 0003
Glyph .notdef has >= two encodings (B), 0001 & 0004
... (cut)
Glyph .notdef has >= two encodings (B), 0001 & 00f0
Glyph .notdef has >= two encodings (B), 0001 & 00ff
Segmentation fault: 11
shabbychef commented 3 years ago

Hmmm, perhaps this is the fault of Rttf2pt1. I have tried re-installing that package, from source, and still get the same error. Note that the install of Rttf2pt1 has many warnings from clang.

wzbillings commented 3 years ago

The maintainer is aware that Rttf2pt1 has lots of warnings as it hasn't been maintained in a number of years-- but see #88 and try downgrading the version of Rttf2pt1?

shabbychef commented 3 years ago

Yes, the solution in #88 solves this, to wit

remotes::install_version("Rttf2pt1", version = "1.3.8")
extrafont::font_import()