Property Function Tests - p.
Property Function Tests
Function: object from-parent( NCName)
The from-parent function returns a computed value of the property
whose name matches the argument specified. The value returned is that
for the parent of the formatting object for which the expression is
evaluated. If there is no parent, the value returned is the initial
value. If the argument specifies a shorthand property and if the
expression only consists of the from-parent function with an argument
matching the property being computed, it is interpreted as an
expansion of the shorthand with each property into which the shorthand
expands, each having a value of from-parent with an argument matching
the property. It is an error if arguments matching a shorthand
property are used in any other way.
Here is a nested block with font-size =
from-parent(font-size) - 2pt.
Since its parent has font-size=12pt, that should mean 10pt. It should
keep the line height of 1.25em, which means 12.5pt leading. It's
space-before value is set to the space-after value from its
parent. Note that neither of these are inheritable. Does it look right?
Here is a nested block with text 2pt larger than its parent (that
should be 14pt). This parent is indented 1cm on both start and end
directions with respect to the values from its parent (which aren't
specified, so they default to 0.0). The color is set to 50% (using the
rgb function with % arguements, and the background color for this
block is black (specified as a keyword). In this block, we'll put an
inline object
whose background and foreground colors invert those of its containing
block. This uses the inherited-property-value
function. Here's an inline
object with fixed colors (black on white). That doesn't
work either. Guess it's not my problem... So let's try it with font
sizes. In this block, we'll put an
inline
object whose font-size is 2 pt bigger than its parent's font-size.
An outer block with 12 pt text on 14 pt leading, default color
and 50% grey background color. Test inherited color changes with
nested blocks.
Interchange color and background color using from-parent function.