vagran / dxf-viewer-example-src

Source for dxf-viewer-example GitHub pages repository
MIT License
47 stars 27 forks source link

Unsupported OpenType signature #11

Closed cmastelaro closed 2 years ago

cmastelaro commented 2 years ago

The fonts used to worker loader work's nicely on dev mode, but when we make quasar build the fonts are not imported.

Getting error Unsupported OpenType signature

DxfViewerWorker.28d49fcb.worker.js:7 Error: Unsupported OpenType signature 404 
    at Object.Ha [as parse] (DxfViewerWorker.28d49fcb.worker.js:9:169116)
    at DxfViewerWorker.28d49fcb.worker.js:7:649524
    at Generator.next (<anonymous>)
    at r (DxfViewerWorker.28d49fcb.worker.js:16:21839)
    at o (DxfViewerWorker.28d49fcb.worker.js:16:22042)
(anonymous) @ DxfViewerWorker.28d49fcb.worker.js:7

i don't have any clue in what i'm doing wrong

PS: using quasar.conf.js

cmastelaro commented 2 years ago

After builds the code trying to load fonts from http://localhost:4000/js/fonts/Roboto-LightItalic.2eeb30eb.ttf

edson-gaspar commented 2 years ago

Same issue here, when i run quasar build, the compiler put font in /fonts folder and try to load on /js/fonts, something is wrong when translating url after build. Is it a webpack missing configuration inside a quasar.conf.js?

vagran commented 2 years ago

Probably the build command somehow differs. This example uses vue-cli-service build in its package.json. The result is in this repo: https://github.com/vagran/dxf-viewer-example It has fonts directory on top level.

edson-gaspar commented 2 years ago

Some weird things happening with quasar compilations. I fixed the problem by go out of from "import from" to const var like this:

const mainFont = '/fonts/Roboto-LightItalic.ttf'
const aux1Font = '/fonts/NotoSansDisplay-SemiCondensedLightItalic.ttf'
const aux2Font = '/fonts/HanaMinA.ttf'
const aux3Font = '/fonts/NanumGothic-Regular.ttf'

and moving font files from assets/fonts folder to public/fonts.

arlebedev commented 2 years ago

Should be related to webpack config. See here: https://chriscourses.com/blog/loading-fonts-webpack Probably, when building by vue-cli-service these rules already applied by default. Another way may be specifying file loader inline: https://webpack.js.org/concepts/loaders/#inline