12.4.6 Characteristic Specification
Every characteristic is inherited unless it
is explicitly specified not to be in this International Standard.
For each inherited characteristic, there is an expression in this
International Standard
specifying the initial value for that characteristic.
Each non-inherited characteristic has a default value.
While a construct-expression is being evaluated,
a current overriding style is in effect.
When the processing of a node starts, the current overriding
style is empty.
The next-match procedure can change the current overriding
style during the evaluation of a construct-expression.
That construct-expression may, in turn, call next-match
to change the current overriding style, and so on.
The expression specifying an inherited characteristic
c
for a flow
object is determined when the
make-expression is evaluated using
the first of the following rules that is applicable:
- If a keyword of
force!
c
:
was specified, then the
corresponding expression shall be used. - If the current overriding style contains an expression for
c
,
then that expression shall be used. - If a keyword of
c
:
was specified, then the corresponding
expression shall be used. - If
use:
was specified on the flow object, and the corresponding
style object specifies an expression for
c
, then that
expression shall be used. - Otherwise, an expression
(inherited-
c
)
shall be used.
The set of characteristics and corresponding expressions
for a style object is determined in a similar manner
during the evaluation of the
style-expression.
For each inherited characteristic
c
, the expression
that the style object has for
c
is determined
using the first of the following rules that is applicable:
- If a keyword of
force!
c
:
was specified, then the
corresponding expression shall be used. - If the current overriding style contains an expression for
c
,
then that expression shall be used. - If a keyword of
c
:
was specified, then the corresponding
expression shall be used. - If
use:
was specified on the flow object, and the corresponding
style object specifies an expression for
c
, then that
expression shall be used.
If none of these rules are applicable, then the style object contains
no expression for
c
.
For each non-inherited characteristic
c
applicable to some
flow object,
if the make-expression for that flow object specifies
the
c
:
keyword, then the
corresponding expression shall be evaluated and used;
otherwise, the default for that characteristic shall be determined
as specified for that characteristic and flow object class.
The expression specifying the value of a characteristic
in a make-expression or style-expression
shall not be evaluated immediately;
instead the expression
shall be associated with the characteristic in the created flow object
or style object.
The values of the free variables
in the expression are remembered and are used
when the expression is evaluated,
as with a lambda expression.
The current node is also remembered and restored
for the evaluation of the expression.
When the flow object tree has been sufficiently constructed so
that the position of a flow object in the flow object
tree has been determined, then the expressions specifying the values for the
characteristics applicable to that flow object shall be evaluated.
An expression specifying the value of a characteristic shall be
evaluated with respect to two flow objects, which are referred to as
the value flow object and the specification flow object.
The value of a characteristic for a flow object
is determined by evaluating the expression specifying that characteristic
with both the value flow object and the specification flow object
equal to that flow object.
For any inherited characteristic,
c
, there is a procedure
inherited-
c
.
This procedure shall be used only in the evaluation of
an expression specifying a value for a characteristic.
The procedure returns the result of evaluating
the expression that specifies
c
for the flow parent of
the specification flow object; this expression is evaluated
with the value flow object unchanged and with the specification
flow object equal to the flow parent of the current specification flow
object.
If the current specification flow object has no flow parent
because it occurs as a characteristic value
of some flow object, then that flow object shall be treated
as the flow parent for this purpose.
If the current specification flow object has no flow parent
because it is used in a generate-specification
or a decoration-specification,
then the page-sequence or column-set-sequence flow object
that is using the page-model or column-set-model in
which that generate-specification or decoration-specification
occurs shall be treated as the flow parent for this purpose.
Otherwise, if the current specification flow object has no flow parent
then inherited-
c
returns the result of
evaluating the expression specifying the initial value of
c
;
there is no specification flow object during the
evaluation of this specification, and it shall be an error
if it calls inherited-
c
for any inherited characteristic
c
.
The procedure inherited-
c
behaves differently when:
- the flow parent of the specification flow object is a table or a table-part;
- the value flow object is a table-cell of that table or table-part
or is in a table-cell of that table or table-part; and
- the table or table-part contains a table-column flow object
that specifies
c
and has the same column number
as that table-cell.
In this case, inherited-
c
shall return the result of
evaluating the specification of
c
in the table-column; this
expression shall be evaluated with the value flow object unchanged and
with the specification flow object equal to the table flow object.
(actual-
c
)
For each inherited characteristic
c
, actual-
c
shall
return the value of
c
for the value flow object.
This procedure shall be used only in the evaluation of
an expression specifying a value for a characteristic.
It shall be an error to
call actual-
c
with a value flow object of
f
in the
course of determining the value of
c
for
f
. Use of this
procedure requires the
actual-characteristic
feature.
(char-script-case
string1
obj1
…
stringn-1
objn-1
objn
)
This procedure shall be used only in the evaluation of an expression
specifying a value for an inherited characteristic. There shall be an
odd number of arguments. All arguments other than the last shall be
interpreted as a series of pairs, where the first member of the pair
is a string specifying a public identifier, and the second member is
any object. If the value flow object is not a character flow object
or is a character flow object that has a script property
that is not #f, then char-script-case shall return its last
argument.
Otherwise, the value of the script characteristic shall be compared in
turn against the first member of each argument pair; if it matches, then
the second member shall be returned; if there is no match, then the last
argument shall be returned.
NOTE 45
For example, in formatting Japanese text, it is common to use
different fonts for the Katakana, Han, and Latin portions of the
text.
[182] application-characteristic-declaration =
(
declare-characteristic
identifier string expression
)
This declares
identifier to be an additional inherited
characteristic. It also has the effect of declaring procedures
inherited-
identifier
and actual-
identifier
.
The
string is a public identifier specifying the semantics of the
characteristic. If an implementation does not recognize the specified
public identifier, it shall ignore uses of the characteristic.
The
expression is the specification of the initial value of
the characteristic.
[183] application-char-characteristic+property-declaration =
(
declare-char-characteristic+property
identifier string
expression
)
This declares
identifier to be an additional non-inherited
characteristic of a character flow object and also declares
identifier to be an additional character property. The
string shall be a public identifier specifying the semantics of the
characteristic. The default value of the characteristic is the value
of the
identifier property of the character that is the value of
the
char:
characteristic of the flow object. The default value
of the property is the value of
expression. This expression
shall be
evaluated normally; it shall not be evaluated in the special way that
the values of characteristics are evaluated, nor shall it be evaluated
with respect to a current node.
[184] initial-value-declaration =
(
declare-initial-value
identifier expression
)
This declares the initial value of the inherited characteristic
identifier to be an expression.
This shall not be used for characteristics declared
with an application-characteristic-declaration.