[ 
https://issues.apache.org/jira/browse/PDFBOX-4951?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18083526#comment-18083526
 ] 

Tilman Hausherr edited comment on PDFBOX-4951 at 5/26/26 5:25 PM:
------------------------------------------------------------------

I was wondering what would happen with india (Bengali) text, and added code 
that used this font: "/org/apache/pdfbox/resources/ttf/Lohit-Bengali.ttf" . 
However the text "India (India)" looks like this in the PDF:

!image-2026-05-26-16-49-45-529.png!

I also modified the code to disable GSubWorker, same result.

{code:java}
    public void test() {
        try {
            GlyphLayoutProcessor glyphLayoutProcessor = new 
GlyphLayoutProcessor();

            String outputFilename = "DoGlyphLayoutLigaturesAndKerning.pdf";
            String firaPath = 
"/org/apache/pdfbox/examples/glyphlayout/firacode/FiraCode-Regular.ttf";
            String dejavuPath = 
"/org/apache/pdfbox/examples/glyphlayout/dejavu/DejaVuSans.ttf";
            String lohitBengaliPath = 
"/org/apache/pdfbox/resources/ttf/Lohit-Bengali.ttf";

            float fontSize = 12.0f;

            PDDocument pdDocument = new PDDocument();

            PDType0Font firaFont = createPdType0Font(glyphLayoutProcessor, 
pdDocument, firaPath);
            PDType0Font firaLigFont = createPdType0Font(glyphLayoutProcessor, 
pdDocument, firaPath,
                    new GlyphLayoutFontLoader.FontOptions().setLigaturesOn());

            PDType0Font dejavuFont = createPdType0Font(glyphLayoutProcessor, 
pdDocument, dejavuPath);

            PDType0Font dejavuLigFont = createPdType0Font(glyphLayoutProcessor, 
pdDocument, dejavuPath,
                                    new 
GlyphLayoutFontLoader.FontOptions().setLigaturesOn());

            PDType0Font dejavuKernFont = 
createPdType0Font(glyphLayoutProcessor, pdDocument, dejavuPath,
                    new GlyphLayoutFontLoader.FontOptions().setKerningOn());

            PDType0Font dejavuLigKernFont = 
createPdType0Font(glyphLayoutProcessor, pdDocument, dejavuPath,
                    new 
GlyphLayoutFontLoader.FontOptions().setLigaturesOn().setKerningOn());

            PDType0Font lohitBengaliFont = 
createPdType0Font(glyphLayoutProcessor, pdDocument, lohitBengaliPath,
                                    new GlyphLayoutFontLoader.FontOptions());



            PDPage blankPage = new PDPage();
            pdDocument.addPage(blankPage);
            PDPageContentStream cs = new PDPageContentStream(pdDocument, 
pdDocument.getPage(0),
                    PDPageContentStream.AppendMode.APPEND, true);
            cs.setGlyphLayoutProcessor(glyphLayoutProcessor);

            float x = blankPage.getBBox().getLowerLeftX() + fontSize;
            float y = blankPage.getBBox().getUpperRightY() - fontSize;
            y = showComposites(cs, firaFont, fontSize, x, y, firaString);
            y = showComposites(cs, firaLigFont, fontSize, x, y, firaString + " 
(Ligatures)");
            y = showComposites(cs, dejavuFont, fontSize, x, y, dejavuString);
            y = showComposites(cs, dejavuLigFont, fontSize, x, y, dejavuString 
+ " (Ligatures)");
            y = showComposites(cs, dejavuKernFont, fontSize, x, y, dejavuString 
+ " (Kerning)");
            y = showComposites(cs, dejavuLigKernFont, fontSize, x, y, 
dejavuString + " (Ligatures and kerning)");
            showComposites(cs, lohitBengaliFont, fontSize, x, y, indiaString + 
" (India)");
            cs.close();
            pdDocument.save(outputFilename);
            pdDocument.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
{code}


was (Author: tilman):
I was wondering what would happen with india (Bengali) text, and added code 
that used this font: "/org/apache/pdfbox/resources/ttf/Lohit-Bengali.ttf" . 
However the text "India (India)" looks like this in the PDF:

!image-2026-05-26-16-49-45-529.png!

I also modified the code to disable GSubWorker, same result.

> Sequences of DIN SPEC 91379 with combining letters are rendered incorrectly
> ---------------------------------------------------------------------------
>
>                 Key: PDFBOX-4951
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4951
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.21
>            Reporter: Volker Kunert
>            Priority: Major
>         Attachments: DIN_SPEC_91379_Sequences-aa.pdf, 
> DIN_SPEC_91379_Sequences-ab.pdf, DIN_SPEC_91379_Sequences-ac.pdf, 
> DIN_SPEC_91379_Sequences.txt, DefaultScriptProcessor.java, DejaVuSans.ttf, 
> DoGlyphLayoutBidi.pdf, DoGlyphLayoutDinSpec91379.pdf, 
> DoGlyphLayoutDinSpec91379Form.pdf, DoGlyphPositionBengali.pdf, 
> ExamplePdfboxFopPos-By-Tilman.pdf, ExamplePdfboxFopPos.java, 
> ExamplePdfboxFopPos.pdf, ExamplePdfboxFopPosForm.java, 
> ExamplePdfboxFopPosForm.pdf, FiraCode-Regular.ttf, TestPdfbox.java, 
> TestPdfboxFop2.java, TestPdfboxFop2.pdf, TestPdfboxJava2D.java, 
> TestPdfboxJava2D.pdf, bidi-1.png, bidi-2.png, bidi.png, 
> image-2026-05-23-16-16-53-442.png, image-2026-05-23-16-17-28-172.png, 
> image-2026-05-26-16-49-45-529.png, ligatures-kerning.png, 
> patch-2020-10-02.txt, pdfbox.patch, pdfbox.pdf, screenshot-1.png
>
>
> Accented Letters composed of Unicode base letter and combining accent are 
> rendered wrong. E.g. with 0041 030B LATIN CAPITAL LETTER A WITH COMBINING 
> DOUBLE ACUTE ACCENT the accent appears at the right hand side of the letter 
> A, not above the letter A.
> The position is wrong for most of the sequences defined in the following spec:
> DIN SPEC 91379: Characters in Unicode for the electronic processing of names 
> and data 
>  exchange in Europe; with digital attachment
>  [https://www.xoev.de/downloads-2316#StringLatin]
>  [https://www.din.de/de/wdc-beuth:din21:301228458]
>  
> The correct rendering should look like the output of hb-view 2.6.8, see files 
> DIN_SPEC_91379_Sequences*.pdf.
> The output of PDFBox is appended in pdfbox.pdf, which is created by running 
> TestPdfbox.java. The sequences are read from file 
> DIN_SPEC_91379_Sequences.txt.
>  
> Font used for testing: NotoSansMono-Regular.ttf, see 
> [https://www.google.com/get/noto/] 
> download: 
> [https://noto-website-2.storage.googleapis.com/pkgs/NotoSansMono-hinted.zip]
>  See also FOP-2969
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to