title: How to configure fonts from Java code in Apache FOP?
body: <p>The <a href="http://xmlgraphics.apache.org/fop/0.95/fonts.html#basics" rel="nofollow">link</a> says that it is not "easily" possible to configure fonts from java code. How do I achieve this? 
  I'm having problems rendering certain HTMLs from international languages like French and Japanese.    </p>
  
  <pre><code>WARNING: Font "Symbol,normal,700" not found. Substituting with "Symbol,normal,400".
  May 08, 2015 4:45:39 PM org.apache.fop.events.LoggingEventListener processEvent
  WARNING: Font "ZapfDingbats,normal,700" not found. Substituting with "ZapfDingbats,normal,400". 
  </code></pre>
  
  <p>The PDF generated is damaged as a result. </p>
  
  <p><strong>update</strong>:</p>
  
  <p>My Html contains French words like "Modifié Créée le Propriétaire" </p>
  
  <pre><code>File file = new File("C:\\Users\\me\\Desktop\\Test.html");
  
  
  fopFactory = FopFactory.newInstance();
  foUserAgent = fopFactory.newFOUserAgent();
  
  
  String fileName = file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf("\\")+1,file.getAbsolutePath().lastIndexOf("."));
          String workspacePath = file.getAbsolutePath().substring(0,file.getAbsolutePath().lastIndexOf("\\"));
          File xsltfile = new File("xhtml2fo.xsl");
          StreamSource source = null;
          source = new StreamSource(file);
          StreamSource transformSource = new StreamSource(xsltfile);
          ByteArrayOutputStream outStream = new ByteArrayOutputStream();
  
  
          Transformer xslfoTransformer = null;
          TransformerFactory fac = TransformerFactory.newInstance();
          xslfoTransformer = fac.newTransformer(transformSource);
          xslfoTransformer.setErrorListener(this);
  
          Fop fop;
          fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, outStream);
          // Resulting SAX events (the generated FO)
          Result res = new SAXResult(fop.getDefaultHandler());
          xslfoTransformer.transform(source, res);
  
          output = new File(workspacePath + File.separator + fileName + ".pdf");
          OutputStream out = new java.io.FileOutputStream(output);
          out = new java.io.BufferedOutputStream(out);
          FileOutputStream str = new FileOutputStream(output);
          str.write(outStream.toByteArray());
          str.close();
  </code></pre>
  
  <p>I'm using an XSLT provided by Antennahouse to convert HTML tags to FO tags.</p>