how can I make svglite render portable svgs on travis-ci?












1















Plots rendered through svglite look differently when rendered through Travis, then when rendered locally.



This happens, because my local machine (macOS in this case) aliases different (more standard?) fonts for the default R plots



gdtools::match_family("Arial")
## [1] "Arial"
gdtools::match_family("sans")
## [1] "Bitstream Vera Sans"


... than travis ci:



gdtools::match_family("Arial")
## [1] "Liberation Sans"
gdtools::match_family("sans")
## [1] "DejaVu Sans"


"Liberation Sans", in turn, is not necessarily available on all computers viewing the svg (it wasn't on mine, until I ran brew cask install font-liberation-sans).



So, while the locally-generated SVGs have pretty decent portability (~"Arial"), the TravisCI-generated (~"Liberation Sans") do not.



I'd like rock-solid portability that works on every computer with a reasonable current browser.
I understand from svglite fonts vignette that I should probably use User font aliases to accomplish this, but I have not managed to get it to work, and am pretty confused about the whole font businesses.



I just want SVGs from svglite that look the same everywhere.



Here's the boilerplate index.Rmd that creates the different plots.



---
title: "index"
author: "foo"
date: "11/2/2018"
output:
rmarkdown::html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

# `png` Device

```{r png, echo=FALSE, dev = 'png'}
plot(pressure)
```


# `svg` Device

```{r svg, echo=FALSE, dev = 'svg'}
plot(pressure)
```


# `svglite` Device

```{r svglite, echo=FALSE, dev = 'svglite'}
plot(pressure)
```


(The entire repo and travis builds is here, finished website is at http://datascience.phil.fau.de/rmdbpl/).



When rendered locally (macOS) all three plots look roughly the same:



rendered locally



When build on Travis CI, the plot rendered through svglite, viewed on a machine without "Liberation Sans" will substitute a serif fonts, which looks bad.



travis










share|improve this question

























  • if anyone has enough points to add an svglite tag to this question, that'd be great.

    – maxheld
    Nov 25 '18 at 13:59






  • 1





    Max of 5 tags regardless of rep

    – hrbrmstr
    Nov 25 '18 at 14:09






  • 1





    Have you tried adding gdtools::match_family("Arial") to an R code block in the Rmd and seeing what it says? Also, have you tried installing any OS font packages (Travis-CI base builds are pretty bare-bones)

    – hrbrmstr
    Nov 25 '18 at 14:21













  • @hrbrmstr ah, yes of course – I cut it down to 4 tags, one available for svglite now.

    – maxheld
    Nov 25 '18 at 15:39






  • 1





    Ah, so I'm wondering, now, if you're viewing the svglite-generated document on a system without Liberation Sans. What happens if you install fontsquirrel.com/fonts/liberation-sans on the OS you're viewing the generated HTML document from?

    – hrbrmstr
    Nov 25 '18 at 16:00
















1















Plots rendered through svglite look differently when rendered through Travis, then when rendered locally.



This happens, because my local machine (macOS in this case) aliases different (more standard?) fonts for the default R plots



gdtools::match_family("Arial")
## [1] "Arial"
gdtools::match_family("sans")
## [1] "Bitstream Vera Sans"


... than travis ci:



gdtools::match_family("Arial")
## [1] "Liberation Sans"
gdtools::match_family("sans")
## [1] "DejaVu Sans"


"Liberation Sans", in turn, is not necessarily available on all computers viewing the svg (it wasn't on mine, until I ran brew cask install font-liberation-sans).



So, while the locally-generated SVGs have pretty decent portability (~"Arial"), the TravisCI-generated (~"Liberation Sans") do not.



I'd like rock-solid portability that works on every computer with a reasonable current browser.
I understand from svglite fonts vignette that I should probably use User font aliases to accomplish this, but I have not managed to get it to work, and am pretty confused about the whole font businesses.



I just want SVGs from svglite that look the same everywhere.



Here's the boilerplate index.Rmd that creates the different plots.



---
title: "index"
author: "foo"
date: "11/2/2018"
output:
rmarkdown::html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

# `png` Device

```{r png, echo=FALSE, dev = 'png'}
plot(pressure)
```


# `svg` Device

```{r svg, echo=FALSE, dev = 'svg'}
plot(pressure)
```


# `svglite` Device

```{r svglite, echo=FALSE, dev = 'svglite'}
plot(pressure)
```


(The entire repo and travis builds is here, finished website is at http://datascience.phil.fau.de/rmdbpl/).



When rendered locally (macOS) all three plots look roughly the same:



rendered locally



When build on Travis CI, the plot rendered through svglite, viewed on a machine without "Liberation Sans" will substitute a serif fonts, which looks bad.



travis










share|improve this question

























  • if anyone has enough points to add an svglite tag to this question, that'd be great.

    – maxheld
    Nov 25 '18 at 13:59






  • 1





    Max of 5 tags regardless of rep

    – hrbrmstr
    Nov 25 '18 at 14:09






  • 1





    Have you tried adding gdtools::match_family("Arial") to an R code block in the Rmd and seeing what it says? Also, have you tried installing any OS font packages (Travis-CI base builds are pretty bare-bones)

    – hrbrmstr
    Nov 25 '18 at 14:21













  • @hrbrmstr ah, yes of course – I cut it down to 4 tags, one available for svglite now.

    – maxheld
    Nov 25 '18 at 15:39






  • 1





    Ah, so I'm wondering, now, if you're viewing the svglite-generated document on a system without Liberation Sans. What happens if you install fontsquirrel.com/fonts/liberation-sans on the OS you're viewing the generated HTML document from?

    – hrbrmstr
    Nov 25 '18 at 16:00














1












1








1








Plots rendered through svglite look differently when rendered through Travis, then when rendered locally.



This happens, because my local machine (macOS in this case) aliases different (more standard?) fonts for the default R plots



gdtools::match_family("Arial")
## [1] "Arial"
gdtools::match_family("sans")
## [1] "Bitstream Vera Sans"


... than travis ci:



gdtools::match_family("Arial")
## [1] "Liberation Sans"
gdtools::match_family("sans")
## [1] "DejaVu Sans"


"Liberation Sans", in turn, is not necessarily available on all computers viewing the svg (it wasn't on mine, until I ran brew cask install font-liberation-sans).



So, while the locally-generated SVGs have pretty decent portability (~"Arial"), the TravisCI-generated (~"Liberation Sans") do not.



I'd like rock-solid portability that works on every computer with a reasonable current browser.
I understand from svglite fonts vignette that I should probably use User font aliases to accomplish this, but I have not managed to get it to work, and am pretty confused about the whole font businesses.



I just want SVGs from svglite that look the same everywhere.



Here's the boilerplate index.Rmd that creates the different plots.



---
title: "index"
author: "foo"
date: "11/2/2018"
output:
rmarkdown::html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

# `png` Device

```{r png, echo=FALSE, dev = 'png'}
plot(pressure)
```


# `svg` Device

```{r svg, echo=FALSE, dev = 'svg'}
plot(pressure)
```


# `svglite` Device

```{r svglite, echo=FALSE, dev = 'svglite'}
plot(pressure)
```


(The entire repo and travis builds is here, finished website is at http://datascience.phil.fau.de/rmdbpl/).



When rendered locally (macOS) all three plots look roughly the same:



rendered locally



When build on Travis CI, the plot rendered through svglite, viewed on a machine without "Liberation Sans" will substitute a serif fonts, which looks bad.



travis










share|improve this question
















Plots rendered through svglite look differently when rendered through Travis, then when rendered locally.



This happens, because my local machine (macOS in this case) aliases different (more standard?) fonts for the default R plots



gdtools::match_family("Arial")
## [1] "Arial"
gdtools::match_family("sans")
## [1] "Bitstream Vera Sans"


... than travis ci:



gdtools::match_family("Arial")
## [1] "Liberation Sans"
gdtools::match_family("sans")
## [1] "DejaVu Sans"


"Liberation Sans", in turn, is not necessarily available on all computers viewing the svg (it wasn't on mine, until I ran brew cask install font-liberation-sans).



So, while the locally-generated SVGs have pretty decent portability (~"Arial"), the TravisCI-generated (~"Liberation Sans") do not.



I'd like rock-solid portability that works on every computer with a reasonable current browser.
I understand from svglite fonts vignette that I should probably use User font aliases to accomplish this, but I have not managed to get it to work, and am pretty confused about the whole font businesses.



I just want SVGs from svglite that look the same everywhere.



Here's the boilerplate index.Rmd that creates the different plots.



---
title: "index"
author: "foo"
date: "11/2/2018"
output:
rmarkdown::html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

# `png` Device

```{r png, echo=FALSE, dev = 'png'}
plot(pressure)
```


# `svg` Device

```{r svg, echo=FALSE, dev = 'svg'}
plot(pressure)
```


# `svglite` Device

```{r svglite, echo=FALSE, dev = 'svglite'}
plot(pressure)
```


(The entire repo and travis builds is here, finished website is at http://datascience.phil.fau.de/rmdbpl/).



When rendered locally (macOS) all three plots look roughly the same:



rendered locally



When build on Travis CI, the plot rendered through svglite, viewed on a machine without "Liberation Sans" will substitute a serif fonts, which looks bad.



travis







r fonts r-markdown travis-ci svglite






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 19:03









hrbrmstr

61.6k691153




61.6k691153










asked Nov 25 '18 at 13:59









maxheldmaxheld

1,2981332




1,2981332













  • if anyone has enough points to add an svglite tag to this question, that'd be great.

    – maxheld
    Nov 25 '18 at 13:59






  • 1





    Max of 5 tags regardless of rep

    – hrbrmstr
    Nov 25 '18 at 14:09






  • 1





    Have you tried adding gdtools::match_family("Arial") to an R code block in the Rmd and seeing what it says? Also, have you tried installing any OS font packages (Travis-CI base builds are pretty bare-bones)

    – hrbrmstr
    Nov 25 '18 at 14:21













  • @hrbrmstr ah, yes of course – I cut it down to 4 tags, one available for svglite now.

    – maxheld
    Nov 25 '18 at 15:39






  • 1





    Ah, so I'm wondering, now, if you're viewing the svglite-generated document on a system without Liberation Sans. What happens if you install fontsquirrel.com/fonts/liberation-sans on the OS you're viewing the generated HTML document from?

    – hrbrmstr
    Nov 25 '18 at 16:00



















  • if anyone has enough points to add an svglite tag to this question, that'd be great.

    – maxheld
    Nov 25 '18 at 13:59






  • 1





    Max of 5 tags regardless of rep

    – hrbrmstr
    Nov 25 '18 at 14:09






  • 1





    Have you tried adding gdtools::match_family("Arial") to an R code block in the Rmd and seeing what it says? Also, have you tried installing any OS font packages (Travis-CI base builds are pretty bare-bones)

    – hrbrmstr
    Nov 25 '18 at 14:21













  • @hrbrmstr ah, yes of course – I cut it down to 4 tags, one available for svglite now.

    – maxheld
    Nov 25 '18 at 15:39






  • 1





    Ah, so I'm wondering, now, if you're viewing the svglite-generated document on a system without Liberation Sans. What happens if you install fontsquirrel.com/fonts/liberation-sans on the OS you're viewing the generated HTML document from?

    – hrbrmstr
    Nov 25 '18 at 16:00

















if anyone has enough points to add an svglite tag to this question, that'd be great.

– maxheld
Nov 25 '18 at 13:59





if anyone has enough points to add an svglite tag to this question, that'd be great.

– maxheld
Nov 25 '18 at 13:59




1




1





Max of 5 tags regardless of rep

– hrbrmstr
Nov 25 '18 at 14:09





Max of 5 tags regardless of rep

– hrbrmstr
Nov 25 '18 at 14:09




1




1





Have you tried adding gdtools::match_family("Arial") to an R code block in the Rmd and seeing what it says? Also, have you tried installing any OS font packages (Travis-CI base builds are pretty bare-bones)

– hrbrmstr
Nov 25 '18 at 14:21







Have you tried adding gdtools::match_family("Arial") to an R code block in the Rmd and seeing what it says? Also, have you tried installing any OS font packages (Travis-CI base builds are pretty bare-bones)

– hrbrmstr
Nov 25 '18 at 14:21















@hrbrmstr ah, yes of course – I cut it down to 4 tags, one available for svglite now.

– maxheld
Nov 25 '18 at 15:39





@hrbrmstr ah, yes of course – I cut it down to 4 tags, one available for svglite now.

– maxheld
Nov 25 '18 at 15:39




1




1





Ah, so I'm wondering, now, if you're viewing the svglite-generated document on a system without Liberation Sans. What happens if you install fontsquirrel.com/fonts/liberation-sans on the OS you're viewing the generated HTML document from?

– hrbrmstr
Nov 25 '18 at 16:00





Ah, so I'm wondering, now, if you're viewing the svglite-generated document on a system without Liberation Sans. What happens if you install fontsquirrel.com/fonts/liberation-sans on the OS you're viewing the generated HTML document from?

– hrbrmstr
Nov 25 '18 at 16:00












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53468230%2fhow-can-i-make-svglite-render-portable-svgs-on-travis-ci%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53468230%2fhow-can-i-make-svglite-render-portable-svgs-on-travis-ci%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Create new schema in PostgreSQL using DBeaver

Deepest pit of an array with Javascript: test on Codility

Costa Masnaga