Hi,
Turning on tracing the problem is that while the font cache is being written to the temporary directory:
[TRACE] FontCache - Writing font cache to C:\Documents and Settings\levinson\Local Settings\Temp\.fop\fop-fonts.cache
The font cache is never read from the temporary directory. It is always read from the place user.home points to. For the code to be able to use the temporary directory, it would have to check to see if there is no .fop directory in directory given by System property user.home and if there is no .fop directory look under the temporary directory for .fop. I don't know if this would be an acceptable change.
Best Regards,
Jonathan Levinson
From: Jonathan Levinson [mailto:***@intersystems.com]
Sent: Monday, August 16, 2010 1:58 PM
To: Adrian Cumiskey
Cc: fop-***@xmlgraphics.apache.org
Subject: RE: RE: Problem with creation of font cache on Windows 7 64 bit
Hi Adrian,
Thanks for your help! I'm noticing behavior I did not expect after reading your code and reading https://issues.apache.org/bugzilla/show_bug.cgi?id=46686.
It looks like if "mkdir" fails, FOP will use the temp directory. However testing this by pointing -Duser.home to a directory to which I do not have write permissions on Windows XP, I don't see any font cache created. Instead, it seems like fonts are completely reloaded each time with the <auto-detect> feature under <fonts> turned on.
Reading the code, I see the following, which leads me to expect the temporary directory would be used.
/**
* Returns the default font cache file.
* @param forWriting true if the user directory should be created
* @return the default font cache file
*/
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);
}
Best Regards,
Jonathan Levinson
From: ***@gmail.com [mailto:***@gmail.com] On Behalf Of Adrian Cumiskey
Sent: Sunday, August 15, 2010 10:43 PM
To: Jonathan Levinson
Cc: fop-***@xmlgraphics.apache.org; ***@cumiskey.com
Subject: Re: RE: Problem with creation of font cache on Windows 7 64 bit
Hi Jonathan,
Well spotted, yes that should work well also. Although its a bit of a sneaky "back door" way of achieving it : -).
Cheers, Adrian.
On 2010-08-16 1:23 AM, "Jonathan Levinson" <***@intersystems.com<mailto:***@intersystems.com>> wrote:
Thank you Adrian!
Also I've noticed you can redirect the font-cache with the Java system property -Duser.home, so one can direct it to a different place by editing the JAVAOPTS set in fop.bat.
Best Regards,
Jonathan Levinson
From: Adrian Cumiskey [mailto:***@gmail.com<mailto:***@gmail.com>]
Sent: Sunday, August 15, 2010 12:28 PM
To: fop-***@xmlgraphics.apache.org<mailto:fop-***@xmlgraphics.apache.org>
Subject: Re: Problem with creation of font cache on Windows 7 64 bit
Hi Jonathan,
I have just committed a fix to the missing "cache-file" configuration option (...