dnm-font-manager
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -264,6 +264,10 @@ 'use strict'; | ||
var found = []; | ||
var missing = []; | ||
for (var n = 0; n < search.length; n++) { | ||
var found_font = false; | ||
var family = search[n].family; | ||
for (var i = 0; i < fonts.length; i++) { | ||
if (search[n].family === fonts[i].family) { | ||
var foundFiles = null; | ||
if (family === fonts[i].family) { | ||
found_font = true; | ||
var style = search[n].style; | ||
@@ -275,9 +279,19 @@ var files = fonts[i].files; | ||
for (var s = 0; s < style.length; s++) { | ||
if (!foundFiles) foundFiles = {}; | ||
if (files[style[s]]) foundFiles[style[s]] = files[style[s]]; | ||
var return_font = { | ||
family: family, | ||
style: style[s] | ||
}; | ||
if (files[style[s]]) { | ||
return_font.file = files[style[s]]; | ||
found.push(return_font); | ||
} else missing.push(return_font); | ||
} | ||
} else foundFiles = files; | ||
if (foundFiles !== null) { | ||
search[n].files = foundFiles; | ||
found.push(search[n]); | ||
} else { | ||
for (var key in files) { | ||
found.push({ | ||
family: family, | ||
style: key, | ||
file: files[key] | ||
}); | ||
} | ||
} | ||
@@ -287,4 +301,5 @@ break; | ||
} | ||
if (!found_font) missing.push({ family: family }); | ||
} | ||
return found; | ||
return { found: found, missing: missing }; | ||
}; | ||
@@ -291,0 +306,0 @@ |
{ | ||
"name": "dnm-font-manager", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Search system fonts with family and style using pure JavaScript, forked from rBurgett/system-font-families", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
@@ -42,2 +42,5 @@ # dnm-font-manager | ||
style: "Regular" | ||
}, | ||
{ | ||
family: "Arial" | ||
} | ||
@@ -58,2 +61,5 @@ ] | ||
### Work In Progress | ||
Method to check if a font is installed, and install it if not. | ||
### npm Scripts | ||
@@ -60,0 +66,0 @@ Run the tests: |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
101169
268
83