Skip to content

Update the embedded svglite implementation - #106

Merged
lionel- merged 9 commits into
masterfrom
update-device
Jun 7, 2021
Merged

lionel- merged 9 commits into
masterfrom
update-device

Conversation

@thomasp85

Copy link
Copy Markdown
Member

This PR updates the embedded graphic device to be based off the latest svglite version. Major changes

  • Rcpp has been removed in favour of cpp11
  • gdtools, BH, freetypeharfbuzz etc is no longer needed
  • String dimension calculations are based on an inlined map of glyph dimensions extracted from Liberation and Symbola
  • Small tweak to the toggle UI to make sure sizing of old and new test cases are the same

There is practically no visual difference in the output, except for a point sizing bug that has been fixed and now show points and circles in the correct size (slightly smaller). The textual difference is of course stark

There are failing tests mainly because I don't know how to update the test setup

@thomasp85
thomasp85 requested a review from lionel- May 25, 2021 08:48
@thomasp85

Copy link
Copy Markdown
Member Author

The engine version are now written into the svgfile as a top level data attribute. It is accessible in javascript directly through the dataset map of the svg element, e.g. SVGElement.dataset.engineVersion

Comment thread inst/create_glyph_dims.R
@@ -0,0 +1,73 @@
# This code creates "src/glyph_dims.h" which inlines the glyph dimensions of

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

Comment thread src/devSVG.cpp
Comment on lines +380 to +382
if (match == LIBERATION_DIM.end()) {
match = LIBERATION_DIM.find(1);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC this is the fallback case? If we can't find dimensions for a given character we use the dimensions of the first character in the hardcoded table?

Should we consider making it an error? I don't have a strong opinion on this.

@lionel-
lionel- merged commit 4dc1a53 into master Jun 7, 2021
@lionel-

lionel- commented Jun 7, 2021

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants