Permalink
Browse files

Extract a function for setting the default face

  • Loading branch information...
rhburrows committed Jul 1, 2011
1 parent 18e42df commit a57c44b35e7dedbd14a6b3f4f0aa4cf53d28a266
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/display.js
View
@@ -1,5 +1,12 @@
(function($){
+ function defaultFace() {
+ return new Face({
+ family : 'Monaco',
+ size : 14
+ });
+ }
+
function Display(width, height) {
this.canvas = document.createElement('canvas');
$(this.canvas).attr('width', '' + width + 'px');
@@ -12,7 +19,7 @@
this.context = this.canvas.getContext('2d');
this.padding = 20;
this.faces = [];
- this.defaultFace = new Face({ family : 'Monaco', size : 14 });
+ this.defaultFace = defaultFace();
applyFace(this, this.defaultFace);
// Used for line wrapping. Messy? Yes
this.lineLengths = [];

0 comments on commit a57c44b

Please sign in to comment.