-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Font_import imports no fonts #74
Comments
I also was unable to import fonts on macOS Catalina 10.15.7. This error occurred:
I tried the following because I was only interested in importing Arial Unicode fonts:
That gave me this output:
I'm not sure what "string 4" refers to. My locale is set as follows:
R session info:
|
I was able to get farther along in the process. Turns out I had option(warn=2), which turned warnings into errors. I did option(warn=0) and reran font_import(pattern="Arial Unicode.*"). This gave me the following output:
I was hoping the font would work, but got the following error when testing it:
It seems that it doesn't want to recognize the Unicode character U+2690, which is the entire reason I tried to install this font. I was able to get around the above problem by using the cairo_pdf() device. It no longer gave the above errors, but I still saw only a rectangle instead of the "flag" Unicode character, in the pdf file, even after embedding the font into the file. I also tried something that was recommended:
I tried rerunning font_import(pattern="Arial Unicode.*") but it did not re-import the font because it was already imported. I guessed that I could fix this problem by re-installing extrafont as the install instructions said this would "reset the font database" and that sounded like something to try. It worked and then I was able to do the font_import, and this time, I did not get any errors. And, I was able to make a pdf file with either pdf() or cairo_pdf() with no errors occurring. But still, the Unicode "flag" character displayed as a square, even with fonts embedded. |
Suggestion: in the extrafont installation instructions, add "options(warn=0)". |
Unicode has been around for decades now, but it still isn't possible to use many Unicode characters in R within a PDF file. Why not? My reading so far has led me to conclude that it might be because the design of the PDF file standard by Adobe is old and predates Unicode and revisions to the PDF standard have not adequately incorporated Unicode. I'm suspecting that with a PDF file we are back to dealing with 8-bit fonts that only have room for 256 characters, so using Unicode characters outside the usual ones means that somehow we have to provide 8-bit fonts containing the characters we need to use. Suggestion: as part of the "extrafont" installation instructions, include a paragraph summarizing the state of affairs of Unicode characters and PDF files. Indicate what problems can be solved by extrafont and which problems cannot be solved by it. Describe difference between true-type fonts and adobe type 1 fonts. Describe what the "encoding" concept means, how it affects putting Unicode characters into PDF files, and what the deal is with UTF-8 encoding and pdf files. Describe what embedding a font does, that doesn't happen when the font is not embedded. Say what the mysterious mbcsToSbcs function does. Say something about what causes a square to appear in a pdf file when a Unicode character is used, vs. what causes a string such as "UTF-8" to appear in place of the character in the pdf file. Explain about arm files and font width tables and how this might relate to "extrafont" failure to install the Arial Unicode MS.ttf font file such that every character in it can be used in a pdf file. Give the reader enough of an understanding that he can figure out what is wrong when he is trying to put a Unicode character into a pdf file and it doesn't work. A nice introduction to the problem like this would be invaluable, I think, for so many people struggling with this problem. |
Suggestion: make font_import() import even if the font already exists, or have an argument "force" that forces such import. |
Hi all,
I run R 3.6.1 on a macOS Catalina (10.15) and have installed R, extrafont and extrafontdb with conda. Ghostscript and Xcode are installed.
When running
font_import()
it goes through a lot of fonts but somehow doesn't install them for R. Here are the last lines of the output:The warnings contain the following messages:
When I load
extrafont
and runload_fonts()
, the output offonts()
andfonttable()
is NULL.Would be grateful for a tip or a hint in solving this!
The text was updated successfully, but these errors were encountered: