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

Non Latin Hindi Unicode Characters Not Rendering #856

Closed
DeepakKapiswe opened this issue Mar 23, 2020 · 3 comments · Fixed by #2600
Closed

Non Latin Hindi Unicode Characters Not Rendering #856

DeepakKapiswe opened this issue Mar 23, 2020 · 3 comments · Fixed by #2600

Comments

@DeepakKapiswe
Copy link

Non Latin Characters specifically Hindi Characters are not getting rendered properly, some characters even words change to blank while rendering.

My sample code:

import React from "react";
import notoSansHindi from '../../assets/fonts/NotoSansDevanagari-Regular.ttf' 
import {
    Page,
    Text,
    View,
    Document,
    StyleSheet,
    Font
} from "@react-pdf/renderer";

const BORDER_COLOR = '#bfbfbf'
const BORDER_STYLE = 'solid'
const COLN_WIDTH = 100 / 3
const FONT_FAMILY = 'Noto Sans Hindi'

Font.register({
    src: notoSansHindi,
    family: FONT_FAMILY
    }
  );

Font.registerHyphenationCallback(word => [word]);

const styles = StyleSheet.create({
    body: {
        padding: 8,
    },
    table: {
        display: "table",
        width: "auto",
        borderStyle: BORDER_STYLE,
        borderColor: BORDER_COLOR,
    },
    heading: {
        textAlign: 'center',
        fontFamily: FONT_FAMILY,
    },
});

export default function PdfSubscriberList() {
    return (
        <Document>
            <Page size="A4" style={styles.body}>
                <View style={styles.table}>
                    <Text style={styles.heading} >
                    श्री माधव त्रिपाठी शर्मा
                    </Text>
                </View>
            </Page>
        </Document>
    );
}

which results in :

श्री माधव त्रिपाठी

Expected behavior
श्री माधव त्रिपाठी शर्मा

This is just one sample, I have I can see many bugs rendering with half words, character missing etc.

Please help ! Tried almost everything but not working. I hope someone else must have fixed this library to use with Hindi fonts.

Desktop

  • OS: MacOS
  • Browser [chrome, safari]
  • React-pdf version v1.6.8
@chimanSeyedhashemi
Copy link

i have this problem with persian font. please fix these bug i need it

@DeepakKapiswe
Copy link
Author

I switched to pdf-make and that library is awesome @chimanSeyedhashemi

@diegomura diegomura added the bug label Apr 25, 2021
@diegomura diegomura added the rtl label Aug 2, 2021
This was referenced May 28, 2022
@darrynten
Copy link

Same issue with Vietnamese characters

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

Successfully merging a pull request may close this issue.

4 participants