Skip to content

Commit

Permalink
add note on building from source
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Oct 23, 2024
1 parent 33b0cf8 commit bac2af8
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 4 deletions.
19 changes: 19 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,25 @@ One of the main reasons for the size difference between the size of the output o

svglite uses systemfonts for font discovery which means that all installed fonts on your system is available to use. The systemfonts foundation means that fonts registered with `register_font()` or `register_variant()` will also be available. If any of these contains non-standard weights or OpenType features (e.g. ligatures or tabular numerics) this will be correctly encoded in the style block. systemfonts also allows you to embed webfont `@imports` in your file to ensure that the file looks as expected even on systems without the used font installed.

## Building svglite

_This section is only relevant for building svglite from scratch, as opposed to installing from a pre-built package on CRAN._

Building vdiffr requires the system dependency libpng. As vdiffr doesn't have any build-time configuration, your R configuration must point to libpng's `include` and `lib` folders.

For instance on macOS, install libpng with:

```sh
brew install libpng
```

And make sure your `~/.R/Makevars` knows about Homebrew's `include` and `lib` folders where libpng should now be installed. On arm64 hardware, this would be:

```mk
CPPFLAGS += -I/opt/homebrew/include
LDFLAGS += -L/opt/homebrew/lib
```

## Code of Conduct

Please note that the svglite project is released with a [Contributor Code of Conduct](https://svglite.r-lib.org/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ bench::mark(svglite_test(), svg_test(), min_iterations = 250, check = FALSE)
#> # A tibble: 2 × 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 svglite_test() 2.08ms 2.23ms 438. 691KB 7.13
#> 2 svg_test() 6.07ms 6.26ms 159. 179KB 0.638
#> 1 svglite_test() 1.47ms 1.53ms 648. 587KB 6.15
#> 2 svg_test() 6.19ms 6.42ms 155. 192KB 0.623
```

### File size
Expand All @@ -78,7 +78,7 @@ fs::file_size(tmp1)

# svg
fs::file_size(tmp2)
#> 321K
#> 327K
```

In both cases, compressing to make `.svgz` (gzipped svg) is worthwhile.
Expand All @@ -93,7 +93,7 @@ invisible(dev.off())

# svglite - svgz
fs::file_size(tmp3)
#> 9.42K
#> 9.45K
```

### Editability
Expand All @@ -120,6 +120,30 @@ also allows you to embed webfont `@imports` in your file to ensure that
the file looks as expected even on systems without the used font
installed.

## Building svglite

*This section is only relevant for building svglite from scratch, as
opposed to installing from a pre-built package on CRAN.*

Building vdiffr requires the system dependency libpng. As vdiffr doesn’t
have any build-time configuration, your R configuration must point to
libpng’s `include` and `lib` folders.

For instance on macOS, install libpng with:

``` sh
brew install libpng
```

And make sure your `~/.R/Makevars` knows about Homebrew’s `include` and
`lib` folders where libpng should now be installed. On arm64 hardware,
this would be:

``` mk
CPPFLAGS += -I/opt/homebrew/include
LDFLAGS += -L/opt/homebrew/lib
```

## Code of Conduct

Please note that the svglite project is released with a [Contributor
Expand Down

0 comments on commit bac2af8

Please sign in to comment.