You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "John Hewson (JIRA)" <ji...@apache.org> on 2014/08/28 22:41:10 UTC

[jira] [Comment Edited] (PDFBOX-2144) Provide a pluggable font manager

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

John Hewson edited comment on PDFBOX-2144 at 8/28/14 8:41 PM:
--------------------------------------------------------------

{quote}
You scare me. What is static and where?
{quote}

Some of it _is_ scary. PDFBox has plenty of static state, fonts are cached statically, as are CMaps and some ICC_ColorSpace instances. There may be more, I don't know because nobody designed the system as a whole.

PDFBox has some thread safety issues, even when it's clear where static state is, it's not clear that it is safe, for example, fonts were being cached statically, but the fonts themselves were not thread safe. I've been working on fixing this in PDFBOX-2262.

{quote}
Just replace your static methods by a factory and bind the instance to somewhere 
{quote}

That's what I'm trying to avoid, we can't use PageDrawer as PDFont objects are created outside of rendering, PDDocument would work though. However, the API changes needed to pass the FontProvider from PDDocument to PDPage to PDResources to PDFontFactory to the PDFont classes themselves aren't desirable.


was (Author: jahewson):
{quote}
You scare me. What is static and where?
{quote}

Some of it _is_ scary. PDFBox has plenty of static state, fonts are cached statically, as are CMaps and some ICC_ColorSpace instances. There may be more, I don't know because nobody designed the system as a whole.

PDFBox has some thread safety issues, even when it's clear where static state is, it's not clear that it is safe, for example, fonts were being cached statically, but the fonts themselves were not thread safe. I've been working on fixing this in PDFBOX-2262.

{quote}
Just replace your static methods by a factory and bind the instance to somewhere 
{quote}

That's what I'm trying to avoid, we can't use PageDrawer as PDFont objects are created outside of rendering, PDDocument would work though but the API changes needed to pass the FontProvider from PDDocument to PDPage to PDResources to PDFontFactory to the PDFont classes themselves aren't desirable.

> Provide a pluggable font manager
> --------------------------------
>
>                 Key: PDFBOX-2144
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2144
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Rendering
>            Reporter: Petr Slaby
>            Assignee: John Hewson
>         Attachments: FontManager.patch
>
>
> Our J2EE application has all fonts and resources configured and stored in its database. No files are accessed directly from file system or from system environment. To make PDFBox compatible with this philosophy, we need the FontManager in pdfbox and fontbox to be pluggable, e.g. as shown in the attached patch.
> The proposal defines a FontManager interface and default implementation which is the original one. FontManager then needs to be configured on and propagated from PDFStreamEngine and PageDrawer. It should also be configurable on PDFRenderer, which is not shown in the patch. There I would suggest to introduce a configuration object which would take care about all the current and future options of PDFRenderer.



--
This message was sent by Atlassian JIRA
(v6.2#6252)