Guest User

Untitled

a guest
Feb 26th, 2012
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. var CharacterElement = function(locChar) {
  2. this.x = null;
  3. this.y = null;
  4. this.width = null;
  5. this.dy = null;
  6. this.value = (locChar !== null) ? locChar : "";
  7. this.se_newline = "";
  8. this.characterAttribute = null;
  9. this.bbox = null;
  10.  
  11. this.setBBox = function( charAttr ) {
  12. // precompute the bounding box coordinates for the
  13. // character
  14. this.bbox = {
  15. ul: {
  16. x: this.x,
  17. y: this.y + (charAttr.attr.font_size * charAttr.attr.leading) + (charAttr.attr.font_size * charAttr.attr.ascent)
  18. },
  19. ur: {
  20. x: this.x + this.width,
  21. y: this.y + (charAttr.attr.font_size * charAttr.attr.ascent)
  22. },
  23. ll: {
  24. x: this.x,
  25. y: this.y - (charAttr.attr.font_size * charAttr.attr.descent)
  26. },
  27. lr: {
  28. x: this.x + this.width,
  29. y: this.y - (charAttr.attr.font_size * charAttr.attr.descent)
  30. }
  31. };
  32.  
  33. };
  34.  
  35. };
Add Comment
Please, Sign In to add comment