fix font loading

@companje
This commit is contained in:
Casper Lamboo 2018-04-23 10:55:11 +02:00
parent 0be1ee6d51
commit 0957d53b41
4 changed files with 36 additions and 6 deletions

22
package-lock.json generated
View File

@ -33,7 +33,7 @@
} }
}, },
"@doodle3d/doodle3d-core": { "@doodle3d/doodle3d-core": {
"version": "github:doodle3d/doodle3d-core#b9ed59c8d936a205ac3660fe6f23af66228d92bb", "version": "github:doodle3d/doodle3d-core#0a3686d8df05e275805ebb8029528a45d7f31f39",
"requires": { "requires": {
"@doodle3d/cal": "0.0.8", "@doodle3d/cal": "0.0.8",
"@doodle3d/clipper-js": "1.0.10", "@doodle3d/clipper-js": "1.0.10",
@ -47,6 +47,7 @@
"blueimp-canvas-to-blob": "3.14.0", "blueimp-canvas-to-blob": "3.14.0",
"bowser": "1.8.1", "bowser": "1.8.1",
"fit-curve": "0.1.6", "fit-curve": "0.1.6",
"font-loaded": "1.0.0",
"google-fonts-webpack-plugin": "0.4.4", "google-fonts-webpack-plugin": "0.4.4",
"imports-loader": "0.7.1", "imports-loader": "0.7.1",
"jss": "9.8.1", "jss": "9.8.1",
@ -3693,8 +3694,7 @@
"events": { "events": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz",
"integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ="
"dev": true
}, },
"eventsource": { "eventsource": {
"version": "0.1.6", "version": "0.1.6",
@ -4199,6 +4199,17 @@
} }
} }
}, },
"font-loaded": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/font-loaded/-/font-loaded-1.0.0.tgz",
"integrity": "sha512-/qicwhzOAnob/EOguqhk12ccQL50BIkU+j+5mjauQCWKLek4WVag6TmsDGL9bZtgJRlOeLXb5Ul1wSgO/003EA==",
"requires": {
"events": "1.1.1",
"inherits": "2.0.3",
"lodash": "4.17.4",
"timeout-raf": "1.1.4"
}
},
"for-in": { "for-in": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
@ -11073,6 +11084,11 @@
"integrity": "sha1-lYYL/MXHbCd/j4Mm/Q9bLiDrohc=", "integrity": "sha1-lYYL/MXHbCd/j4Mm/Q9bLiDrohc=",
"dev": true "dev": true
}, },
"timeout-raf": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/timeout-raf/-/timeout-raf-1.1.4.tgz",
"integrity": "sha512-RRVaW01Dj9tiTiq2eyg5FW22qc+ZzCHKUpr8Q5OB6+eVv9bCrmpk8oc5Cx/qiKqecQ7sjNJ85HDqMjdZLroqmg=="
},
"timers-browserify": { "timers-browserify": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.4.tgz", "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.4.tgz",

View File

@ -21,7 +21,7 @@
"dependencies": { "dependencies": {
"@doodle3d/clipper-js": "^1.0.10", "@doodle3d/clipper-js": "^1.0.10",
"@doodle3d/doodle3d-api": "^1.0.5", "@doodle3d/doodle3d-api": "^1.0.5",
"@doodle3d/doodle3d-core": "github:doodle3d/doodle3d-core#0.18.0", "@doodle3d/doodle3d-core": "github:doodle3d/doodle3d-core",
"babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-class-properties": "^6.24.1",
"file-saver": "^1.3.3", "file-saver": "^1.3.3",
"lodash": "^4.17.4", "lodash": "^4.17.4",
@ -57,6 +57,7 @@
"eslint-config-airbnb": "^3.1.0", "eslint-config-airbnb": "^3.1.0",
"eslint-plugin-react": "^3.16.1", "eslint-plugin-react": "^3.16.1",
"file-loader": "^1.1.11", "file-loader": "^1.1.11",
"google-fonts-webpack-plugin": "^0.4.4",
"html-webpack-plugin": "^2.29.0", "html-webpack-plugin": "^2.29.0",
"html-webpack-template": "^6.0.2", "html-webpack-template": "^6.0.2",
"image-webpack-loader": "^4.2.0", "image-webpack-loader": "^4.2.0",

View File

@ -160,8 +160,8 @@ class Interface extends React.Component {
fetch(`${origin}${port}${pathname}`, { headers }) fetch(`${origin}${port}${pathname}`, { headers })
.then(resonse => resonse.json()) .then(resonse => resonse.json())
.then(json => JSONToSketchData(json)) .then(JSONToSketchData)
.then(file => createSceneData(file)) .then(createSceneData)
.then(sketch => generateExportMesh(sketch, { offsetSingleWalls: false, matrix: new THREE.Matrix4() })) .then(sketch => generateExportMesh(sketch, { offsetSingleWalls: false, matrix: new THREE.Matrix4() }))
.then(mesh => this.updateMesh(mesh)); .then(mesh => this.updateMesh(mesh));
}; };

View File

@ -1,6 +1,7 @@
const path = require('path'); const path = require('path');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const HTMLWebpackPlugin = require('html-webpack-plugin'); const HTMLWebpackPlugin = require('html-webpack-plugin');
const GoogleFontsPlugin = require('google-fonts-webpack-plugin');
const devMode = process.env.NODE_ENV !== 'production'; const devMode = process.env.NODE_ENV !== 'production';
const analyzeBundle = process.env.ANALYZE_BUNDLE; const analyzeBundle = process.env.ANALYZE_BUNDLE;
@ -87,6 +88,18 @@ module.exports = {
template: require('html-webpack-template'), template: require('html-webpack-template'),
inject: false, inject: false,
appMountId: 'app' appMountId: 'app'
}),
new GoogleFontsPlugin({
fonts: [
{ family: 'Oswald' },
{ family: 'Ranga' },
{ family: 'Joti One' },
{ family: 'Bellefair' },
{ family: 'Lobster' },
{ family: 'Abril Fatface' },
{ family: 'Play' },
{ family: 'Fascinate' }
]
}) })
], ],
devtool: devMode ? 'source-map' : false, devtool: devMode ? 'source-map' : false,