]> git.parisson.com Git - pdf.js.git/commitdiff
Be more generic for bold/italic rules
authorVivien Nicolas <21@vingtetun.org>
Sat, 10 Sep 2011 14:47:58 +0000 (16:47 +0200)
committerVivien Nicolas <21@vingtetun.org>
Sat, 10 Sep 2011 14:47:58 +0000 (16:47 +0200)
fonts.js

index 381f81018817333ac389485a5ea65b53b8557970..6759e853a4c1b2bde5449908d1e910453138502d 100755 (executable)
--- 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;