Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

IndexOutOfBoundsException in FopGlyphProcessor when shaping Thai characters (Complex Scripts) #1456

Open
Labels
@PskDream

Description

Describe the bug

I found a bug in FopGlyphProcessor when rendering Thai language with FOP support enabled. The application crashes with IndexOutOfBoundsException because the processor assumes a 1:1 mapping between characters and glyphs.

To Reproduce

When rendering Thai characters like "ํา" (Sara Am), the FOP shaping engine decomposes one character into two glyphs (Nikkhahit + Lak Khang).
The current loop in FopGlyphProcessor.convertToBytesWithGlyphs iterates based on the glyph count but tries to access the charBuffer using the same index:

for (int i = 0; i < limit; i++) {
 // ...
 longTag.put(glyphCode, new int[]{..., charBuffer.get(i)}); // This throws Exception when limit > charBuffer size
}

Expected behavior

The processor should handle cases where the number of glyphs is greater than the number of characters by correctly mapping glyphs back to their original source characters using FOP's CharAssociation.

Screenshots

Image Image Image

System

OpenPDF version: 3.0.0
FOP version: 2.11
Language: Thai

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /