[ https://issues.apache.org/jira/browse/FOP-2146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17263712#comment-17263712 ]
Christopher Watford commented on FOP-2146: ------------------------------------------ When you use the PDFTranscoder, it is not possible to disable the font cache or change the font cache file: {code:java} DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder(); Configuration cfg = cfgBuilder.build(getClass().getResourceAsStream("fop-config.xml")); PDFTranscoder transcoder = new PDFTranscoder(); transcoder.configure(cfg); TranscoderInput input = new TranscoderInput(getSVGDocument()); ByteArrayOutputStream output = new ByteArrayOutputStream(); TranscoderOutput transOutput = new TranscoderOutput(output); transcoder.transcode(input, transOutput); {code} This is because when you dive into the guts: # PDFDocumentGraphics2DConfigurator gets created and configures itself using the configuration passed to the transcoder. # A new FontManager is created within PDFDocumentGraphics2DConfigurator, which DOES NOT use the configuration passed to the transcoder. # This FontManager is then used in DefaultFontConfigurator, and if there were any system fonts, they are saved. # The FontManager at this point is configured to use a relative directory called ".fop" which ends up being local to a read-only file system. This is in spite of either use-cache being false, or cache-file pointing to another location. The FontManager created within the PDFDocumentGraphics2DConfigurator needs to get its cache location from the FOP configuration. > Wrong FontCache-Directory used for not existing userHome in > FontCache.getDefaultCacheFile() (Bug 47786 was not fixed correctly) > ------------------------------------------------------------------------------------------------------------------------------- > > Key: FOP-2146 > URL: https://issues.apache.org/jira/browse/FOP-2146 > Project: FOP > Issue Type: Bug > Components: font/unqualified > Affects Versions: 1.1 > Environment: Operating System: All > Platform: All > Reporter: mg > > Method getDefaultCacheFile() returns an invalid file name if the user has no > home directory set. In that case the name of the fop user directory > (FOP_USER_DIR!) is returned and not the name of the cache file > (DEFAULT_CACHE_FILENAME). > Wrong Code: > public static File getDefaultCacheFile(boolean forWriting) { > File userHome = getUserHome(); > if (userHome != null) { > File fopUserDir = new File(userHome, FOP_USER_DIR); > if (forWriting) { > boolean writable = fopUserDir.canWrite(); > if (!fopUserDir.exists()) { > writable = fopUserDir.mkdir(); > } > if (!writable) { > userHome = getTempDirectory(); > fopUserDir = new File(userHome, FOP_USER_DIR); > fopUserDir.mkdir(); > } > } > return new File(fopUserDir, DEFAULT_CACHE_FILENAME); > } > return new File(FOP_USER_DIR); > } > If getUserHome() does not return a directory the default name must be > returned (and not the name of the directory): > return new File(DEFAULT_CACHE_FILENAME); -- This message was sent by Atlassian Jira (v8.3.4#803005)