Getting Metadata | API Solution for Node.js

How to read the font metadata from name table?

Aspose.Font for Node.js lets unlock the hidden information within fonts. Here’s how to access the treasures stored in the TrueType or OpenType name table:

  1. Use the AsposeFontGetInfo function. This function serves as your key to unlocking the font metadata.

  2. Each piece of information within the name table is represented by a specific record. Aspose.Font provides enumerations to help you identify these record values. The function itself will even return the names of these enumerations for clarity.

  3. To precisely access the data you need, you’ll use several parameters:

Examples of getting metadata

  1. Run the AsposeFontGetInfo function.
  2. In case the json.errorCode is 0, you can get the result data. When the json.errorCode parameter is not equal to 0 and, accordingly, you will receive an error in your file, then information about such an error will be contained in the json.errorText.
  3. The resulting json object contains records array. Each record contains fields NameId, PlatformId, PlatformSpecificId, LanguageId, Info with information from name table of font.
 1    const AsposeFont = require('asposefontnodejs');
 2
 3    const font_file = "./fonts/12380_C0_0.cff";
 4
 5    console.log('Aspose.Font for Node.js via C++ example');
 6
 7    AsposeFont().then(AsposeFontModule => {
 8
 9        //AsposeFontGetInfo - get metadata information
10        const json = AsposeFontModule.AsposeFontGetInfo(font_file);
11        console.log("AsposeFontGetInfo => %O",  json.errorCode == 0 ? json.records.reduce((ret, a) => ret +
12            "\nNameId : " + a.NameId
13            + "; PlatformId : " + a.PlatformId
14            + "; PlatformSpecificId : " + a.PlatformSpecificId
15            + "; LanguageId : " + a.LanguageId
16            + "; Info : " + a.Info,"") : json.errorText);
17
18    },
19        reason => {console.log(`The unknown error has occurred: ${reason}`);}
20    );

How to get the solution?

To get the Solution, go to Aspose.Font for Node.js product page. It will give you more information about the benefits. You can download a free trial from or buy the product there.

If you have any troubles or questions left, feel free to post them at the Aspose.Font.Product Family section of the Free Support Forum and within a few hours our support team will clear everything up for you.

Also, check our Font Metadata cross-platform application to understand the functionality completely and the way API can be used for creating your own app.

Have any questions about Aspose.Font?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.