[ 
https://issues.apache.org/jira/browse/PDFBOX-5684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765902#comment-17765902
 ] 

Tilman Hausherr commented on PDFBOX-5684:
-----------------------------------------

I agree that the exception is too aggressive. I can't reproduce the error. 
Could you download the font from
https://fonts.google.com/noto/specimen/Noto+Sans+Bamum
install and try again?

Fixing the actual problem is more difficult, i.e. we'd have to add some logic 
into the cache table to remember the time when we scanned than font so we don't 
try again.

> 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
>            Priority: Major
>
> 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: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to