first commit
This commit is contained in:
28
build/node_modules/parse-bmfont-xml/lib/parse-attribs.js
generated
vendored
Normal file
28
build/node_modules/parse-bmfont-xml/lib/parse-attribs.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
//Some versions of GlyphDesigner have a typo
|
||||
//that causes some bugs with parsing.
|
||||
//Need to confirm with recent version of the software
|
||||
//to see whether this is still an issue or not.
|
||||
var GLYPH_DESIGNER_ERROR = 'chasrset'
|
||||
|
||||
module.exports = function parseAttributes(obj) {
|
||||
if (GLYPH_DESIGNER_ERROR in obj) {
|
||||
obj['charset'] = obj[GLYPH_DESIGNER_ERROR]
|
||||
delete obj[GLYPH_DESIGNER_ERROR]
|
||||
}
|
||||
|
||||
for (var k in obj) {
|
||||
if (k === 'face' || k === 'charset')
|
||||
continue
|
||||
else if (k === 'padding' || k === 'spacing')
|
||||
obj[k] = parseIntList(obj[k])
|
||||
else
|
||||
obj[k] = parseInt(obj[k], 10)
|
||||
}
|
||||
return obj
|
||||
}
|
||||
|
||||
function parseIntList(data) {
|
||||
return data.split(',').map(function(val) {
|
||||
return parseInt(val, 10)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user