
Untitled
By: a guest on
Feb 26th, 2012 | syntax:
None | size: 0.85 KB | hits: 19 | expires: Never
var CharacterElement = function(locChar) {
this.x = null;
this.y = null;
this.width = null;
this.dy = null;
this.value = (locChar !== null) ? locChar : "";
this.se_newline = "";
this.characterAttribute = null;
this.bbox = null;
this.setBBox = function( charAttr ) {
// precompute the bounding box coordinates for the
// character
this.bbox = {
ul: {
x: this.x,
y: this.y + (charAttr.attr.font_size * charAttr.attr.leading) + (charAttr.attr.font_size * charAttr.attr.ascent)
},
ur: {
x: this.x + this.width,
y: this.y + (charAttr.attr.font_size * charAttr.attr.ascent)
},
ll: {
x: this.x,
y: this.y - (charAttr.attr.font_size * charAttr.attr.descent)
},
lr: {
x: this.x + this.width,
y: this.y - (charAttr.attr.font_size * charAttr.attr.descent)
}
};
};
};