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 Luca Furini <lf...@cs.unibo.it> on 2005/11/16 11:51:59 UTC

Illegal property values

While working on the implementation of hyphenation-ladder-count, I noticed 
that at the moment the property system can return "illegal" values 
coming from the fo file instead of the "fallback" value defined by the 
specs.

There are significant differences in wording between XSL 1.0 and 1.1: for 
example, concerning hyphenation-ladder-count 1.0 has (7.15.2):
"<integer> an integer greater than or equal to 1"

While 1.1 (7.16.2) reads:
"<number> an integer greater than or equal to 1. If a zero, negative, or 
non-integer value is provided, the value will be rounded to the nearest 
integer value greater than or equal to 1"

So, should the property be improperly set to -0.5:
- if we want to follow closely 1.0, we should stop with an error
- if we follow 1.1 we should continue using 1 instead, maybe with a 
warning message

There are other properties with a "validity range" and a fallback value: 
column-count, initial-page-number, column-number, number-columns-repeated, 
number-columns-spanned, number-rows-spanned, hyphenation-{push, 
remain}-character-count; only hyphenation-ladder-count does not have a 
fallback value in 1.0, so maybe this was just an oversight.
Note that the fallback value is different, in general, from the default 
value, as it is derived from the illegal value by rounding.

At the moment the layout process continues with the incorrect values, and 
this could create errors in several different places; for example a 
non-integer value would probably create an error if we assign it to an 
integer variable, a negative integer value could create an
IllegalArgumentException if we use it as the size of an array (this 
happens, for example, with a negative column-count) ...

Regards
     Luca

Re: Illegal property values

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Nov 16, 2005, at 19:24, Andreas L Delmelle wrote:

> On Nov 16, 2005, at 11:51, Luca Furini wrote:
>
>> <snip />
>> There are other properties with a "validity range" and a fallback  
>> value: column-count, initial-page-number, column-number, number- 
>> columns-repeated, number-columns-spanned, number-rows-spanned,  
>> hyphenation-{push, remain}-character-count; only hyphenation- 
>> ladder-count does not have a fallback value in 1.0, so maybe this  
>> was just an oversight.
>> Note that the fallback value is different, in general, from the  
>> default value, as it is derived from the illegal value by rounding.
>
> I guess we'll have to have a look at all these properties to see  
> how the fallbacks are dealt with.
> <snip/>
> I'll look into this as soon as I find some spare time.

I took another look, and none of the mentioned properties (with the  
exception of column-number) perform a validity check/provide a  
fallback. Haven't checked all applicable FObj's yet to see if the  
errors are reported there...

On another note, there are a few other number-properties for which  
bogus-values are currently allowed:
- orphans / widows: from the definition, one would say "positive  
integer" (?); any value allowed
- reference-orientation: only 7 possible values; any value is allowed.
- grouping-size: zero-or-positive; negatives are allowed
- maximum-repeats: zero-or-positive; negatives are allowed

Since grouping-size and maximum-repeats are applicable to only one or  
two types of FO, the fallback could easily be provided when the  
property is bound.
For reference-orientation, I'm still doubting... The values are  
numeric, but supposed to be treated as a sort of enum. Probably best  
off with a tiny custom Maker to avoid code duplication, and catch the  
error as early as possible.
For orphans and widows, the Rec doesn't explicitly state what to do  
with zero-or-negative values (neither does CSS) --maybe we could  
suffice with a warning message here (and a common-sense substitution  
with the initial value?)


Cheers,

Andreas


Re: Illegal property values

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Nov 16, 2005, at 11:51, Luca Furini wrote:

> <snip />
> There are other properties with a "validity range" and a fallback  
> value: column-count, initial-page-number, column-number, number- 
> columns-repeated, number-columns-spanned, number-rows-spanned,  
> hyphenation-{push, remain}-character-count; only hyphenation-ladder- 
> count does not have a fallback value in 1.0, so maybe this was just  
> an oversight.
> Note that the fallback value is different, in general, from the  
> default value, as it is derived from the illegal value by rounding.

I guess we'll have to have a look at all these properties to see how  
the fallbacks are dealt with.
I remember that, when I implemented the default value for the column- 
number property (+/- 2 months ago), the described fallback value in  
case of zero-or-negative values wasn't provided, but the "error" (=  
no error according to the Rec) was dealt with in the TableCell or  
TableColumn's bind() method. I coded this functionality into  
ColumnNumberPropertyMaker.get() [Didn't get around to rounding the  
value in case it's non-integer, since I wasn't sure how to check for  
that... there's still a TODO for that]

Anyway, it was quite straightforward to implement that logic into the  
Property system.
I'm thinking that, if this is shared by a number of properties, then  
the option should be investigated to abstract this out into a common  
Maker for the props in question.

I'll look into this as soon as I find some spare time.


Cheers,

Andreas