gpt4 book ai didi

r - 我无法使用 font_import 导入字体

转载 作者:行者123 更新时间:2023-12-05 09:11:31 24 4
gpt4 key购买 nike

我正尝试按照 here 中的描述为 ggplot2 图表导入字体.

当我试着用这段代码一 block 一 block 地做时:

font_import(pattern = "Arial.ttf")
y

我收到这个错误:

canning ttf files in C:\windows\Fonts ...
Extracting .afm files from .ttf files...
Error in data.frame(fontfile = ttfiles, FontName = "", stringsAsFactors = FALSE) :
arguments imply differing number of rows: 0, 1

我检查过我确实有 Arial 字体: enter image description here

我的问题是什么

最佳答案

我遇到了同样的问题,即尝试使用 font_import() 导入字体 (Zallman Caps) 并收到相同的错误:

"Error in data.frame(fontfile = ttfiles, FontName = "", stringsAsFactors = FALSE) : 
arguments imply differing number of rows: 0, 1"

经过大量试验和错误,我终于找到了适合我的解决方案,也许它也适合你。

即使我可以在我的 Windows 字体文件夹中看到 Zallman Caps 字体并验证它在 Word 中工作,font_import()list.files() 都不能在那里找到它。我通过输入以下代码设法导入了字体:

font_import(path = "C:/Users/*insert your user name*/AppData/Local/Microsoft/Windows/Fonts", pattern = ".TTF")

我不知道为什么它在主字体目录中对 R 不可见,而我可以在 Windows 文件资源管理器中清楚地看到它,但至少我设法使用此解决方法导入了字体。

关于r - 我无法使用 font_import 导入字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59949572/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com