Guest User

Untitled

a guest
Jun 19th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 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.  
  12. CharacterElement.prototype = {
  13. setBBox: function( charAttr ) {
  14. // precompute the bounding box coordinates for the
  15. // character
  16. this.bbox = {
  17. ul: {
  18. x: this.x,
  19. y: this.y + (charAttr.attr.font_size * charAttr.attr.leading) + (charAttr.attr.font_size * charAttr.attr.ascent)
  20. },
  21. ur: {
  22. x: this.x + this.width,
  23. y: this.y + (charAttr.attr.font_size * charAttr.attr.ascent)
  24. },
  25. ll: {
  26. x: this.x,
  27. y: this.y - (charAttr.attr.font_size * charAttr.attr.descent)
  28. },
  29. lr: {
  30. x: this.x + this.width,
  31. y: this.y - (charAttr.attr.font_size * charAttr.attr.descent)
  32. }
  33. };
  34.  
  35. }
  36. };
Add Comment
Please, Sign In to add comment