Current File : /home/tradevaly/www/node_modules/fontkit/base.js.map |
{"version":3,"file":null,"sources":["src/base.js"],"sourcesContent":["import r from 'restructure';\nconst fs = require('fs');\n\nvar fontkit = {};\nexport default fontkit;\n\nfontkit.logErrors = false;\n\nlet formats = [];\nfontkit.registerFormat = function(format) {\n formats.push(format);\n};\n\nfontkit.openSync = function(filename, postscriptName) {\n let buffer = fs.readFileSync(filename);\n return fontkit.create(buffer, postscriptName);\n};\n\nfontkit.open = function(filename, postscriptName, callback) {\n if (typeof postscriptName === 'function') {\n callback = postscriptName;\n postscriptName = null;\n }\n\n fs.readFile(filename, function(err, buffer) {\n if (err) { return callback(err); }\n\n try {\n var font = fontkit.create(buffer, postscriptName);\n } catch (e) {\n return callback(e);\n }\n\n return callback(null, font);\n });\n\n return;\n};\n\nfontkit.create = function(buffer, postscriptName) {\n for (let i = 0; i < formats.length; i++) {\n let format = formats[i];\n if (format.probe(buffer)) {\n let font = new format(new r.DecodeStream(buffer));\n if (postscriptName) {\n return font.getFont(postscriptName);\n }\n\n return font;\n }\n }\n\n throw new Error('Unknown font format');\n};\n\nfontkit.defaultLanguage = 'en';\nfontkit.setDefaultLanguage = function(lang = 'en') {\n fontkit.defaultLanguage = lang;\n};"],"names":["fs","require","fontkit","logErrors","formats","registerFormat","format","push","openSync","filename","postscriptName","buffer","readFileSync","create","open","callback","readFile","err","font","e","i","length","probe","r","DecodeStream","getFont","Error","defaultLanguage","setDefaultLanguage","lang"],"mappings":";;;;;;AACA,IAAMA,KAAKC,QAAQ,IAAR,CAAX;;AAEA,IAAIC,UAAU,EAAd;AACA,AAEAA,QAAQC,SAAR,GAAoB,KAApB;;AAEA,IAAIC,UAAU,EAAd;AACAF,QAAQG,cAAR,GAAyB,UAASC,MAAT,EAAiB;UAChCC,IAAR,CAAaD,MAAb;CADF;;AAIAJ,QAAQM,QAAR,GAAmB,UAASC,QAAT,EAAmBC,cAAnB,EAAmC;MAChDC,SAASX,GAAGY,YAAH,CAAgBH,QAAhB,C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