FontRepository.setReplaceNotFoundFonts() replaces embedded fonts

Hi,

is FontRepository.setReplaceNotFoundFonts() supposed to replace embedded fonts? Please find attached a PDF which is rendered as PNG with the following Java code snippet:

public static void main( String[] args ) throws Exception
{
	Document pdfDocument = new Document( "example-custom-font.pdf" );
	
	FontRepository.setReplaceNotFoundFonts( true );
	
	PngDevice device = new PngDevice( new Resolution( 100 ) );
	
	device.process( pdfDocument.getPages().get_Item( 1 ), new FileOutputStream( "generated.png" ) );
}

The generated and the expected PNGs are attached as well.

Regards,
Michael

example-custom-font.pdf (37.2 KB)
expected.png (12.2 KB)
generated.png (12.4 KB)

@mstrucken

Thank you for contacting support.

FontRepository performs font search, it searches in system installed fonts and standard PDF fonts so the fonts being used in your PDF document are treated as NotFoundFont thus replaced, which causes the difference between expected and generated image. However, we have logged an investigation ticket with ID PDFJAVA-38201 in our issue management system for further investigations. We will let you know as soon as some significant updates will be available in this regard.