GitHub - node-migrator-bot/font: Parse otf/ttf file format directory from buffers for metadata
Work in progress but it currently reads a lot of info already.
var font = require('font'); // get an array of fonts from the OS's font directory font.listFonts(); // loads a file from either the font directory or a full path font.loadFont('filename.ttf') // the constructor and prototype font.Font
{ filename: 'DejaVuSansMono.ttf', name: 'DejaVuSansMono', index: { version: 'TrueType', tableCount: 18, range: 256, selector: 4, shift: 32 }, tables: [ { tag: 'FFTM', checksum: 1407076357, contents: { type: ‹VoidPtr›, address: 300 }, length: 28 }, { tag: 'GDEF', checksum: 2053270988, contents: { type: ‹VoidPtr›, address: 328 }, length: 176 }, { tag: 'GPOS', checksum: 1094198046, contents: { type: ‹VoidPtr›, address: 504 }, length: 14582 }, { tag: 'GSUB', checksum: 1445877738, contents: { type: ‹VoidPtr›, address: 15088 }, length: 1212 }, { tag: 'OS/2', checksum: 2298243506, contents: { version: 1, avgCharWidth: 1233, weightClass: 'Semi-light', widthClass: 'Medium', typer: 0, subscript: { size: { width: 1331, height: 1433 }, position: { x: 0, y: 286 } }, superscript: { size: { width: 1331, height: 1433 }, position: { x: 0, y: 983 } }, strikeout: { size: 102, position: 530 }, class: [ 0, 0 ], panose: { familyType: [ 'Script' ], serifStyle: [ 'Cove', 'Obtuse Cove', 'Obtuse Square Cove' ], weight: [ 'Light', 'Thin' ], proportion: [ 'Old Style', 'Expanded' ], contrast: [ 'None', 'Very Low' ], strokeVariation: [ 'Gradual/Horizontal' ], armStyle: [ 'Straight Arms/Vertical' ], letterform: [ 'Normal/Weighted' ], midline: [ 'Standard/Pointed' ], xHeight: [ 'Constant/Large' ] }, unicodePages: [ 'Alphabetic Presentation Forms', 'Arabic ', 'Arabic Presentation Forms-B', 'Arabic Supplement', 'Arrows ', 'Basic Latin', 'Block Elements ', 'Box Drawing', 'Combining Diacritical Marks', 'Combining Diacritical Marks Supplement ', 'Control Pictures ', 'Currency Symbols ', 'Cyrillic ', 'Cyrillic Extended-A', 'Cyrillic Extended-B', 'Cyrillic Supplement', 'Dingbats ', 'Geometric Shapes ', 'Georgian ', 'Georgian Supplement', 'Greek Extended ', 'Greek and Coptic ', 'IPA Extensions ', 'Lao', 'Latin Extended Additional', 'Latin Extended-A ', 'Latin Extended-B ', 'Latin Extended-C ', 'Latin Extended-D ', 'Latin-1 Supplement ', 'Letterlike Symbols ', 'Mathematical Alphanumeric Symbols', 'Mathematical Operators ', 'Miscellaneous Mathematical Symbols-A ', 'Miscellaneous Mathematical Symbols-B ', 'Miscellaneous Symbols', 'Miscellaneous Symbols and Arrows ', 'Miscellaneous Technical', 'Modifier Tone Letters', 'Non-Plane 0 *', 'Number Forms ', 'Phonetic Extensions', 'Phonetic Extensions Supplement ', 'Private Use Area (plane 0) ', 'Spacing Modifier Letters ', 'Specials ', 'Superscripts And Subscripts', 'Supplemental Arrows-A', 'Supplemental Arrows-B', 'Supplemental Mathematical Operators' ], vendorID: 'PfEd', selection: 64, firstChar: 32, lastChar: 65535, typographic: { ascender: 1556, descender: -492, lineGap: 410 }, winTypograph: { ascender: 1901, descender: 483 }, codePages1: [ '0', 'Latin 1', 'Latin 2: Eastern Europe', 'Cyrillic', 'Greek', 'Turkish', 'Arabic', 'Windows Baltic', 'Vietnamese', 'Macintosh Character Set (US Roman)', 'OEM Character Set' ], codePages2: [ 'IBM Greek', 'MS-DOS Russian', 'MS-DOS Nordic', 'Arabic', 'MS-DOS Canadian French', 'MS-DOS Icelandic', 'MS-DOS Portuguese', 'IBM Turkish', 'IBM Cyrillic; primarily Russian', 'Latin 2', 'MS-DOS Baltic', 'Greek; former 437 G', 'WE/Latin 1' ], xHeight: 0, capHeight: 0, defaultChar: 5, breakChar: 0, maxContext: 3 }, length: 86 }, { tag: 'cmap', checksum: 230425762, contents: { type: ‹VoidPtr›, address: 16388 }, length: 5538 }, { tag: 'cvt ', checksum: 3918989068, contents: { type: ‹VoidPtr›, address: 21928 }, length: 560 }, { tag: 'fpgm', checksum: 1526885343, contents: { type: ‹VoidPtr›, address: 22488 }, length: 172 }, { tag: 'gasp', checksum: 458759, contents: { type: ‹VoidPtr›, address: 22660 }, length: 12 }, { tag: 'glyf', checksum: 1883368785, contents: { type: ‹VoidPtr›, address: 22672 }, length: 239352 }, { tag: 'head', checksum: 3992135760, contents: { version: '0100', fontRevision: 150732, checkSumAdj: 2633691831, magicNumber: 1594834165, flags: 31, unitsPerEm: 2048, created: Thu Aug 27 2009 10:28:40 GMT-0400 (US Eastern Daylight Time), modified: Thu Aug 27 2009 10:28:40 GMT-0400 (US Eastern Daylight Time), min: { x: -1142, y: -767 }, max: { x: 1470, y: 2133 }, macStyle: 0, lowestRecPPEM: 8, fontDirHint: 0, indexToLocFormat: 1, glyphDataFormat: 0 }, length: 54 }, { tag: 'hhea', checksum: 146276871, contents: { type: ‹VoidPtr›, address: 262080 }, length: 36 }, { tag: 'hmtx', checksum: 243468867, contents: { type: ‹VoidPtr›, address: 262116 }, length: 6346 }, { tag: 'loca', checksum: 362015968, contents: { type: ‹VoidPtr›, address: 268464 }, length: 12680 }, { tag: 'maxp', checksum: 302449703, contents: { type: ‹VoidPtr›, address: 281144 }, length: 32 }, { tag: 'name', checksum: 1625352837, contents: { type: ‹VoidPtr›, address: 281176 }, length: 8469 }, { tag: 'post', checksum: 2878182796, contents: { type: ‹VoidPtr›, address: 289648 }, length: 30055 }, { tag: 'prep', checksum: 986169351, contents: { type: ‹VoidPtr›, address: 319704 }, length: 1819 } ] }