extrafont icon indicating copy to clipboard operation
extrafont copied to clipboard

"No FontName. Skipping" during font_import()

Open amackey opened this issue 11 years ago • 22 comments

e.g.:

/Library/Fonts/BigCaslon.ttf : No FontName. Skipping.

and (more spectacularly):

/Library/Fonts/Chalkduster.ttfsh: line 1: 86587 Abort trap: 6
'/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rttf2pt1/exec//ttf2pt1' -a -GfAe '/Library/Fonts/Chalkduster.ttf' '/var/folders/jd/hrv5pvps34lflzkmt6q1czsc0000gp/T//RtmpAT3LLx/fonts/Chalkduster' 2>&1
 : No FontName. Skipping.

I also received a number of warnings (this is an excerpt):

38: In readLines(fd, 30) : seek on a gzfile connection returned an internal error
39: In readLines(fd, 30) : seek on a gzfile connection returned an internal error
40: In grepl("^FamilyName", text) : input string 4 is invalid in this locale
41: In grepl("^FontName", text) : input string 4 is invalid in this locale
42: In grepl("^FullName", text) : input string 4 is invalid in this locale
43: In grepl("^Weight", text) : input string 4 is invalid in this locale

Mac OS X 10.7.5, R 3.0.1 R version 3.0.1 (2013-05-16) Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] splines stats graphics grDevices utils datasets methods base

other attached packages: [1] extrafont_0.15 devtools_1.3 NADA_1.5-5 survival_2.37-4

loaded via a namespace (and not attached): [1] colorspace_1.2-3 dichromat_2.0-0 digest_0.6.3 evaluate_0.4.7 extrafontdb_1.0
[6] ggplot2_0.9.3.1.99 grid_3.0.1 gtable_0.1.2 httr_0.2 labeling_0.2
[11] MASS_7.3-29 memoise_0.1 munsell_0.4.2 parallel_3.0.1 plyr_1.8
[16] proto_0.3-10 RColorBrewer_1.0-5 RCurl_1.95-4.1 reshape2_1.2.2 Rttf2pt1_1.2
[21] scales_0.2.3 stringr_0.6.2 tools_3.0.1 whisker_0.3-2

amackey avatar Oct 18 '13 16:10 amackey

Unfortunately, these warnings are due to limitations in the ttf2pt1 program (the program hasn't been updated in many years) which extrafont uses via the Rttf2pt1 package.

wch avatar Oct 18 '13 16:10 wch

Unfortunately, it also means I can't import the font I want using ttf_import(), it seems to gets skipped

On Fri, Oct 18, 2013 at 12:07 PM, Winston Chang [email protected]:

Unfortunately, these warnings are due to limitations in the ttf2pt1 program (the program hasn't been updated in many years) which extrafont uses via the Rttf2pt1 package.

— Reply to this email directly or view it on GitHubhttps://github.com/wch/extrafont/issues/32#issuecomment-26608070 .

amackey avatar Oct 18 '13 17:10 amackey

Ran into the same problem. Ttf2pt1 seemed to have encoding issues. Fixed it by renaming the font with the freeware CR8 Type Light: I left all the names as they were, saved a copy of the font in a folder, and installed it with font_import(paths=<folder>).

don-reba avatar Dec 13 '13 22:12 don-reba

Realise this issue is now over 3 years old, but I encountered a similar problem with a font with 'No FontName'.

Turned out the .tff file permissions were different from the other fonts on my system (Mac, for reference). Setting the font file to be rwx for the 'other' user with $ chmod +orwx [font file] fixed the issue for me.

Jim89 avatar Mar 31 '17 13:03 Jim89

I have encountered the same issue on Windows, is there any solution to this? The file permissions are in order.

I provided further details on a Stackoverflow post

davidmetzlaff avatar Apr 15 '20 07:04 davidmetzlaff

I have encountered the same issue on Windows, is there any solution to this? The file permissions are in order.

I provided further details on a Stackoverflow post

I have tried to provide a workaround in the Stackoverflow post. I'm guessing that the issue is connected to a faulty .ttf file. Using the open-source software FontForge to re-save the .ttf file did the trick for me.

moritzpschwarz avatar Mar 08 '21 15:03 moritzpschwarz

@moritzpschwarz I have this problem for all font files, using Ubuntu 20.04. I don't think the problem is the files themselves, as they were working with extrafont on previous version of Ubuntu and R.

@wch What are the limitations of ttf2pt1 and how could this problem resurface if the ttf2pt1 hasn't changed?

beanumber avatar Jul 28 '21 16:07 beanumber

Problem occuring in Windows as well. All fonts are affected as well.

pteridin avatar Jul 31 '21 17:07 pteridin

I was dealing with this issue on Windows 10 until yesterday. I found this solution and now the package {extrafont} works fine. Problem with function "font_import()" was solved this way:

library(remotes) remotes::install_version("Rttf2pt1", version = "1.3.8") library(extrafont) loadfonts(device = "win") fonts()

Bustami avatar Aug 28 '21 03:08 Bustami

I was dealing with this issue on Windows 10 until yesterday. I found this solution and now the package {extrafont} works fine. Problem with function "font_import()" was solved this way:

library(remotes) remotes::install_version("Rttf2pt1", version = "1.3.8") library(extrafont) loadfonts(device = "win") fonts()

worked for me too, but you will have to add

import_fonts() before loadfonts(device = "win")

DavidZenz avatar Sep 14 '21 12:09 DavidZenz

library(remotes)
remotes::install_version("Rttf2pt1", version = "1.3.8")

worked fine for me as well, on Unix (R v4.1.1).

Thanks for the fix @Bustami !

Romain-B avatar Sep 15 '21 14:09 Romain-B

I was dealing with this issue on Windows 10 until yesterday. I found this solution and now the package {extrafont} works fine. Problem with function "font_import()" was solved this way: library(remotes) remotes::install_version("Rttf2pt1", version = "1.3.8") library(extrafont) loadfonts(device = "win") fonts()

worked for me too, but you will have to add

import_fonts() before loadfonts(device = "win")

I tried these recommendations on a mac (iOS 10.15.7). Didn't work for me.

Stan1778 avatar Sep 15 '21 20:09 Stan1778

I was dealing with this issue on Windows 10 until yesterday. I found this solution and now the package {extrafont} works fine. Problem with function "font_import()" was solved this way: library(remotes) remotes::install_version("Rttf2pt1", version = "1.3.8") library(extrafont) loadfonts(device = "win") fonts()

worked for me too, but you will have to add import_fonts() before loadfonts(device = "win")

I tried these recommendations on a mac (iOS 10.15.7). Didn't work for me.

Having same issue today:

R version 4.1.1 (2021-08-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.5.2

psychtek avatar Sep 16 '21 01:09 psychtek

Try the showtext package for adding fonts to r, its an alternative to extrafont that I have had a lot more success with.

https://cran.rstudio.com/web/packages/showtext/vignettes/introduction.html

michaellatter avatar Sep 19 '21 00:09 michaellatter

I have the same problems in Windows.

require(extrafontdb)
require(Rttf2pt1)
library(extrafont)
font_import()

And I always get this message for all fonts: C:\Windows\Fonts\ARIALNBI.TTF : No FontName. Skipping.

mabuimo avatar Sep 28 '21 23:09 mabuimo

I'm having the same problems and I had to install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/ first And I followed the above recs and it worked. Thanks so much

clairerichardsRN avatar Sep 30 '21 22:09 clairerichardsRN

I was dealing with this issue on Windows 10 until yesterday. I found this solution and now the package {extrafont} works fine. Problem with function "font_import()" was solved this way: library(remotes) remotes::install_version("Rttf2pt1", version = "1.3.8") library(extrafont) loadfonts(device = "win") fonts()

worked for me too, but you will have to add import_fonts() before loadfonts(device = "win")

I tried these recommendations on a mac (iOS 10.15.7). Didn't work for me.

Having same issue today:

R version 4.1.1 (2021-08-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.5.2

@psychtek Were you able to figure out a solution, I have the same issue and work on macOS Big Sur

kkulbir avatar Oct 22 '21 05:10 kkulbir

For those of you who have problems with this on a mac, try installing the xcode command line tools (and approve):

xcode-select --install
sudo xcodebuild -license accept

This works with extrafont 0.17 on macOS 12.0.1.

mvuorre avatar Nov 16 '21 14:11 mvuorre

Try the showtext package for adding fonts to r, its an alternative to extrafont that I have had a lot more success with.

https://cran.rstudio.com/web/packages/showtext/vignettes/introduction.html

The suggestion above by @michaellatter works seamlessly! I work with Mac OS Monterey 12.0.1. Thank you.

arunktiit avatar Dec 04 '21 09:12 arunktiit

I was dealing with this issue on Windows 10 until yesterday. I found this solution and now the package {extrafont} works fine. Problem with function "font_import()" was solved this way: library(remotes) remotes::install_version("Rttf2pt1", version = "1.3.8") library(extrafont) loadfonts(device = "win") fonts()

worked for me too, but you will have to add

import_fonts() before loadfonts(device = "win")

This worked for me but I had to use font_import() before loadfonts(device = "win") instead of import_fonts()

Using Windows 11

robbienukes avatar Sep 28 '22 18:09 robbienukes

I have a possible fix in the Rttf2pt1 package (wch/Rttf2pt1#20). If you would like to try it out, please install this build of Rttf2pt1 the following and let me know how it goes:

library(remotes)
remotes::install_github("wch/Rttf2pt1#20")

wch avatar Jan 18 '23 04:01 wch

Thank you very much for fixing this issue!

The fix works for me on R version 4.2.2 (2022-10-31) MacOS 13.1, Apple M1

A strange observation for a pdf export: The "preview" application on Mac OS X does not use the correct fonts, while Inkscape (and poppler) display the plot correctly.

sjewo avatar Jan 18 '23 17:01 sjewo