Menu

#2 function to set font weight

open
nobody
5
2007-09-23
2007-09-23
Gordon
No

font color and font style have functions, but nothing for font weight (normal or bold).

(in wt_vector.js, wtText)

/**
Sets the font weight of the text
@param {String} _weight The font style ( normal, bold )
*/
wtText.prototype.setFontWeight = function(_weight)
{
_weight = _weight.toLowerCase();
if (!(_weight == "normal" || _weight == "bold"))
throw "wtText::setFontWeight(): the font weight should be 'normal' or 'bold'";

var domNode = $_(this);
if (isMSIE())
{
this.get("divNode").get("style").fontWeight = _weight;
}
else
{
domNode.setAttribute("font-weight",_weight);
}
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.