Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move scratch render fonts to peer deps #237

Merged
merged 4 commits into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
"type": "git",
"url": "git+ssh://[email protected]/LLK/scratch-svg-renderer.git"
},
"peerDependencies": {
"scratch-render-fonts": "^1.0.0-prerelease"
},
"dependencies": {
"base64-js": "1.2.1",
"base64-loader": "1.0.0",
"dompurify": "2.1.1",
"minilog": "3.1.0",
"transformation-matrix": "1.15.0",
"scratch-render-fonts": "1.0.0-prerelease.20200507182347"
"transformation-matrix": "1.15.0"
},
"devDependencies": {
"babel-core": "6.26.0",
Expand All @@ -41,6 +43,7 @@
"lodash.defaultsdeep": "4.6.1",
"mkdirp": "^1.0.3",
"rimraf": "^3.0.1",
"scratch-render-fonts": "^1.0.0-prerelease",
"tap": "^11.0.1",
"webpack": "^4.8.0",
"webpack-cli": "^3.1.0",
Expand Down
3 changes: 2 additions & 1 deletion src/font-inliner.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @fileOverview Import bitmap data into Scratch 3.0, resizing image as necessary.
*/
const {FONTS} = require('scratch-render-fonts');
const getFonts = require('scratch-render-fonts');

/**
* Given SVG data, inline the fonts. This allows them to be rendered correctly when set
Expand All @@ -18,6 +18,7 @@ const {FONTS} = require('scratch-render-fonts');
* @return {string} The svg with any needed fonts inlined
*/
const inlineSvgFonts = function (svgString) {
const FONTS = getFonts();
// Make it clear that this function only operates on strings.
// If we don't explicitly throw this here, the function silently fails.
if (typeof svgString !== 'string') {
Expand Down