AsposeFontSetInfo

AsposeFontSetInfo function

Set info (metadata) into a Font-file.

function AsposeFontSetInfo(
    fileName,
    nameId, 
    platformId, 
    platformSpecificId, 
    languageId, 
    text
)
ParameterTypeDescription
fileNamestringFile name.
nameIdTtfNameTableNameIdName identifier, logical string category, specified by NameId enumeration
platformIdTtfNameTablePlatformIdPlatform identifier
platformSpecificIdintPlatform-specific encoding identifier. Please, use value from one of such enumerations - UnicodePlatformSpecificId, MacPlatformSpecificId, MSPlatformSpecificId. What enumeration to use is defined by context (platformId parameter)
languageIdintLanguage identifier. Please, use value from MSLanguageId or MacLanguageId enumerations depend from context, defined by platformId parameter.
textstringActual string data

Return Value

JSON object

FieldDescription
errorCodecode error (0 no error)
errorTexttext error ("" no error)
fileNameResultresult file name

Examples

Common js modules:

const AsposeFont = require('asposefontnodejs');

const font_file = "./fonts/Lora-Regular.ttf";

console.log("Aspose.Font for Node.js via C++ examples.");

AsposeFont().then(AsposeFontModule => {

    //AsposeSetInfo - set metadata info into font
    const nameId = AsposeFontModule.TtfNameTableNameId.Description;
    const platformId = AsposeFontModule.TtfNameTablePlatformId.Microsoft;
    const platformSpecificId = AsposeFontModule.TtfNameTableMSPlatformSpecificId.Unicode_BMP_UCS2.value;
    const langID = Module.TtfNameTableMSLanguageId.English_United_States.value;
    const text = "Updated description";
    
    const json = AsposeFontSetInfo(font_file, nameId, platformId, platformSpecificId, langID, text);
    console.log("AsposeFontSetInfo => %O",  json.errorCode == 0 ? json.fileNameResult : json.errorText);
});

ECMAScript\ES6 js modules::

import AsposeFont from 'asposefontnodejs';

const font_file ="./fonts/arial.ttf";

console.log('Aspose.Font for Node.js via C++ example');

const AsposeFontModule = await AsposeFont();

//AsposeSetInfo - set metadata info into font
const nameId = AsposeFontModule.TtfNameTableNameId.Description;
const platformId = AsposeFontModule.TtfNameTablePlatformId.Microsoft;
const platformSpecificId = AsposeFontModule.TtfNameTableMSPlatformSpecificId.Unicode_BMP_UCS2.value;
const langID = Module.TtfNameTableMSLanguageId.English_United_States.value;
const text = "Updated description";

const json = AsposeFontModule.AsposeFontSetInfo(font_file, nameId, platformId, platformSpecificId, langID, text);
console.log("AsposeFontSetInfo => %O",  json.errorCode == 0 ? json.fileNameResult : json.errorText);

See Also