diff --git a/src/ol/renderer/canvas/canvasvectorrenderer.js b/src/ol/renderer/canvas/canvasvectorrenderer.js index 02d4924b3c..183412b679 100644 --- a/src/ol/renderer/canvas/canvasvectorrenderer.js +++ b/src/ol/renderer/canvas/canvasvectorrenderer.js @@ -272,22 +272,12 @@ ol.renderer.canvas.VectorRenderer.prototype.renderPointFeatures_ = ol.renderer.canvas.VectorRenderer.prototype.renderText_ = function(features, text, texts) { var context = this.context_, - fontArray = [], - color = text.color, vecs, vec; - if (color) { - context.fillStyle = color; - } - if (goog.isDef(text.fontSize)) { - fontArray.push(text.fontSize + 'px'); - } - if (goog.isDef(text.fontFamily)) { - fontArray.push(text.fontFamily); - } - if (fontArray.length) { - context.font = fontArray.join(' '); + if (context.fillStyle !== text.color) { + context.fillStyle = text.color; } + context.font = text.fontSize + 'px ' + text.fontFamily; context.globalAlpha = text.opacity; // TODO: make alignments configurable diff --git a/src/ol/style/text.js b/src/ol/style/text.js index 0ffa64d391..200ce377b3 100644 --- a/src/ol/style/text.js +++ b/src/ol/style/text.js @@ -26,18 +26,13 @@ ol.style.TextLiteralOptions; */ ol.style.TextLiteral = function(options) { + goog.asserts.assertString(options.color, 'color must be a string'); /** @type {string} */ this.color = options.color; - if (goog.isDef(options.color)) { - goog.asserts.assertString(options.color, 'color must be a string'); - } + goog.asserts.assertString(options.fontFamily, 'fontFamily must be a string'); /** @type {string} */ this.fontFamily = options.fontFamily; - if (goog.isDef(options.fontFamily)) { - goog.asserts.assertString(options.fontFamily, - 'fontFamily must be a string'); - } goog.asserts.assertNumber(options.fontSize, 'fontSize must be a number'); /** @type {number} */