wojtekmaj / react-pdf

Display PDFs in your React app as easily as if they were images.

Home Page:https://projects.wojtekmaj.pl/react-pdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Out-of-the-box fonts not rendering correctly

iSilkline opened this issue · comments

Before you start - checklist

  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported
  • I have checked if an issue is not listed in Known issues
  • If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

I've been using the built-in the Helvetica and Helvetica-Bold out-of-the-box font families for some time and everything worked great.

I recently updated my react-pdf package and it seems that support for out-of-the-box fonts is broken. I first noticed because bold text (Helvetica-Bold) is rendering as normal weight. I went to test Courier and Courier-Bold and they both rendered as Helvetica. I then tried Times-Roman and Times-Bold... everything is still rendering as normal Helvetica.

Steps to reproduce

Create pdf with any of the out-of-the-box font families.

Expected behavior

Using fontFamily "Helvetica" should render as Helvetica with normal font weight. Using fontFamily "Helvetica-Bold" should render as Helvetica with bold (700) font weight.

Actual behavior

Everything renders as Helvetica with normal font weight.

Additional information

No response

Environment

  • Chrome: 124.0.6367.119
    ├─ @react-pdf/fns@2.2.1
    ├─ @react-pdf/font@2.5.1
    ├─ @react-pdf/image@2.3.6
    ├─ @react-pdf/layout@3.12.1
    ├─ @react-pdf/pdfkit@3.1.10
    ├─ @react-pdf/png-js@2.3.1
    ├─ @react-pdf/primitives@3.1.1
    ├─ @react-pdf/render@3.4.4
    ├─ @react-pdf/renderer@3.4.4
    ├─ @react-pdf/stylesheet@4.2.5
    ├─ @react-pdf/textkit@4.4.1
    └─ @react-pdf/types@2.5.0