Error in grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : Polygon edge not found

Solution 1:

this happened to me and i discovered that the arial font file had been disabled. first check to see if Arial.ttf has been moved to the disabled fonts directory. from the terminal:

ls /Library/Fonts\ Disabled

if so, move it back to the active fonts directory.

sudo mv /Library/Fonts\ Disabled/Arial.ttf /Library/Fonts

log out, log in, then open the 'Font Book' application. in my case, arial was present before hand, but it was the Microsoft version stored in /Library/fonts/Microsoft/. Font Book may now show a yellow triangle next to the font name, indicating that multiple copies of the font exist. highlight the font name and chose the Resolve Duplicates command from the Edit menu. this should disable the Microsoft copy, which you can confirm by selecting one of the arial type faces (click the expand triangle next to the font name), right-click on the one labelled Off, and choose Reveal in Finder, which should open a window to Microsoft fonts directory.

Solution 2:

So I bumped into the same problem with a code that was working just a few weeks before, and no massive update of anything on the computer (except maybe the OS, now that I get to think about it...). The way I solved it is that I forced the graphic window to open first by calling

quartz()

before my graphs, and it did the trick. Still unsure about the font, I seem to have the Arial in place.

Solution 3:

After a few trials, I think this "fix" could help. First try running this to ensure the fonts actually exist:

loadfonts(dev="win")

If they do, call the following to ensure the name you're calling is similar to that R knows:

windowsFonts()

Otherwise, try the following:

library(extrafont)
extrafont::font_import()

The above fixed problems for me. Hope someone in the future may be helped by the same.

Solution 4:

After coming across the same problem again and again and trying different solutions I have decided to source the Arial font externally and add it to the Font Book. Prior to this exercise I had a number of fonts that came with MS Office, like Arial Black, Arial Narrow and so no but no plain Arial font visible. I'm guessing that this can be explained by the odd font policy that MS applications on Mac are applying, which is discussed in a greater detail here. Nevertheless, it appears that adding font externally solved the problem.

All Fonts