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

Struve Pierre commented on PDFBOX-4667:
---------------------------------------

Hi, I picked pdfbox-app-2.0.18-20191013.135200-59.jar

There seems that issue is still here. 

Is there a way to make a test with fonts in folder without altering the jar?

I have to play with the ~/.pdfbox.cache  in order to try to reproduce the issue.

Here is my code 
{code:java}
package org.egedede.pdfanalyzer;import org.apache.pdfbox.io.MemoryUsageSetting;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.rendering.ImageType;
import org.apache.pdfbox.rendering.PDFRenderer;import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;public class Render {
    public static void main(String[] args) throws Exception{
        Path path = Paths.get(args[0]);
        double memoryAllocatedToDocumentLoading = 512d * 1024l ;
//        MyFontMapperImpl fontMapper = new MyFontMapperImpl();
//        fontMapper.setProvider(new FolderFontProvider("/tmp/fontfolder"));
//        FontMappers.set(fontMapper);
//
        PDDocument doc = PDDocument.load(path.toFile(), 
MemoryUsageSetting.setupMixed((long)memoryAllocatedToDocumentLoading));
        PDFRenderer renderer = new PDFRenderer(doc);
        BufferedImage bufferedImage = 
renderer.renderImageWithDPI(Integer.parseInt(args[2]), 150, ImageType.RGB);
        File output = new File(path.getParent().toFile(), 
String.format("preview%s.png",System.currentTimeMillis()));
        ImageIO.write(bufferedImage,"png", output);
        System.out.println("Outputfile : "+output.getCanonicalPath());
    }
}

{code}
With those three libs(pdfbox-app-2.0.16.jar 
pdfbox-app-2.0.18-20191011.175132-44.jar 
pdfbox-app-2.0.18-20191013.135200-59.jar), I have the same result at the 
beginning of the logs :

WARNING: Using fallback OcrB Regular for CID-keyed font STSong-Light

> Issue in FontMapperImpl#isCharSetMatch when font codePageRange is -1
> --------------------------------------------------------------------
>
>                 Key: PDFBOX-4667
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4667
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.16
>            Reporter: Struve Pierre
>            Priority: Trivial
>             Fix For: 2.0.18, 3.0.0 PDFBox
>
>         Attachments: OcrB Regular.ttf, screenshot-1.png
>
>
> Hi I met an issue with a font.
> It seems to me that code page range has not been set and then in 
> org.apache.pdfbox.pdmodel.font.FontMapperImpl#isCharSetMatch -1 is used.
> It seems to me that -1 means "open bar".
> I was trying to find a font that matches CHINESE_SIMPLIFIED 
> (cidSystemInfo.getOrdering{color:#9876aa}(){color}.equals{color:#9876aa}({color}{color:#6a8759}"GB1"{color}{color:#9876aa}){color}),
>  and due to the -1 this font was matched and unluckily it was the one picked.
> Do you think we can make a special case for -1 (return false)?
> Is there any font currently that matches all code page ranges?
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to