Skip to content

Not Support Burmese Language in unicode #3455

Description

@thuzinhtet04

Describe the bug

Myanmar Unicode text is rendered incorrectly in @react-pdf/renderer even when using a proper Unicode font such as Pyidaungsu.ttf. The same text renders correctly in modern browsers (Chrome, Firefox) and when generating PDFs with Puppeteer.

Interestingly, when the text is encoded in Zawgyi, it renders correctly with the same font registration, while Unicode text does not. This suggests that complex text shaping for Myanmar Unicode may not be supported during PDF rendering.


To Reproduce

  1. Register a Myanmar Unicode font (e.g. Pyidaungsu.ttf).
  2. Render a <Text> component containing Myanmar Unicode text.
  3. Generate the PDF.
  4. Open the generated PDF.

Example:

import { Document, Page, Text, Font } from "@react-pdf/renderer";

Font.register({
  family: "Pyidaungsu",
  src: "/fonts/Pyidaungsu.ttf",
});

export default function MyDocument() {
  return (
    <Document>
      <Page>
        <Text style={{ fontFamily: "Pyidaungsu" }}>
        သီဟိုဠ်မှ ဉာဏ်ကြီးရှင်သည် အာယုဝဍ္ဎနဆေးညွှန်းစာကို ဇလွန်ဈေးဘေး
        </Text>
      </Page>
    </Document>
  );
}

The same text displays correctly in a browser using the same font but is rendered incorrectly in the generated PDF.


Expected behavior

Myanmar Unicode text should render correctly when using a Unicode-compliant font such as Pyidaungsu.ttf, just as it does in modern browsers and browser-based PDF generation tools.

Complex scripts such as Myanmar require proper OpenType shaping (glyph substitution and positioning). It appears that this shaping step is either missing or incomplete in the current text rendering pipeline.


Screenshots

  • Browser rendering (correct)
  • Generated PDF rendering (incorrect)
Image

Desktop

  • OS: macOS Tahoe 26.5.2
  • Browser: Chrome 150
  • @react-pdf/renderer version: (your version, e.g. 4.5.1)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions