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

Seifeddine Dridi edited comment on FOP-2293 at 8/30/13 3:32 PM:
----------------------------------------------------------------

> Why should the test for difference be > 0 only? A negative difference is ok 
> as long as the adjustment ratio is >= -1.
Good point! Thanks for pointing it out

> Creating a new KnuthPenalty for every alternative is not ideal. It should be 
> created once and stored in the alternative.
Why do you say that? I don't create a KnuthPenalty for every alternative.

> alternativeManager will work only if there is only one extension in the 
> document. If there are more, they will be mixed up in the same instance (see 
> multiple-feasible-nodes.fo).

Where can I find multiple-feasible-nodes.fo? I couldn't find it the examples 
directory.

> The calcFullContentLength shouldn’t be necessary: you can probably call 
> SpaceResolver.resolveElementList first and then use the standard 
> calcContentLength method.
I tried it before but it didn't work.

> if there’s no room on the page, the content will be unconditionally put on 
> the next page. Is that what you want? I suppose this aspect is still work in 
> progress.
If there 0 space left on the current page, then the content will be put on the 
next page. I'm going to leave it like that for now.

> validateChildNode: I don’t think you want to check elements in the fox 
> namespace. If you start like this you might as well check for elements in the 
> SVG namespace, and the MathML namespace, etc. Some generic, all-purpose 
> solution would have to be devised to check foreign elements, but this is 
> getting off-topic.
-> Well, I did it because I don't want nested alternative-block or best-fit. I 
understand your point but what else can I do to prevent the user from messing 
it up? Maybe the best way would be something like this:
{code:java}
        if (FOX_URI.equals(nsURI)) {
            if ("best-fit".equals(localName) || 
"alternative-block".equals(localName)) {
                invalidChildError(loc, FOX_URI, localName);
            }
        } else {
            invalidChildError(loc, nsURI, localName);
        }
{code}
                
> addChildArea: not sure if the test curBlockArea != null is necessary, since 
> it is initialized in getParentArea. Also, IIUC you are going to deal with 
> block areas only, as per the definition of fox:alternative-block
For now yes, but later I would like alternative-block to have all sort of 
formatting objects as childs, not just FO blocks.

> there is code duplicated from other LMs. This is fine for now, but eventually 
> it would be good to remove that duplication from all the LMs. We can get back 
> to that later.
You have no idea how much I resent code duplication, but I just couldn't help 
it there :)

Thanks again Vincent. I'll attach the new patch ASAP

Best Regards,
Seifeddine


                
      was (Author: sdridi):
    > Why should the test for difference be > 0 only? A negative difference is 
ok as long as the adjustment ratio is >= -1.
Good point! Thanks for pointing it out

> Creating a new KnuthPenalty for every alternative is not ideal. It should be 
> created once and stored in the alternative.
Why do you say that? I don't create a KnuthPenalty for every alternative.

> alternativeManager will work only if there is only one extension in the 
> document. If there are more, they will be mixed up in the same instance (see 
> multiple-feasible-nodes.fo).

Where can I find multiple-feasible-nodes.fo? I couldn't find it the examples 
directory.

> The calcFullContentLength shouldn’t be necessary: you can probably call 
> SpaceResolver.resolveElementList first and then use the standard 
> calcContentLength method.
I tried it before but it didn't work.

> if there’s no room on the page, the content will be unconditionally put on 
> the next page. Is that what you want? I suppose this aspect is still work in 
> progress.
If there 0 space left on the current page, then the content will be put on the 
next page. I'm going to leave it like that for now.

> validateChildNode: I don’t think you want to check elements in the fox 
> namespace. If you start like this you might as well check for elements in the 
> SVG namespace, and the MathML namespace, etc. Some generic, all-purpose 
> solution would have to be devised to check foreign elements, but this is 
> getting off-topic.
-> Well, I did it because I don't want nested alternative-block or best-fit. I 
understand your point but what else can I do to prevent the user from messing 
it up? Maybe the best way would be something like this:
        if (FOX_URI.equals(nsURI)) {
            if ("best-fit".equals(localName) || 
"alternative-block".equals(localName)) {
                invalidChildError(loc, FOX_URI, localName);
            }
        } else {
            invalidChildError(loc, nsURI, localName);
        }
                
> addChildArea: not sure if the test curBlockArea != null is necessary, since 
> it is initialized in getParentArea. Also, IIUC you are going to deal with 
> block areas only, as per the definition of fox:alternative-block
-> For now yes, but later I would like alternative-block to have all sort of 
formatting objects as childs, not just FO blocks.

there is code duplicated from other LMs. This is fine for now, but eventually 
it would be good to remove that duplication from all the LMs. We can get back 
to that later.
-> You have no idea how much I resent code duplication, but I just couldn't 
help it there :)

Thanks again Vincent. I'll attach the new patch ASAP

Best Regards,
Seifeddine


                  
> Whitespace management extension
> -------------------------------
>
>                 Key: FOP-2293
>                 URL: https://issues.apache.org/jira/browse/FOP-2293
>             Project: Fop
>          Issue Type: New Feature
>          Components: general
>    Affects Versions: trunk
>            Reporter: Seifeddine Dridi
>            Priority: Minor
>              Labels: XSL-FO
>             Fix For: trunk
>
>         Attachments: bestfit.fo, doc.pdf, multiple-feasible-nodes.fo, 
> patch.patch
>
>
> I have been working on an extension for whitespace management, similar to 
> what's described here: 
> http://wiki.apache.org/xmlgraphics-fop/WhitespaceManagement
> The logic of the extension is very simple: the user defines a set of 
> alternatives that he wishes to insert at the end of a page, then if there is 
> enough space left, FOP will pick the alternative that best matches the user's 
> selection criteria (first fit, smallest fit, biggest fit).
> This is my first work on FOP and it took me almost 2 months to reach this 
> stage in development. But it's not the end of course, so I'm relying on your 
> feedback to improve it.
> Thank you

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to