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

Stephan Wienczny commented on FOP-3068:
---------------------------------------

The fonts belong to this package

[https://archlinux.org/packages/extra/any/noto-fonts-cjk/]

Version 20220126-1 (See package actions on the right side for download link)

I had to delete the original files because of a failing unit test on my 
machine. After reinstalling above package it's failing again ;)

 

I'm using this SpringConfiguration with the conf.xml
{code:java}
@Configuration
public class FOPConfiguration {
  @Bean
  public DefaultConfiguration fopConfiguration() throws IOException, 
ConfigurationException {
    try (final InputStream is = 
getClass().getResourceAsStream("/fop/conf.xml")) {
      final DefaultConfigurationBuilder cfgBuilder = new 
DefaultConfigurationBuilder();
      return cfgBuilder.build(is);
    }
  }

  @Bean
  public FopFactory fopFactory(final DefaultConfiguration defaultConfiguration) 
{
    return new 
FopFactoryBuilder(ApplicationDirectory.WORK_REPORTS_DIRECTORY.getPath().toUri())
      .setConfiguration(defaultConfiguration)
      .setSourceResolution(1200)
      .setTargetResolution(1200)
      .build();
  }

  @Bean
  public FOUserAgent fopUserAgent(final FopFactory fopFactory) {
    return fopFactory.newFOUserAgent();
  }
}
 {code}
For me there are two issues:
 * The FontInfoFinder fails if the TTFFile::getTTCnames returns null
 * The TTFile fails to parse the files -> which causes the first issue.

> NPE in FontInfoFinder for .ttc fonts 
> -------------------------------------
>
>                 Key: FOP-3068
>                 URL: https://issues.apache.org/jira/browse/FOP-3068
>             Project: FOP
>          Issue Type: Bug
>          Components: font/opentype
>    Affects Versions: 2.7
>            Reporter: Stephan Wienczny
>            Priority: Critical
>         Attachments: conf.xml
>
>
> When running FontInfoFinder::find on NotoSansCJK-Regular.ttc or 
> NotoSerifCJK-Regular.ttc this causes an NPE in line 219
> {code:java}
> for (String fontName : ttcNames) { {code}
> because ttcNames is null.
> TTFFile::getTTCnames may return null for invalid files. This case should be 
> handled in FontInfoFinder.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to