Use font inlining method from scratch svg render (#427)

This commit is contained in:
DD Liu 2018-05-10 13:46:23 -04:00 committed by GitHub
parent fd6268c940
commit 830dd3c9ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -78,6 +78,7 @@
"regenerator-runtime": "^0.11.1",
"rimraf": "^2.6.1",
"scratch-l10n": "^2.0.0",
"scratch-svg-renderer": "0.1.0-prerelease.20180510171850",
"style-loader": "^0.21.0",
"svg-url-loader": "^2.3.2",
"tap": "^11.1.0",

View file

@ -7,6 +7,8 @@ import Formats from '../lib/format';
import Modes from '../lib/modes';
import log from '../log/log';
import {inlineSvgFonts} from 'scratch-svg-renderer';
import {trim} from '../helper/bitmap';
import {performSnapshot} from '../helper/undo';
import {undoSnapshot, clearUndoState} from '../reducers/undo';
@ -95,6 +97,7 @@ class PaperCanvas extends React.Component {
// Get rid of anti-aliasing
// @todo get crisp text?
svg.setAttribute('shape-rendering', 'crispEdges');
inlineSvgFonts(svg);
const svgString = (new XMLSerializer()).serializeToString(svg);
// Put anti-aliased SVG into image, and dump image back into canvas