Skip to content

Rendering Issue for Khmer Text (and other complex script) Due to Possible Issue in Java #531

@mlooby

Description

@mlooby

While troubleshooting an issue with rendering Khmer text in PDFs generated by JasperReports it's been discovered even with properly embedded fonts like NotoSansKhmer or Hanuman, the output doesn't render correctly — vowel signs and glyphs are mispositioned or broken.

Here is some test text:

តើមានអ្វីកើតឡើងនៅពេលបន្ទាប់នេះបន្ទាប់ពីអ្នកធ្វើការប្ដឹងឧទ្ធរណ៍ យើងនឹងពិនិត្យករណីរបស់អ្នកឡើងវិញ ហើយផ្តល់សេចក្ដីសម្រេចដល់អ្នក។ ប្រសិនបើផលិតផលណាមួយដែលអ្នកបានស្នើសុំនៅតែត្រូវបានបដិសេធ អ្នកអាចស្នើសុំបណ្តឹងឧទ្ធរណ៍កម្រិតបន្ទាប់ ដែលជាការពិនិត្យឡើងវិញដោយឯករាជ្យលើករណីរបស់អ្នកដោយអ្នកត្រួតពិនិត្យនៅខាងក្រៅគម្រោងរបស់អ្នក។ ប្រសិនបើអ្នកមិនយល់ស្របនឹងសេចក្តីសម្រេចនោះ អ្នកនឹងមានសិទ្ធិប្តឹងឧទ្ធរណ៍បន្ថែមទៀត។ អ្នកនឹងទទួលបានដំណឹងអំពីសិទ្ធិប្តឹងឧទ្ធរណ៍របស់អ្នក ប្រសិនបើរឿងនេះកើតឡើង។

And a screenshot for a sample of the issue:

Image

After isolating the problem, it appears the issue might stem from Java’s own text rendering — specifically the way it handles shaping and line breaking for complex scripts.

To help demonstrate this, I’ve put together a minimal project showing:

  • A plain Java example that reproduces the shaping problem
  • A JasperReports demo showing the issue in a real-world PDF export
  • A version using ICU4J’s BreakIterator and GlyphVector, which produces correct output

Here’s the repository with everything:

🔗 https://github.com/your-username/khmer-java-rendering-issue

Thanks for the great tool — and for taking a look.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions