admin管理员组

文章数量:1401307

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.

本文标签: javaApache Fop Font not foundStack Overflow