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

Inline text Bold not working #2855

Open
fuboki10 opened this issue Aug 30, 2024 · 7 comments
Open

Inline text Bold not working #2855

fuboki10 opened this issue Aug 30, 2024 · 7 comments

Comments

@fuboki10
Copy link

fuboki10 commented Aug 30, 2024

Describe the bug
When I write a text with an inline bold text all the text is only bold or normal based on the first text of the line

I tried to do the same thing here https://react-pdf.org/repl?code=3187b0760ce02e004d09e01b02984605e18194a4e5600b6592803a6002764043299002806f00a0618023100137802e1859b0090016da8500e6012cc3f00ac001800d2b18017c55b0252241443a0947e82d876ac0035848a2002b982e01844221015f80722820c778f9bd598d4012801b99823412160b841803061e95400780044e36c4590c0a000f954d9920015a82590e0a400bd91d00088010400596bf34d0a00d4a59001dce17051d118105021493878d55adb0a005590003cf20ba7b064245061f4c1cae91661baa4a0086197a792e6f7866a87fb5149b575f574a12664b67617601ef40ce8b99200f4173c89c56a67a849a832180008510e60b0c181a7429033e53698a260e774562d80039541fc919f7da1c0878ec702fa784195d46df27a195e60778c1765f03132fe80e06e5416098343a89b7004894a2b038b25d2d714a2572d958a15ca994c044b644140a4005a364001dc4a50a351f514b06f3712b406747a18ec4024a6529a03d2c04cb649661088009468c028115520031521501cc80a3d162c06f5000
but with the fontWeight but it's not working

To Reproduce
https://react-pdf.org/repl?code=3187b0760ce02e004d09e01b02984605e18194a4e5600b6592803a6002764043299002806f00a0618023100137802e1859b0090016da8500e6012cc3f00ac001800d2b18017c55b0252241443a0947e82d8c0066e0a007564068cc00e49d117079bd73350128037337fa090b05c20c01830f4aa003c0022a100ae22c86050007caa6c51000ad412c87052005ec8e800440082002ca5e9a699006a52c800ee70b828e88c082810a49c3c6ab57599002ac8001e6919c3d832122830fa60f9749330cd52500430d3c351636bdd255deda8a4dabafaba5083324b2b13b0177a76c85c5100f407693b33a6e5126a0c86000214435180006b1837d76992fa3c86c3384c1f688945b00072a83a170618f75a6c0818d477cda784e91d7acf2ba196e607b8c1564f032d3719f6faa57e7f18303a88b700489402b010a4562c420b8592d174aa5e2b968a602278a20a052002d232000ee25c851a8dae25fc39e899a7d1a2d246a23e393c90d3e716022592535f3f8004a3460140b2310018a90a8602e32028f410b01dd400000

You can make use of react-pdf REPL to share the snippet

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
image

image

Desktop (please complete the following information):

  • OS: Linux fedora
  • Browser [e.g. chrome, safari]
  • React-pdf version v3.4.4
@fuboki10
Copy link
Author

I think it's the same as issue #2840

@raci-aivy
Copy link


Font.register({
  family: "ExtraLight",
  src: require("./assets/fonts/FiraSans-ExtraLight.ttf"),
});
Font.register({
  family: "Light",
  src: require("./assets/fonts/FiraSans-Light.ttf"),
});
Font.register({
  family: "Regular",
  src: require("./assets/fonts/FiraSans-Regular.ttf"),
});
Font.register({
  family: "Medium",
  src: require("./assets/fonts/FiraSans-Medium.ttf"),
});
Font.register({
  family: "SemiBold",
  src: require("./assets/fonts/FiraSans-SemiBold.ttf"),
});
Font.register({
  family: "Bold",
  src: require("./assets/fonts/FiraSans-Bold.ttf"),
});
 <View style={{ marginTop: 4 }}>
                    <Text style={{ fontFamily: "Regular" }}>
                     This text should be regular and followed by{" "}
                      <Text style={{ fontFamily: "Bold" }}>bold text</Text>
                    </Text>
                  </View>

Bildschirmfoto 2024-09-04 um 10 49 59

This is somehow not working properly. I remember that it had worked in earlier versions ...

Is there any quick fix I can follow??

@ezratweaver
Copy link

ezratweaver commented Sep 4, 2024

@raci-aivy I had a similar issue, its due to a bug in the latest version of @react-pdf/layout, adding this to my package.json, right under dependencies, resolved the issue for me.

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

@mcmontseny
Copy link

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

Thanks, this resolved my issue!

@raci-aivy
Copy link

@mcmontseny great! Do you have a working example snippet for that? I just tested it with the solution approach and it didn't work.

@Spasfonx
Copy link

Spasfonx commented Sep 9, 2024

@raci-aivy I had a similar issue, its due to a bug in the latest version of @react-pdf/layout, adding this to my package.json, right under dependencies, resolved the issue for me.

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

Worked for me, thanks ! 🚀 But I had to change overrides to resolutions, certainly because I'm using pnpm :

"resolutions": {
    "@react-pdf/layout": "3.11.5"
}

@raci-aivy
Copy link

@ezratweaver @Spasfonx
Thank you! Resolutions worked for me too.

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

5 participants