windows - 以编程方式在 R Console 中设置字体和字体大小?

标签 windows r user-interface console

是否可以设置 console font and font size ,就像我对“编辑->GUI 首选项”一样,以编程方式?这个功能会是什么样子?我在 Windows 上。

最佳答案

在 Windows 上(至少),$R_HOME/etc/Rconsole 配置文件为控制台和寻呼机设置了许多可选参数。这是您可以手动编辑以更改默认字体和字体大小的部分:

## Font.
# Please use only fixed width font.
# If font=FixedFont the system fixed font is used; in this case
# points and style are ignored. If font begins with "TT ", only
# True Type fonts are searched for.
font = TT Courier New
points = 10
style = normal # Style can be normal, bold, italic

要从事件 R session 的命令行更改值,您可以使用 loadRconsole() 函数。它读入一个包含上述形式的指令的文本文件,这将覆盖 R 启动时从 Rconsole 读取的值。这是一个例子:

temp <- tempfile()
cat("points = 13\n", file = temp)
cat("style = italic\n", file = temp, append = TRUE)
loadRconsole(file = temp)

## And then, to reset to the defaults:
loadRconsole(file = file.path(R.home(), "etc/Rconsole"))

关于windows - 以编程方式在 R Console 中设置字体和字体大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14712401/

相关文章:

windows - 通过另一个程序向 GUI 应用程序提供输入

r - Sweave 缓存包

r - 如何在 Shiny 的应用程序中使用多个过滤器有效处理数据

环球银行金融电信协会2 : multiline MKPointAnnotation

windows - 使用 Powershell [DateTime]::ParseExact - 有趣的字符串?

c# - 当有人使用我的带有 "Open With"的程序时,我如何知道打开了什么文件?(C#)

windows - 从 java 代码中以编程方式查找绝对 java.exe 路径

r - R 中任意点的精确核密度值

java - 实例变量的值在两个类中是不同的。为什么? (+更多问题)

JAVA显示图像-GUI