Fontweights style not working
import { PDFViewer, Document, Page, View, Text } from '@react-pdf/renderer';
function App() {
return (
<>
<PDFViewer>
<Document>
<Page size="A4" style={{}}>
<View style={{ fontWeight: 700 }}>
<Text>Section #1</Text>
</View>
<View style={{ fontWeight: 'normal' }}>
<Text>Section #2</Text>
</View>
</Page>
</Document>
</PDFViewer>
</>
);
}
export default App;
https://stackblitz.com/edit/vitejs-vite-389pzyqw
in production app im using
Font.register({
family: 'Proxima',
fonts: [
{ fontWeight: 'normal', src: '/fonts/ProximaNovaCondensed-Regular.ttf' },
{
fontWeight: 'bold',
src: '/fonts/ProximaNovaCondensed-Bold.ttf',
},
],
});
which either renders all fonts bold or none, depending on which style is first applied
opening a new issue, since all similar are closed. using this minimal example, i still dont get the fontweights applied.
I guess font weight is not supporting thats why you are getting this isuse. i am getting same issue so pls let me know if you have found any thing regarding this to fix this issue.
@santrajyadav196 according to the docs it should be supported https://react-pdf.org/repl?example=font-register but i could not resolve the issue so far
Could resolve the issue. The font was for web usage only, using a font that allows for Print/Desktop fixes the issue. Still not sure why the bug is also in the example I provided.
I am using fontStyle: "bold" | "normal", it works