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 Peter Kullmann <p....@arenae.ch> on 2002/06/23 14:56:48 UTC

Implementation of margin shorthand

Hi,

I'm new to FOP development and tried to implement the margin shorthand
to get started (working in the fop-0_20_2-maintain branch).

- foproperties.xml is changed to reflect that margin-top etc can be set
by the margin shorthand and the margin property is changed from
ToBeImplemented to List using a new shorthand parser.

- MarginShorthandParser is new and resembles the GenericShorthandParser.
I think it implements to fo spec correctly. The spec says (in 7.29.14)
for the margin shorthand: 

No. of    | Set margin-* property to arg
arguments | top  | right  | bottom  | left
------------------------------------------
1         |    1 |      1 |       1 |    1
2         |    1 |      2 |       1 |    2
3         |    1 |      2 |       3 |    2
4         |    1 |      2 |       3 |    4

Some remarks:
- The MarginShorthandParser could possibly be generalized to handle
other properties using the same syntax in a
shorthand-{top,right,bottom,left} context. I'm not sure whether there
are such properties (candidates are padding and border-width but these
are handled already in a specialized parser).
- Is it really sensible to have a MarginShorthandParser or could this be
handled elsewhere, e.g. directly in the MarginMaker? 
- I didn't add an error message in the case of a wrong number of
parameters (eg margin="0in 5pt 5pt 5pt 24pt").

Please use the code if you think it's ok and otherwise please tell me
what's not ok with it.


Peter