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: [email protected] [mailto:[email protected]] On Behalf Of
Adrian Cumiskey
Sent: Sunday, August 15, 2010 10:43 PM
To: Jonathan Levinson
Cc: [email protected]; [email protected]
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"
<[email protected]<mailto:[email protected]>>
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:[email protected]<mailto:[email protected]>]
Sent: Sunday, August 15, 2010 12:28 PM
To: [email protected]<mailto:[email protected]>
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
(...