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 Vincent Hennebert <vh...@gmail.com> on 2009/03/24 12:32:13 UTC

Re: svn commit: r757681 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/render/ src/java/org/apache/fop/render/intermediate/ test/ test/java/org/apache/fop/intermediate/

> Author: jeremias
> Date: Tue Mar 24 08:08:54 2009
> New Revision: 757681
> 
> URL: http://svn.apache.org/viewvc?rev=757681&view=rev
> Log:
> Amendment to revision 755894:
> The mimicking fix didn't work for all output formats.
> 
<snip/>
> Modified: 
> xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFUtil.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFUtil.java?rev=757681&r1=757680&r2=757681&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFUtil.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFUtil.java Tue Mar 24 08:08:54 2009
> @@ -153,6 +153,13 @@
>          if (fontInfo == null) {
>              fontInfo = new FontInfo();
>          }
> +        if (documentHandler instanceof IFSerializer) {
> +            IFSerializer serializer = (IFSerializer)documentHandler;
> +            if (serializer.getMimickedDocumentHandler() != null) {
> +                //Use the mimicked document handler's configurator to set up fonts
> +                documentHandler = serializer.getMimickedDocumentHandler();
> +            }
> +        }
>          IFDocumentHandlerConfigurator configurator = documentHandler.getConfigurator();
>          if (configurator != null) {
>              configurator.setupFontInfo(documentHandler, fontInfo);

That sounds wrong. That smells like a procedural way of solving
a problem that could be solved more easily and elegantly by using
a proper object-oriented approach. The use of instanceof almost always
indicates that something’s wrong anyway.
Why not directly declare a setupFonts method on IFDocumentHandler? It
could then be defined in concrete classes to do whatever is needed.

Plus, since the getEffectiveMIMEType method is no longer of use, it can
as well be removed IMO.


Vincent