title: Configure Batik to utilize custom fonts
body: <p>I have an issue configuring Batik PDFTranscoder for  Svg to Pdf conversion.
  I want to embed custom truetype fonts to PDF output, therefore I utilize Batik transcoder. I supply font configuration in fop config file, as described here: <a href="https://xmlgraphics.apache.org/fop/2.2/fonts.html" rel="noreferrer">https://xmlgraphics.apache.org/fop/2.2/fonts.html</a></p>
  
  <p>I tried conversion with org.apache.xmlgraphics.Fop versions 2.1 and 2.2. Without any success.</p>
  
  <p>My pdf output, comes with 'Times New Roman' font instead of coming with embedded font 'Arial', as it should, based on example below:</p>
  
  <p>My config file: </p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
   &lt;fop version="1.0"&gt;
    &lt;renderers&gt;
     &lt;renderer mime="application/pdf"&gt;
       &lt;fonts&gt;
          &lt;directory&gt;C:/path/to/fontsfolder&lt;/directory&gt;   
          &lt;auto-detect/&gt;
       &lt;/fonts&gt;
     &lt;/renderer&gt;
    &lt;/renderers&gt;
   &lt;/fop&gt;
  </code></pre>
  
  <p>Here's my transcoder code:</p>
  
  <pre><code> import org.apache.batik.transcoder.*;
   import org.apache.fop.svg.PDFTranscoder; 
   import org.w3c.dom.Document;
  
  
   PDFTranscoder transcoder = new PDFTranscoder();
  
   try {
     DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
     Configuration cfg = cfgBuilder.buildFromFile(new File("path-to-xml-config-file"));
     ContainerUtil.configure(transcoder, cfg);
   } catch (Exception e) {
     throw new TranscoderException(e);
   }
     transcoder.transcode(new TranscoderInput(doc),
                        new TranscoderOutput(os));
  </code></pre>
  
  <p>Sample svg file:</p>
  
  <pre><code>&lt;defs&gt;
  &lt;style type="text/css"&gt;
       @font-face{font-family:'Arial';font-style: normal;font-weight:
       400;src:url('C:/path/to/fontsfolder/arial.ttf')
       format('truetype');}
  &lt;/style&gt;
  &lt;/defs&gt;
  
  
    &lt;text x="55" y="245" style="font-family: 'Arial'; font-weight:normal;
  font-style: normal" &gt;Sample text&lt;/text&gt;
  </code></pre>
  
  <p>Can somebody tell me what I'm missing here with Transcoder configuration? Embedding svg fonts into svg file is not an option in this case. I'm stuck here. Any help would be highly appreciated. </p>
  
  <p>Thanks in advance,</p>
  
  <p>Olodo</p>
  
  <p>EDIT: </p>
  
  <p>Solution was to update config file and move fonts section outside renderers section, like this:
  My config file: </p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
   &lt;fop version="1.0"&gt;
       &lt;fonts&gt;
          &lt;directory&gt;C:/path/to/fontsfolder&lt;/directory&gt;   
          &lt;auto-detect/&gt;
       &lt;/fonts&gt;
   &lt;/fop&gt;
  </code></pre>
  
  <p>Bulk font configuration from Apache website is simply wrong... :/ 
  <a href="https://xmlgraphics.apache.org/fop/2.2/fonts.html" rel="noreferrer">https://xmlgraphics.apache.org/fop/2.2/fonts.html</a></p>