-
Notifications
You must be signed in to change notification settings - Fork 574
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
Arabic: glyph spacing issue in PDFs #542
Comments
You expect me to click on a link that looks like this? No thank you.
|
That link is generated from this tool Which is based on this but with extra debugging tools. You can see how the links are generated since the code is opensource for both tools. If you don't trust react-pdf-repl.vercel.app and you want a reproducable code using the repl tool of react-pdf.org then here you go here (it also generates a long hash) If you're still scared of the link here's a screenshot: If you don't care about the code here's an annotated screenshot of the glyph issue visualized: |
If you want to reproduce the issue live Option 1go to https://react-pdf-repl.vercel.app/ and replace the default code with the one below import { Text, Page, View, Document, Font } from "@react-pdf/renderer";
Font.register({
family: "IBM Plex Sans Arabic",
src: "https://fonts.gstatic.com/s/ibmplexsansarabic/v12/Qw3NZRtWPQCuHme67tEYUIx3Kh0PHR9N6YPO_9CTVsVJKxTs.ttf",
});
export default () => (
<Document style={{ fontFamily: "IBM Plex Sans Arabic" }}>
<Page size="A6">
<View>
<Text style={{ fontSize: 28, marginTop: 5, color: "#1f2b39", letterSpacing: 0 }}>
قزيز
فريق
</Text>
// The following works fine
<Text style={{ fontSize: 28, marginTop: 5, color: "#1f2b39", letterSpacing: 0 }}>
فر
</Text>
// You can see a tiny space between ف and ر
<Text style={{ fontSize: 28, marginTop: 5, color: "#1f2b39", letterSpacing: 0 }}>
فري
</Text>
// The space gets bigger between ف and ر
<Text style={{ fontSize: 28, marginTop: 5, color: "#1f2b39", letterSpacing: 0 }}>
فريق
</Text>
// When I replace the ز or ر with a ڑ it works fine
<Text style={{ fontSize: 28, marginTop: 5, color: "#1f2b39", letterSpacing: 0 }}>
فڑيق
</Text>
</View>
</Page>
</Document>
); Option 2go to https://react-pdf.org/repl and replace the default code with the following: Font.register({
family: "IBM Plex Sans Arabic",
src: "https://fonts.gstatic.com/s/ibmplexsansarabic/v12/Qw3NZRtWPQCuHme67tEYUIx3Kh0PHR9N6YPO_9CTVsVJKxTs.ttf",
});
const TestComponent = () => (
<Document style={{ fontFamily: "IBM Plex Sans Arabic" }}>
<Page size="A6">
<View>
<Text style={{ fontSize: 28, marginTop: 5, color: "#1f2b39", letterSpacing: 0 }}>
قزيز
فريق
</Text>
// The following works fine
<Text style={{ fontSize: 28, marginTop: 5, color: "#1f2b39", letterSpacing: 0 }}>
فر
</Text>
// You can see a tiny space between ف and ر
<Text style={{ fontSize: 28, marginTop: 5, color: "#1f2b39", letterSpacing: 0 }}>
فري
</Text>
// The space gets bigger between ف and ر
<Text style={{ fontSize: 28, marginTop: 5, color: "#1f2b39", letterSpacing: 0 }}>
فريق
</Text>
// When I replace the ز or ر with a ڑ it works fine
<Text style={{ fontSize: 28, marginTop: 5, color: "#1f2b39", letterSpacing: 0 }}>
فڑيق
</Text>
</View>
</Page>
</Document>
);
ReactPDF.render(<TestComponent />); |
Finally I just verified that the issue is in fact not with IBM Plex Sans Arabic but actually in @react-pdf/renderer I used a different font "cairo" and the same spacing-between-glyphs issue happens I'm not sure if I should close this issue or if you want to keep it open for your comment here Thank you @BoldMonday |
File info is the correct way to check version number, and indeed these are v1.1 fonts. |
Let's keep the issue open until the missing kerning pair has been added. |
Hi 👋
I'm using IBM Plex Sans Arabic in @react-pdf/renderer and I noticed a spacing issue in the Arabic font, specifically in two glyphs:
He's a link to a reproduction of the issue
The text was updated successfully, but these errors were encountered: