Hi, is allowed to use different fonts, saved in different folders, but with the same name? I generate few afps with a for loop and the first has the right font, the other ones always use the first font.
For example I use times and arial, size 8; font files are saved as /fonts/arial/C0FT0008 /fonts/times/C0FT0008 Then I generate .fo files like that: ARIAL: <fo:block font-family="arial" font-style="normal" font-size="8" font-weight="normal">Arial 8</fo:block> TIMES: <fo:block font-family="times" font-style="normal" font-size="8" font-weight="normal">Arial 8</fo:block> And xconf: ARIAL: <afp-font name="arial" type="raster" codepage="T1001250" encoding="Cp1250" embed-url="/fonts-encoded/arial/"> <afp-raster-font size="8" characterset="C0FT0008"/> TIMES: <afp-font name="times" type="raster" codepage="T1001250" encoding="Cp1250" embed-url="/fonts-encoded/times/"> <afp-raster-font size="8" characterset="C0FT0008"/> Then generate two afps with a for loop: try{ fop_factory = FopFactory.newInstance(); fop_factory.setUserConfig(config); bw = new BufferedOutputStream(new FileOutputStream(new File(out_file))); fop = fop_factory.newFop(MimeConstants.MIME_AFP, bw); transformer_factory = TransformerFactory.newInstance(); transformer = transformer_factory.newTransformer(); fo_file = new StreamSource(new InputStreamReader(new FileInputStream(fo_file_name), "UTF-8")); res_file = new SAXResult(fop.getDefaultHandler()); transformer.transform(fo_file, res_file); } catch(Exception e) { } finally { try { bw.flush(); bw.close(); } catch (Exception e) { } } What am I doing wrong? Thank you very much ________________________________ Da: Francesco Nigro <fixitf3...@yahoo.it> A: "fop-users@xmlgraphics.apache.org" <fop-users@xmlgraphics.apache.org> Inviato: Mercoledì 3 Aprile 2013 17:12 Oggetto: embedding fop in java and create afp Hi all, I've embedded fop 1.1 in my java program following this guide: http://xmlgraphics.apache.org/fop/1.1/embedding.html Everything is working and I don't have compile/runtime errors but afp files don't use the fonts configured, the same font is always displayed. If I use the binary distribution of fop (fop.bat) the afp files generated are correct, so the .fo file, .xconf and also fonts are valid. PDFs are perfect, the issue is just with AFP. here's an exctract from my .fo: <fo:block font-family="GalaxiePolarisCondensed-Light-T1001250" font-style="normal" font-size="6" font-weight="normal">GalaxiePolarisCondensed-Light 6</fo:block> here's an exctract from my .xconf: <renderer mime="application/x-afp"> <images mode="b+w" bits-per-pixel="8"/> <renderer-resolution>240</renderer-resolution> <line-width-correction>2.5</line-width-correction> <fonts> <font> <afp-font name="GalaxiePolarisCondensed-Light-T1001250" type="raster" codepage="T1001250" encoding="Cp1250" base-uri="../../data/fonts-encoded/GalaxiePolarisCondensed-Light-T1001250/" embed-url="../../data/fonts-encoded/GalaxiePolarisCondensed-Light-T1001250/"> <afp-raster-font size="6" characterset="C0FT0006"/> </afp-font> <font-triplet name="GalaxiePolarisCondensed-Light-T1001250" style="normal" weight="normal"/> <font-triplet name="any" style="normal" weight="normal"/> </font> </fonts> </renderer> The steps to create the afp are always the same: config_builder = new DefaultConfigurationBuilder(); config = config_builder.buildFromFile(new File(my_conf_file)); fop_factory = FopFactory.newInstance(); fop_factory.setUserConfig(config); bw = new BufferedOutputStream(new FileOutputStream(new File(out_afp_file))); fop = fop_factory.newFop("application/x-afp", bw); transformer_factory = TransformerFactory.newInstance(); transformer = transformer_factory.newTransformer(); fo_file = new StreamSource(new InputStreamReader(new FileInputStream(in_fo_file), "UTF-8")); res_file = new SAXResult(fop.getDefaultHandler()); transformer.transform(fo_file, res_file); I can't figure out what's wrong; can you point me in the right direction? Thank you very much, F.