相关疑难解决方法(0)

grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, 中的警告:字符 0x20 的字体宽度未知

我想在图表中使用免费字体Latoggplot2,因为我的 R markdown 文档的其余部分就是用这种字体设置的。

该字体已安装在我的系统上,并且可以在字体簿中使用(仅一次)。

所有可用的字体都随extrafont包一起加载并在extrafontdb.

当我将 Markdown 文档编织为 PDF 时,所有文本都以Lato. 但是,我的 ggPlots 的绘图标签未显示。

我还收到以下警告消息:

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font width unknown for character 0x20

嵌入文档中包含的字体后,extrafont::embed_fonts所有使用Lato字体的图形都会显示绘图标签,但是

  • 绘图标签的单词之间不包含任何空格,
  • 任何引用(内部链接、URL、引文)都不再有效。

下面提供了一个 MWE,包括带有和不带有 Lato 字体的 ggPlot 图形(Lato 可以在此处免费获得)要随后嵌入字体,需要运行embed_fonts("TestRmd.pdf", outfile="TestRmd_embedded.pdf")

任何帮助是极大的赞赏!

微量元素:

---
title: "Embedding Fonts in PDF"
output: pdf_document
urlcolor: blue
---

```{r echo=FALSE}
library(ggplot2)
```

### Plot with standard font {#standard} …
Run Code Online (Sandbox Code Playgroud)

markdown r ggplot2 r-markdown extrafont

8
推荐指数
1
解决办法
7989
查看次数

使用R package extrafont生成错误"字符宽度未知的字符0x48"

library(extrafont)
setEPS()
postscript("demo.eps", width=3.3, height=3.3, onefile=FALSE, horizontal=FALSE,      paper = "special", family = "Times New Roman")
plot(rnorm(100), main="Hey Some Data")
dev.off()
Run Code Online (Sandbox Code Playgroud)

我安装了extrafont软件包,还导入了字体并加载了postscript设备的字体.一切都很好.但是当postscript设备以特定字体启动并且给出了plot命令时,它开始抛出一个错误消息列表,基本上说"字体宽度未知为字符0x53"等.我也使用extrafont命令embed_fonts将字体嵌入到图形中( ).它产生了一个图,但没有进行字体更改.但是当我使用cairo_ps设备时,它工作得非常好.为什么不使用postscript设备?有帮助吗?

fonts r

6
推荐指数
1
解决办法
882
查看次数

标签 统计

r ×2

extrafont ×1

fonts ×1

ggplot2 ×1

markdown ×1

r-markdown ×1