Mike Hearn created PDFBOX-5684:
----------------------------------
Summary: Font cache isn't effective on my machine, always rebuilds
Key: PDFBOX-5684
URL: https://issues.apache.org/jira/browse/PDFBOX-5684
Project: PDFBox
Issue Type: Bug
Components: FontBox
Affects Versions: 3.0.0 PDFBox
Environment: macOS 13
Reporter: Mike Hearn
I see that FontBox has a font caching implementation. Whenever I try to use
PDFTextStripped on one specific PDF I have, it triggers the computation of this
cache (I'm not sure why it doesn't need to for the others). This is very slow.
If the cache really worked I could live with that but every time, it decides
the cache isn't valid and rebuilds it.
The issue is this line here in FileSystemFontProvider.loadDiskCache:
{code:java}
if (!pending.isEmpty())
{
// re-build the entire cache if we encounter un-cached fonts (could be
optimised)
LOG.warn("New fonts found, font cache will be re-built");
return null;
}
{code}
I don't know why "pending" is never empty as I'm not installing new fonts or
changing my font configuration in any way, but my guess is, if some fonts fail
to load then they don't enter the cache but this fact isn't recorded. So they
are always seen as "new". It's just a guess based on the fact that I see errors
related to being unable to load some fonts during this process, e.g.
{noformat}
Could not load font file:
/System/Library/Fonts/Supplemental/NotoSansBamum-Regular.ttf
java.io.IOException: Unknown substFormat: 0 @
org.apache.fontbox.ttf.GlyphSubstitutionTable.readSingleLookupSubTable(GlyphSubstitutionTable.java:372){noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]