I am working on the parameter loading code for svgfonts. Some attributes of the font-face tag are specified to behave in special ways when not set. One example is this couple of attribute:
accent-height = "<number>" The distance from the origin to the top of accent characters, measured by a distance within the font coordinate system. If the attribute is not specified, the effect is as if the attribute were set to the value of the ascent attribute. If this attribute is used, the units-per-em attribute must also be specified. Animatable: no. ascent = "<number>" Same syntax and semantics as the 'ascent' descriptor within an @font-face rule. The maximum unaccented height of the font within the font coordinate system. If the attribute is not specified, the effect is as if the attribute were set to the difference between the units- per-em value and the vert-origin-y value for the corresponding font. Animatable: no.
Is there already a established good practice to deal with this kind of thing on the inkscape codebase?
I suppose that a good solution would be to implement a container template-class which would take care of the set/unset state of the stored object (in these cases, a double) and a method to compute the nonset value, sometimes refering to the value of other objects. In these cases, it would refer to an ascent object for the computation of a not-set accent-height attribute and both vert-origin-y and units-per-em objects for the computation of a not-set ascent attribute.
Am I right? Does this already exist on the codebase? Should I implement it this way?
Juca