在 GoogleFonts 中使用粗体
Using bold font with GoogleFonts
我现在有点迷茫:
我已经通过 GoogleFonts 在我的 R 脚本中添加了一种字体,现在想使用“粗体”版本。但是,我找不到办法!
我已经尝试了各种方法,但都不起作用 - 我期待一个简单的解决方案,但我就是想不通!
我在下面附上了一个可重现的小例子,如果有人能告诉我如何使用 Roboto-bold 中的“Text1”例子之一,我将不胜感激。
顺便说一句,这是 Roboto 的 GoogleFonts 页面:https://fonts.google.com/specimen/Roboto
谢谢您,并致以最诚挚的问候!
当前代码:
library(showtext)
font_add_google(name = "roboto", family = "roboto")
showtext_auto()
ggdraw() +
draw_text("__Text1__", x = 0.82, y = 0.69, color = "black", size = 35, family = "roboto")+
draw_text("Text1", x = 0.4, y = 0.69, color = "black", size = 35, family = "roboto")+
draw_text("Text1", x = 0.1, y = 0.69, color = "black", size = 35)
因为 draw_text
是基于 geom_text
的 fontface
参数在这里也适用:
ggdraw() +
draw_text("Bold&\nItalic", x = 0.82, y = 0.69, color = "black", size = 35, family = "roboto",fontface="bold.italic")+
draw_text("Italic", x = 0.62, y = 0.69, color = "black", size = 35, family = "roboto",fontface="italic")+
draw_text("Bold", x = 0.4, y = 0.69, color = "black", size = 35, family = "roboto",fontface="bold")+
draw_text("Normal", x = 0.15, y = 0.69, color = "black", size = 35)
我现在有点迷茫: 我已经通过 GoogleFonts 在我的 R 脚本中添加了一种字体,现在想使用“粗体”版本。但是,我找不到办法!
我已经尝试了各种方法,但都不起作用 - 我期待一个简单的解决方案,但我就是想不通!
我在下面附上了一个可重现的小例子,如果有人能告诉我如何使用 Roboto-bold 中的“Text1”例子之一,我将不胜感激。
顺便说一句,这是 Roboto 的 GoogleFonts 页面:https://fonts.google.com/specimen/Roboto
谢谢您,并致以最诚挚的问候!
当前代码:
library(showtext)
font_add_google(name = "roboto", family = "roboto")
showtext_auto()
ggdraw() +
draw_text("__Text1__", x = 0.82, y = 0.69, color = "black", size = 35, family = "roboto")+
draw_text("Text1", x = 0.4, y = 0.69, color = "black", size = 35, family = "roboto")+
draw_text("Text1", x = 0.1, y = 0.69, color = "black", size = 35)
因为 draw_text
是基于 geom_text
的 fontface
参数在这里也适用:
ggdraw() +
draw_text("Bold&\nItalic", x = 0.82, y = 0.69, color = "black", size = 35, family = "roboto",fontface="bold.italic")+
draw_text("Italic", x = 0.62, y = 0.69, color = "black", size = 35, family = "roboto",fontface="italic")+
draw_text("Bold", x = 0.4, y = 0.69, color = "black", size = 35, family = "roboto",fontface="bold")+
draw_text("Normal", x = 0.15, y = 0.69, color = "black", size = 35)