This repository has been archived by the owner on Jun 25, 2020. It is now read-only.
allow font cleaning and remapping for SVG output #79
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello. We are using saveSvgAsPng to make charts and export them as SVG, so that they can be hand-edited in Illustrator. There is a terrible issue with some versions of Illustrator where it gives a cryptic error if you have a font declaration with either 1) more than one font or 2) a font that is not on your system or named incorrectly.
This change adds two options to the library:
cleanFontDefs
, a boolean that iftrue
will extract only the first font-family definitionfontFamilyRemap
, an optional hash that remaps the font-family name of the extracted first definition.I have added an example to index.html that downloads an SVG declared as Georgia, but when you open in illustrator, it is set to Arial. The use case for this is when CSS fonts are declared using CSS conventions like
Khula-Light
while local fonts may show up asKhula Light
, or when you can't assume people will have a custom font installed locally so you may want to remap it toArial
or something.Let me know what you think, if you're good with this I can add docs on these options. Thanks