React-pdf: fontWeight doesn't work

Created on 18 Dec 2019  路  3Comments  路  Source: diegomura/react-pdf

Describe the bug
I tried to change the text style of a component with CSS property _fontWeight_.
Nothing has changed.
Use https://react-pdf.org/repl?example=font-register to check the accuracy, but repl won't launch.

To Reproduce
Steps to reproduce the behavior including code snippet (if applies):

  1. Go to https://react-pdf.org/repl?example=font-register
  2. See error

Expected behavior
Expected to see how font become bold

Desktop (please complete the following information):

  • OS: Ubuntu 19.04
  • Browser: Firefox 71.0
  • React-pdf version: 1.6.8

Most helpful comment

@yellowBanano _fontWeight_ won't apply if you didn't register proper font.
Code below did the work:

Font.register({
family: 'Open Sans',
fonts: [
{ src: 'https://cdn.jsdelivr.net/npm/[email protected]/fonts/open-sans-regular.ttf' },
{ src: 'https://cdn.jsdelivr.net/npm/[email protected]/fonts/open-sans-600.ttf', fontWeight: 600 }
]
});

All 3 comments

@yellowBanano _fontWeight_ won't apply if you didn't register proper font.
Code below did the work:

Font.register({
family: 'Open Sans',
fonts: [
{ src: 'https://cdn.jsdelivr.net/npm/[email protected]/fonts/open-sans-regular.ttf' },
{ src: 'https://cdn.jsdelivr.net/npm/[email protected]/fonts/open-sans-600.ttf', fontWeight: 600 }
]
});

+1

+1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

emt1803 picture emt1803  路  3Comments

dvenkatsagar picture dvenkatsagar  路  3Comments

kishaningithub picture kishaningithub  路  4Comments

mdodge-ecgrow picture mdodge-ecgrow  路  3Comments

jbrat picture jbrat  路  3Comments