R007
R007

Reputation: 123

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

R Graph - graphical string measurement

Could we define font-alias as described for svglite in below link

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

Upvotes: 0

Views: 429

Answers (1)

dww
dww

Reputation: 31454

Most Linux distros use Fontconfig to define font aliases. These should be respected by most of the graphical devices that R uses.

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.

<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

<?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.

Upvotes: 2

Related Questions