Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested text styling does not work on Windows #2725

Open
RKukharchuk opened this issue Apr 24, 2024 · 3 comments
Open

Nested text styling does not work on Windows #2725

RKukharchuk opened this issue Apr 24, 2024 · 3 comments

Comments

@RKukharchuk
Copy link

Describe the bug

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

Rendering this document with Roboto is messing up the formatting of next next blocks:

 <Document>
      <Page size="LETTER" wrap>
        <Text>
          <Text style={{ fontFamily: "Roboto", fontWeight: 'bold' }}>
            Should be bold
          </Text>
          <Text> Shouldn't be bold</Text>
        </Text>
      </Page>
    </Document>

Produces the following result
image

Making the second part bold is doing nothing:

 <Document>
      <Page size="LETTER" wrap>
        <Text>
          <Text>
            Shouldn't be bold
          </Text>
          <Text style={{ fontFamily: "Roboto", fontWeight: 'bold' }}> Should be bold</Text>
        </Text>
      </Page>
    </Document>

Produces the following result:
image

Expected behavior
Text formatted according to the fontWeight.

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome
  • React-pdf version 3.4.3

PS: It works perfectly on MacOS

@RKukharchuk
Copy link
Author

After future inverstigations it looks like it's related to fonts resolution of text.
Downgrading @react-pdf/layout to 3.11.5 helps to resolve the issue

@Fry98
Copy link

Fry98 commented May 1, 2024

@RKukharchuk Are you on Intel or Apple Silicon Mac? I'm on Macbook Air M3 and have still encountered this issue.

@focux
Copy link

focux commented May 9, 2024

I'm on Apple Silicon and I'm also having this issue, downgrading @react-pdf/layout made it work for me.

If anyone is wondering about how to do it, this how you do it with PNPM, update your package.json to resolve the layout version that we want:

"pnpm": {
    "overrides": {
      "@react-pdf/layout": "3.11.5"
    }
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants