[usf-devel] Full Style Inheritance
- From: Luca Della Santina <lucads@xxxxxxxx>
- To: USF devels <usf-devel@xxxxxxxxxxxxx>
- Date: Mon, 15 Aug 2005 11:39:04 +0200
The current USF specifications defines the possibility to use
inheritance for styles.
Every style inherits from the "default" style (the player's default one
or the one redefined in the script ).
*Proposal*
Allow full inheritance of styles, not limited to the "Default" ancestor
only, but extended to custom ancestors.
A new attribute called "ancestor" is introduced for the <style> element,
this attribute specifies the name of the ancestor style, a style avaible
in the script.
Default value for "ancestor" attribute is "Default".
Fallback: If the specified ancestor style is not found in the script,
then the default one is used.
In this way a hierarchy of styles becomes like this:
<styles>
<style name="Default" >
<fontstyle face="Arial" size="24" color="#EEEEFF"
outline-color="#5555FF"/>
<position alignment="BottomCenter" vertical-margin="10%"
relative-to="Window"/>
</style>
<style name="MyAncesorStyle">
<fontstyle face="Times New Roman" size="10" color="#FFFF00FF"
outline-color="#FF000000"/>
<position alignment="BottomCenter" vertical-margin="10%"
relative-to="Window"/>
</style>
<style name="MyInheritedStyleRed" ancestor="MyAncestorStyle">
<fontstyle color="#FFFF0000"/>
</style>
<style name="MyInheritedStyleBold" ancestor="MyAncestorStyle">
<fontstyle weight="bold"/>
</style>
<style name="MyInheritedStyleRedBold" ancestor="MyInheritedStyleRed">
<fontstyle weight="bold"/>
</style>
</styles>
Main advantages:
1) Drastically reduced overhead for similar styles.
2) Grouping of styles into hierarchies (rationalization).
3) Better code readability.
4) Easy hierarchy-change operation (to make MyXXXStyleBold is sufficient
to copy&paste MyInheritedStyleBold content into the style of the new
hierarchy)
5) Since this is an optional attribute, retrocompatibility with old
scripts is ensured.
6) Easy to implement in current applications since they already have to
support inheritance from the default style (it is just a generalization).
Comments to this proposal are welcome and encouraged.
Regards, Kaiousama.
http://usf.corecodec.org
Other related posts:
- » [usf-devel] Full Style Inheritance