question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Font issue from v1 to v2

See original GitHub issue

I switched from generator v1 to v2 and now i get the following error:

My code:

const font = require('assets/72-Regular.woff').default;
const fontBold = require('assets/72-Bold-full.woff').default;
const fontItalic = require('assets/72-Italic.ttf').default;

Font.register({
    family: '72',
    fonts: [
      { src: font, fontStyle: 'normal', fontWeight: 400 },
      { src: fontBold, fontStyle: 'normal', fontWeight: 'bold' },
      { src: fontItalic, fontStyle: 'italic', fontWeight: 'normal' },
    ],
  });

The error:

Uncaught (in promise) Error: Could not resolve font for 72, fontWeight 400
    at Font.resolve (font.js:112)
    at FontStore.getFont (index.js:48)
    at _callee$ (index.js:57)
    at tryCatch (runtime.js:63)
    at Generator.invoke [as _invoke] (runtime.js:293)
    at Generator.next (runtime.js:118)
    at asyncGeneratorStep (asyncToGenerator.js:3)
    at _next (asyncToGenerator.js:25)
    at asyncToGenerator.js:32
    at new Promise (<anonymous>)
    at FontStore.<anonymous> (asyncToGenerator.js:21)
    at FontStore.load (index.js:51)
    at fetchAssets (resolveAssets.js:47)
    at _callee$ (resolveAssets.js:84)
    at tryCatch (runtime.js:63)
    at Generator.invoke [as _invoke] (runtime.js:293)
    at Generator.next (runtime.js:118)
    at asyncGeneratorStep (asyncToGenerator.js:3)
    at _next (asyncToGenerator.js:25)
    at asyncToGenerator.js:32
    at new Promise (<anonymous>)
    at asyncToGenerator.js:21
    at resolveAssets (resolveAssets.js:100)
    at _callee$ (asyncCompose.js:60)
    at tryCatch (runtime.js:63)
    at Generator.invoke [as _invoke] (runtime.js:293)
    at Generator.next (runtime.js:118)
    at asyncGeneratorStep (asyncToGenerator.js:3)
    at _next (asyncToGenerator.js:25)

Does someone know why i have this error? I switched from Version 1.6.14 to version 2.0.4

Thanks for the help

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gabrielvincentcommented, Apr 20, 2021

Oh, I see. My bad, I misinterpreted the issue here and thought we had this transformation missing in react-pdf/font implementation. I’ll take a look at that more deeply and see what I can find out about this unexpected error.

0reactions
n370commented, Apr 28, 2021

I’m having this same issue and after looking around I found that the issue must be somewhere around https://github.com/diegomura/react-pdf/blob/c61acc69eb9ab433bdede2b7b1c7b070101ccab2/packages/font/src/font.js#L86-L117

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot transfer Fonts from V1 to V2? Must find again to install?!
But there is no way to transfer the multiple Fonts saved in V1 to V2. This wouldn't be a problem if we were...
Read more >
Moving from Google Fonts v1 to v2 - Stack Overflow
I'm trying to update code from google fonts V1 to V2: https://developers.google.com/fonts/docs/css2 most of the implementation has been done ...
Read more >
Hinted size of Roboto has decreased between v1 and v2 #68
It's a bug on the side of a font user/a downstream program to rely on the stable glyph order. The following two issues...
Read more >
Font Problem with DECwindows-MOTIF V1.2-4 (and up) and ...
Since MOZILLA requires DECwindows-MOTIF V1.2-5, I began to test, to upgrade my DECwindows-MOTIF V1.2-3 (ECO 8) to V1.2-5 (ECO 1 + Euro Patch)....
Read more >
[GTA Trilogy] Font Fix V1.1 - Old Fonts Restored - Reddit
[GTA Trilogy] Font Fix V1.1 - Old Fonts Restored. r/GTATrilogyMods - San Andreas menu now uses the Bank Gothic Medium font like the....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found