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

Tilman Hausherr commented on PDFBOX-5779:
-----------------------------------------

There will always be a difference because of the reading in memory of the whole 
stream. Arial.ttf has a size of 1MB.

I looked in the code re: caching. The glyph table is not read in full. Thus 
reading from a file will have less disk access.

If you are doing a mass mailing with the same font(s) then the best is to read 
the font(s) only once and into a {{TrueTypeFont}} object. This one survives the 
closing of the document.

> Loading font streams has poorer performance compared to loading font files
> --------------------------------------------------------------------------
>
>                 Key: PDFBOX-5779
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5779
>             Project: PDFBox
>          Issue Type: Improvement
>    Affects Versions: 3.0.1 PDFBox
>            Reporter: bai yuan
>            Priority: Major
>         Attachments: arial.ttf, pdfbox-1.java, pdfbox.java
>
>
> Run the attached program, then open the code on line 41 and comment out the 
> code on line 44, and compare the time consumption of the two font loading 
> methods.
> Why does using font streams have poorer performance compared to using font 
> files? Is this a limitation? If I can only use font streams, are there any 
> ways to improve performance?



--
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