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

Oliver Schmidtmer edited comment on PDFBOX-6288 at 11/19/26, 11:30 AM:
-----------------------------------------------------------------------

[~tilman] It is definitely better, but still not working for every font.

Probably needs more cases in the name comparison like 
""Tahoma,Bold".equals(name) && "Tahoma-Bold".equals(ttfName)" from the commit:
{code:java}
 Info  [PDFDebugger] Parsed in 1 ms
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial,Bold
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [GlyphCache] No glyph for code 3 (CID 0003) in font Arial,Bold
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [PDCIDFontType2] Using non-embedded CID2GID identity for font Arial / 
ArialMT
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial,Italic
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [GlyphCache] No glyph for code 3 (CID 0003) in font Arial,Italic
 Warning  [GlyphCache] No glyph for code 29 (CID 001d) in font Arial,Italic
 Warning  [GlyphCache] No glyph for code 11 (CID 000b) in font Arial,Italic
 Warning  [GlyphCache] No glyph for code 12 (CID 000c) in font Arial,Italic
 Warning  [GlyphCache] No glyph for code 10 (CID 000a) in font Arial,Italic
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial,Bold
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [GlyphCache] No glyph for code 3 (CID 0003) in font Arial,Bold
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [PDCIDFontType2] Using non-embedded CID2GID identity for font Arial / 
ArialMT
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial,Italic
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [GlyphCache] No glyph for code 3 (CID 0003) in font Arial,Italic
 Warning  [GlyphCache] No glyph for code 29 (CID 001d) in font Arial,Italic
 Warning  [GlyphCache] No glyph for code 11 (CID 000b) in font Arial,Italic
 Warning  [GlyphCache] No glyph for code 12 (CID 000c) in font Arial,Italic
 Warning  [GlyphCache] No glyph for code 10 (CID 000a) in font Arial,Italic
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial,Bold
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [PDCIDFontType2] Using non-embedded CID2GID identity for font Arial / 
ArialMT
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial,Italic
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [PDCIDFontType2] Using non-embedded CID2GID identity for font Arial / 
ArialMT
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial,Italic
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [PDCIDFontType2] Using non-embedded CID2GID identity for font Arial / 
ArialMT
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial,Bold
 Warning  [PDFont] Using predefined identity CMap instead
{code}


{code:java}
        if(ttfName.startsWith(name.replace(",","-")) || 
name.startsWith(ttfName.replace("-",","))){
            hasEqualName = true;
            return;
        }
{code}



was (Author: schmidor):
[~tilman] It is definitely better, but still not working for every font.

Probably needs more cases in the name comparison like 
""Tahoma,Bold".equals(name) && "Tahoma-Bold".equals(ttfName)" from the commit:
{code:java}
 Info  [PDFDebugger] Parsed in 1 ms
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial,Bold
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [GlyphCache] No glyph for code 3 (CID 0003) in font Arial,Bold
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [PDCIDFontType2] Using non-embedded CID2GID identity for font Arial / 
ArialMT
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial,Italic
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [GlyphCache] No glyph for code 3 (CID 0003) in font Arial,Italic
 Warning  [GlyphCache] No glyph for code 29 (CID 001d) in font Arial,Italic
 Warning  [GlyphCache] No glyph for code 11 (CID 000b) in font Arial,Italic
 Warning  [GlyphCache] No glyph for code 12 (CID 000c) in font Arial,Italic
 Warning  [GlyphCache] No glyph for code 10 (CID 000a) in font Arial,Italic
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial,Bold
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [GlyphCache] No glyph for code 3 (CID 0003) in font Arial,Bold
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [PDCIDFontType2] Using non-embedded CID2GID identity for font Arial / 
ArialMT
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial,Italic
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [GlyphCache] No glyph for code 3 (CID 0003) in font Arial,Italic
 Warning  [GlyphCache] No glyph for code 29 (CID 001d) in font Arial,Italic
 Warning  [GlyphCache] No glyph for code 11 (CID 000b) in font Arial,Italic
 Warning  [GlyphCache] No glyph for code 12 (CID 000c) in font Arial,Italic
 Warning  [GlyphCache] No glyph for code 10 (CID 000a) in font Arial,Italic
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial,Bold
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [PDCIDFontType2] Using non-embedded CID2GID identity for font Arial / 
ArialMT
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial,Italic
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [PDCIDFontType2] Using non-embedded CID2GID identity for font Arial / 
ArialMT
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial,Italic
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial
 Warning  [PDFont] Using predefined identity CMap instead
 Warning  [PDCIDFontType2] Using non-embedded CID2GID identity for font Arial / 
ArialMT
 Warning  [PDFont] Invalid ToUnicode CMap in font Arial,Bold
 Warning  [PDFont] Using predefined identity CMap instead
{code}

> Invalid ToUnicode CMap
> ----------------------
>
>                 Key: PDFBOX-6288
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-6288
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.37, 3.0.8 PDFBox
>            Reporter: Oliver Schmidtmer
>            Assignee: Tilman Hausherr
>            Priority: Major
>             Fix For: 2.0.38, 3.0.9 PDFBox, 4.0.0
>
>         Attachments: MalformedToUnicodeCMap.pdf, 
> image-2026-11-12-12-51-25-119.png, image-2026-11-12-12-53-07-456.png, 
> image-2026-11-12-12-55-54-029.png, toUnicode-CMAP.patch
>
>
> A problematic PDF file contains a "ToUnicode CMap" that uses "begincidrange" 
> instead of "beginbfchar" or "beginbfrange".
> Since the CMap is ignored in this case, the wrong glyphs are used during 
> rendering. Because the file displays correctly in Acrobat, a workaround might 
> be justified.
> The attached PDF file is a generated example, as the original contains 
> sensitive data. I used Copilot for the analysis and to create a potential 
> patch:
> https://github.com/Schmidor/pdfbox/commit/425e83caaa28c66e6e4438c7818f0eb0a448fae9



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to