version 1.156, 2002/07/16 13:51:34
|
version 1.157, 2002/08/20 13:38:24
|
Line 1275 void CheckMTable (Element elMTABLE, Docu
|
Line 1275 void CheckMTable (Element elMTABLE, Docu
|
void SetFontstyleAttr (Element el, Document doc) |
void SetFontstyleAttr (Element el, Document doc) |
{ |
{ |
ElementType elType; |
ElementType elType; |
AttributeType attrType; |
AttributeType attrType, attrType1; |
Attribute attr, IntAttr; |
Attribute attr, IntAttr; |
Element textEl; |
Element ancestor, textEl; |
int len; |
int len; |
char *value; |
char *value; |
ThotBool italic; |
ThotBool italic; |
|
|
if (el != NULL) |
if (el != NULL) |
{ |
{ |
/* search the fontstyle attribute */ |
/* search the (deprecated) fontstyle attribute or the mathvariant |
|
attribute on the element and its ancestors */ |
elType = TtaGetElementType (el); |
elType = TtaGetElementType (el); |
attrType.AttrSSchema = elType.ElSSchema; |
attrType.AttrSSchema = elType.ElSSchema; |
attrType.AttrTypeNum = MathML_ATTR_fontstyle; |
attrType.AttrTypeNum = MathML_ATTR_fontstyle; |
attr = TtaGetAttribute (el, attrType); |
attrType1.AttrSSchema = elType.ElSSchema; |
|
attrType1.AttrTypeNum = MathML_ATTR_mathvariant; |
|
ancestor = el; |
|
attr = NULL; |
|
do |
|
{ |
|
attr = TtaGetAttribute (ancestor, attrType); |
|
if (!attr) |
|
attr = TtaGetAttribute (ancestor, attrType1); |
|
if (!attr) |
|
{ |
|
ancestor = TtaGetParent (ancestor); |
|
if (ancestor) |
|
{ |
|
elType = TtaGetElementType (ancestor); |
|
if (elType.ElSSchema != attrType.AttrSSchema) |
|
/* this ancestor is not in the MathML namespace */ |
|
ancestor = NULL; |
|
} |
|
} |
|
} |
|
while (ancestor && !attr); |
|
|
attrType.AttrTypeNum = MathML_ATTR_IntFontstyle; |
attrType.AttrTypeNum = MathML_ATTR_IntFontstyle; |
IntAttr = TtaGetAttribute (el, attrType); |
IntAttr = TtaGetAttribute (el, attrType); |
if (attr != NULL) |
if (attr != NULL) |
/* there is a fontstyle attribute. Remove the corresponding |
/* there is a fontstyle or mathvariant attribute. Remove the |
internal attribute that is not needed */ |
IntFontstyle internal attribute that is not needed */ |
{ |
{ |
if (IntAttr != NULL) |
if (IntAttr != NULL) |
TtaRemoveAttribute (el, IntAttr, doc); |
TtaRemoveAttribute (el, IntAttr, doc); |
} |
} |
else |
else |
/* there is no fontstyle attribute. Create an internal attribute |
/* there is no fontstyle or mathvariant attribute. Create an internal |
IntFontstyle with a value that depends on the content of the MI */ |
IntFontstyle attribute with a value that depends on the content of |
|
the MI element */ |
{ |
{ |
/* get content length */ |
/* get content length */ |
len = TtaGetElementVolume (el); |
len = TtaGetElementVolume (el); |