diff --git a/extensions/lab/text.js b/extensions/lab/text.js index 3de1468535..799ae78bdb 100644 --- a/extensions/lab/text.js +++ b/extensions/lab/text.js @@ -222,7 +222,7 @@ } _getFontStyle () { - return `${this.calculatedFontSize}px "${this.fontFamily}", sans-serif`; + return `${this.calculatedFontSize}px ${this.fontFamily}, sans-serif`; } _reflowText () { @@ -883,6 +883,22 @@ }; } + getFonts () { + const customFonts = Scratch.vm.runtime.fontManager ? Scratch.vm.runtime.fontManager.getFonts().map(i => ({ + text: i.name, + value: i.family + })) : []; + + return [ + ...FONTS, + ...customFonts, + { + text: 'random font', + value: 'Random' + } + ]; + } + /** * @param {VM.Target} target * @returns {TextState} @@ -934,16 +950,6 @@ target.setCostume(target.currentCostume); } - getFonts () { - return [ - ...FONTS, - { - text: 'random font', - value: 'Random' - } - ]; - } - setText ({ TEXT }, util) { const state = this._getState(util.target); this._renderText(util.target, state);