简体   繁体   English

R strwidth - Linux 上的“Times New Roman”字体别名

[英]R strwidth - "Times New Roman" font alias on Linux

I am using strwidth() function (see link below) and looking for a solution to define font-alias for Times New Roman on Linux我正在使用 strwidth() 函数(参见下面的链接)并寻找一种解决方案来为 Linux 上的 Times New Roman 定义字体别名

R Graph - graphical string measurement R Graph - 图形字符串测量

Could we define font-alias as described for svglite in below link我们可以在下面的链接中为 svglite 定义字体别名吗

https://cran.r-project.org/web/packages/svglite/vignettes/fonts.html https://cran.r-project.org/web/packages/svglite/vignettes/fonts.html

Most Linux distros use Fontconfig to define font aliases.大多数 Linux 发行版使用 Fontconfig 来定义字体别名。 These should be respected by most of the graphical devices that R uses. R 使用的大多数图形设备都应该尊重这些。

For example, to define Tinos as an alias for Times New Roman, you can add the following lines to the file ~/.config/fontconfig/fonts.conf , between the <fontconfig> and </fontconfig> tags.例如,要将 Tinos 定义为 Times New Roman 的别名,您可以将以下几行添加到文件~/.config/fontconfig/fonts.conf ,位于<fontconfig></fontconfig>标记之间。

<match>
    <test name="family"><string>Times New Roman</string></test>
    <edit name="family" mode="assign" binding="strong">
      <string>Tinos</string>
    </edit>
</match>

Note that, if ~/.config/fontconfig/fonts.conf does not exist already, you will need to create it and put the following lines into it first请注意,如果~/.config/fontconfig/fonts.conf不存在,您需要创建它并首先将以下几行放入其中

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
</fontconfig>

If you want to apply these changes system wide rather than just for one user, then instead edit etc/fonts/local.conf instead.如果您想在系统范围内应用这些更改,而不仅仅是针对一个用户,那么请改为编辑etc/fonts/local.conf

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 grid.text() 中使用 Times new Roman 字体? - How to use Times new Roman font in grid.text()? 使用ggplot将文本制作为新罗马字体的问题 - Problem making text as times new roman font with ggplot Mac上的R错误:“家庭&#39;Times New Roman&#39;未包含在postscript()设备中” - R error on a Mac: “family 'Times New Roman' not included in postscript() device” 如何在 R 中为热图中的行和列设置 Times New Roman 文本 - How set Times New Roman text for Rows and Columns in a Heatmap In R 在 r markdown docx 中使用 Times New Roman 12 pt - Use Times New Roman 12 pt in r markdown docx 有没有办法改变 gtsummary package 表格中的字体? 具体来说,将其更改为 Times New Roman 字体 - Is there a way to change the font in tables of gtsummary package? Specifically, change it into Times New Roman font R/exams NOPS 在 Times New Roman 中生成文档,然后在扫描过程中失败 - R/exams NOPS generates documents in Times New Roman, which then fail during scanning corrplot:更改为新的罗马corrplot()输出的时间 - corrplot: Changing to times new roman corrplot() output R - 使用 strwidth() 测量字符串的宽度 - R - Measure width of string using strwidth() 绘制图例并获取:strwidth错误(图例,单位=“用户”,cex = cex,font = text.font):plot.new尚未调用 - Plotting legend and getting: Error in strwidth(legend, units = “user”, cex = cex, font = text.font) : plot.new has not been called yet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM