From 6a518d53febf4f974d81370a01a708219e829a98 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Sat, 10 Sep 2011 16:47:58 +0200 Subject: [PATCH] Be more generic for bold/italic rules --- fonts.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fonts.js b/fonts.js index 381f81018..6759e853a 100755 --- a/fonts.js +++ b/fonts.js @@ -479,13 +479,13 @@ var Font = (function Font() { // The file data is not specified. Trying to fix the font name // to be used with the canvas.font. var fontName = stdFontMap[name] || name.replace('_', '-'); - this.bold = (fontName.indexOf('Bold') != -1); - this.italic = (fontName.indexOf('Oblique') != -1) || - (fontName.indexOf('Italic') != -1); + this.bold = (fontName.search(/bold/gi) != -1); + this.italic = (fontName.search(/oblique/gi) != -1) || + (fontName.search(/italic/gi) != -1); // Use 'name' instead of 'fontName' here because the original // name ArialBlack for example will be replaced by Helvetica. - this.black = (name.indexOf("Black") != -1) + this.black = (name.search(/Black/g) != -1) this.loadedName = fontName.split('-')[0]; this.loading = false;