java - Apache Fop Font not found - Stack Overflow

I need a font that can handle glyphs like š,đ,ž,ć,č... and since Apache Fop doesn't have a single

I need a font that can handle glyphs like š,đ,ž,ć,č... and since Apache Fop doesn't have a single font that can handle these glyphs preinstalled I am trying to import new ones.

So far I tried all these options in fop.xconf:

<!-- register all the fonts found in a directory -->
<directory>C:\MyFonts1</directory>
    
<!-- register all the fonts found in a directory and all of its sub directories (use with care) -->
<directory recursive="true">C:\MyFonts2</directory>
    
<!-- automatically detect operating system installed fonts -->
<auto-detect/>

And it always ends up not loading the fonts.

This picture might help:

I need a font that can handle glyphs like š,đ,ž,ć,č... and since Apache Fop doesn't have a single font that can handle these glyphs preinstalled I am trying to import new ones.

So far I tried all these options in fop.xconf:

<!-- register all the fonts found in a directory -->
<directory>C:\MyFonts1</directory>
    
<!-- register all the fonts found in a directory and all of its sub directories (use with care) -->
<directory recursive="true">C:\MyFonts2</directory>
    
<!-- automatically detect operating system installed fonts -->
<auto-detect/>

And it always ends up not loading the fonts.

This picture might help:

Share Improve this question edited Mar 25 at 14:46 f_puras 2,5044 gold badges36 silver badges46 bronze badges asked Mar 25 at 14:27 Jura starčevićJura starčević 111 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 1

The problem was in fop.xconf not loading correctly.
I used to load it like this:

File configFile = new File("fop.xconf");
if (!configFile.exists()) {
    System.out.println("Config file not found: " + configFile.getAbsolutePath());
}

FopFactoryBuilder factoryBuilder = new FopFactoryBuilder(configFile.toURI());

In the end it would never load it.
So when you add this next code snippet behind the code above, it loads it correctly:

DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
Configuration cfg = cfgBuilder.buildFromFile(configFile);

factoryBuilder.setConfiguration(cfg);

FopFactory fopFactory = factoryBuilder.build();

This ended up fixing the whole thing.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744189581a4562368.html

相关推荐

  • java - Apache Fop Font not found - Stack Overflow

    I need a font that can handle glyphs like š,đ,ž,ć,č... and since Apache Fop doesn't have a single

    9天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信