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) } }; }; };