[ 
https://issues.apache.org/jira/browse/PDFBOX-5612?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tilman Hausherr updated PDFBOX-5612:
------------------------------------
    Description: 
As [reported|https://lists.apache.org/thread/k25mo4wlnhm4lkcxt0d42lqwxo6w0cvn] 
by Daniel Skiles:
On Windows systems, this works fine, but on Linux systems, PDFBox renders
the text as gibberish glyphs in a way that I've never seen before.

When I reproduce the issue with logging increased to trace, I get the
following line in the log.

15:55:15.622 [main] WARN org.apache.pdfbox.pdmodel.font.PDCIDFontType2 -
Using non-embedded GIDs in font Calibri

====

What I think is happening is that PDCIDFontType2.codeToGID() chooses the "Using 
non-embedded GIDs in font" branch erroneously. This should be chosen only if 
the fonts are identical, i.e. if a missing/broken font is replaced by the SAME 
one from disk.

I also tried to change the code so that it avoids the "Using non-embedded GIDs 
in font" segment and that worked. 

I could simulate what the user mentioned by making it appear that Calibri is 
missing by altering the {{for (URI font : fonts)}} segment in 
{{FileSystemFontProvider}} so that it omits the Calibri font. (In the users 
application, the Carlito font is used instead, I wasn't able to reproduce that; 
for me it used Liberation and then showed gibberish) 

  was:
As [reported|https://lists.apache.org/thread/k25mo4wlnhm4lkcxt0d42lqwxo6w0cvn] 
by Daniel Skiles:
On Windows systems, this works fine, but on Linux systems, PDFBox renders
the text as gibberish glyphs in a way that I've never seen before.

When I reproduce the issue with logging increased to trace, I get the
following line in the log.

15:55:15.622 [main] WARN org.apache.pdfbox.pdmodel.font.PDCIDFontType2 -
Using non-embedded GIDs in font Calibri

====

What I think is happening is that PDCIDFontType2.codeToGID() chooses the "Using 
non-embedded GIDs in font" branch erroneously. This should be chosen only if 
the fonts are identical, i.e. if a missing/broken font is replaced by the SAME 
one from disk.

I also tried to change the code so that it avoids the "Using non-embedded GIDs 
in font" segment and that worked. 

I could simulate what the user mentioned by making it appear that Calibri is 
missing by altering FileSystemFontProvider so that it omits the Calibri font. 
(In the users application, the Carlito font is used instead, I wasn't able to 
reproduce that; for me it used Liberation) 


> PDF with mangled font rendering in some environments
> ----------------------------------------------------
>
>                 Key: PDFBOX-5612
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5612
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.28, 3.0.0 PDFBox
>            Reporter: Tilman Hausherr
>            Priority: Major
>         Attachments: PP90092026_PL0029_490.pdf
>
>
> As 
> [reported|https://lists.apache.org/thread/k25mo4wlnhm4lkcxt0d42lqwxo6w0cvn] 
> by Daniel Skiles:
> On Windows systems, this works fine, but on Linux systems, PDFBox renders
> the text as gibberish glyphs in a way that I've never seen before.
> When I reproduce the issue with logging increased to trace, I get the
> following line in the log.
> 15:55:15.622 [main] WARN org.apache.pdfbox.pdmodel.font.PDCIDFontType2 -
> Using non-embedded GIDs in font Calibri
> ====
> What I think is happening is that PDCIDFontType2.codeToGID() chooses the 
> "Using non-embedded GIDs in font" branch erroneously. This should be chosen 
> only if the fonts are identical, i.e. if a missing/broken font is replaced by 
> the SAME one from disk.
> I also tried to change the code so that it avoids the "Using non-embedded 
> GIDs in font" segment and that worked. 
> I could simulate what the user mentioned by making it appear that Calibri is 
> missing by altering the {{for (URI font : fonts)}} segment in 
> {{FileSystemFontProvider}} so that it omits the Calibri font. (In the users 
> application, the Carlito font is used instead, I wasn't able to reproduce 
> that; for me it used Liberation and then showed gibberish) 



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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to