You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by bu...@apache.org on 2007/07/12 00:19:55 UTC

DO NOT REPLY [Bug 42861] New: - Font detection only works for first document.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42861>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42861

           Summary: Font detection only works for first document.
           Product: Fop
           Version: 1.0dev
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: fonts
        AssignedTo: fop-dev@xmlgraphics.apache.org
        ReportedBy: devel@thanlwinsoft.org


I've found that if I process more than one document with Fop without restarting
my application then only the first document is able to use autodetected fonts
(using the support added in Bug 41831). Fonts that were resolved and used
correctly in the first document are unable to be found for the subsequent
documents. 
The problem seems to be caused by the static autodetectedFonts variable in
org/apache/fop/render/PrintRendererConfigurator.java.
This occurs whether I reuse the FopFactory or whether I recreate it between
documents.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 42861] - Font detection only works for first document.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42861>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42861





------- Additional Comments From devel@thanlwinsoft.org  2007-07-11 15:21 -------
Created an attachment (id=20496)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20496&action=view)
reuseFontTripletMap20070711.diff

The quickest solution is just to remove the autodetectedFonts variable, but
that would result in unnecessary parsing of the fonts. Another solution would
be to store the Font maps in the FOUserAgent so that new FontInfo objects can
reuse the maps from the previous lookup. A patch based on this idea is
attached.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 42861] - Font detection only works for first document.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42861>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42861





------- Additional Comments From devel@thanlwinsoft.org  2007-07-12 15:30 -------
Created an attachment (id=20500)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20500&action=view)
cacheFontTripletMap20070712.diff

I still think you need to cache the font triplet maps in FontInfo some how
since the FontInfo object is recreated for each Fop object. The attached patch
caches them on FontCache as you suggest. 

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 42861] - Font detection only works for first document.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42861>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42861


dev@cumiskey.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #20496|0                           |1
        is obsolete|                            |




------- Additional Comments From dev@cumiskey.com  2007-07-12 07:48 -------
Created an attachment (id=20498)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20498&action=view)
font autodetection fix

* Created new FontManager class.
* Moved static boolean autoDetectedFonts member of PrintRendererConfigurator to
be a member of FontManager
* Moved FontCache from FopFactory to FontManager.
* Added FontManager get accessor in FopFactory.
* Moved FontCache related accessors to FontManager.
* PrintRendererConfigurator static methods modified to normal and signature
footprint reduced.
* PDFDocumentGraphics2DConfigurator now extends PDFRendererConfigurator and
makes use of member methods calls rather than making static method calls.
* Cleaned up javadocs in FontCache and PDFTranscoder

In the future some of the code could be reorganised a little so all font
detection related activities stem/flow from the FontManager rather than
directly from PrintRendererConfigurator.

FontManager could also be the holder of a centralized list of available fonts. 
Each renderer would then request the availability of a font from the
FontManager rather than each storing its own font list as is the current
situation.  I do not have time to make these changes *at the moment* but this
patch should fix the autodetection problem.

Adrian.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 42861] - Font detection only works for first document.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42861>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42861


dev@cumiskey.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




------- Additional Comments From dev@cumiskey.com  2007-07-12 05:49 -------
Having the fontMap and FontTripletInfo in the FOUserAgent is not the correct
place for this, it should remain in the FontCache where it can be serialized.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 42861] - [PATCH] Font detection only works for first document.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42861>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42861


bowditch_chris@hotmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Font detection only works   |[PATCH] Font detection only
                   |for first document.         |works for first document.




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 42861] - Font detection only works for first document.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42861>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42861





------- Additional Comments From devel@thanlwinsoft.org  2007-07-12 14:05 -------
Created an attachment (id=20499)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20499&action=view)
fo2pdfExampleOfBug.java

Thanks for the patch. Unfortunately, it still shows the bug if I don't recreate
the FopFactory. To demonstrate this bug you can try this java file, which is a
modified version of examples/embedding/java/embedding/ExampleFO2PDF.java.
Obviously, you also need to add an autodetected font to the Hello World
fo:block in xml/fo/helloworld.fo and add <auto-detect/> in the <fonts/> section
of the conf/fop.xconf. You should find that the first and third pdf have the
correct font, but the second pdf, which was created by reusing the FopFactory,
has the wrong font.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.