Open jpgoldberg opened 2 years ago
I did a quick test with ttf2afm
from pdftex and on first sight it might work out. At the moment pdf export seems to function properly on linux systems (I tested this also on Mac OS, but I did not install ghostscript).
I patched truetype.r
to use ttf2afm
in my fork: https://github.com/sjewo/extrafont
You might need to install the binary first:
library(tinytex)
tlmgr_install("ttfutils")
Update:
ttf2afm
differ and pdf export fails (unknown width).On a mac, ttf2pt1
installed with Homebrew (using the bottled version compiled by them) works. It is a drop-in replacement for the one in Rttf2pt1 - as in I copied the homebrew binary to the Rttf2pt1/exec/ R library folder, and then all the TTF files in my system were able to be imported (i.e. no segmentation fault and the Font Name was returned) except for a few. (With Rttf2pt1, only about half worked).
I do not know how R handles fonts, but it appears that it only deals with Type1 postscript fonts for which we need a separate font metrics file,
fontname.afm
.extrafont
relies onttf2pt1
to extract the afm. But it appears thatttf2pt1
is abandonware. (It certainly gives me a bunch of compiler warnings when built).Possible options
From the extrafont source in
truetype.r
we find the commentI am assuming that that is
ttf2afm
from pdftex (source) but I am assuming that that was about the one that comes in common TeX installations.There is a Rust crate that uses https://docs.rs/ttf-parser/0.14.0/ttf_parser/index.html I do not know enough about the structure of ttf and or afm to see how to use that to generate an afm from a ttf.