From 775763a0914e93ae0075004aaf62314c7091e99c Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 8 Jul 2018 21:36:20 +0200 Subject: [PATCH] Ensure that `CompiledFont.compileGlyph` always returns an Array (PR 6141 follow-up) PR 6141 changed `CompiledFont.compileGlyph` to, in the general case, return an Array. However, that PR apparenly forgot to update the no-glyph, empty-glyph, and endchar-glyph code-path and a String was still being (incorrectly) returned. Given the way that `FontFaceObject.getPathGenerator` (on the API side) is implemented, this shouldn't have caused any bugs despite the Worker possible returning unexpected data. --- src/core/font_renderer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js index 366037787..8e078f672 100644 --- a/src/core/font_renderer.js +++ b/src/core/font_renderer.js @@ -616,7 +616,7 @@ var FontRendererFactory = (function FontRendererFactoryClosure() { parse(code); } - var noop = ''; + const NOOP = []; function CompiledFont(fontMatrix) { this.compiledGlyphs = Object.create(null); @@ -639,7 +639,7 @@ var FontRendererFactory = (function FontRendererFactoryClosure() { compileGlyph(code, glyphId) { if (!code || code.length === 0 || code[0] === 14) { - return noop; + return NOOP; } let fontMatrix = this.fontMatrix;