AsposeFontSetInfo

AsposeFontSetInfo function

Setze Informationen (Metadaten) in eine Font-Datei.

function AsposeFontSetInfo(
    fileName,
    nameId, 
    platformId, 
    platformSpecificId, 
    languageId, 
    text
)
ParameterTypBeschreibung
fileNamestringDateiname.
nameIdTtfNameTableNameIdNamensidentifikator, logische Zeichenkettenkategorie, angegeben durch die Aufzählung NameId
platformIdTtfNameTablePlatformId
platformSpecificIdintPlattform-spezifischer Codierungsidentifikator. Bitte verwenden Sie einen Wert aus einer der folgenden Aufzählungen – UnicodePlatformSpecificId, MacPlatformSpecificId, MSPlatformSpecificId. Welche Aufzählung zu verwenden ist, wird durch den Kontext (platformId‑Parameter) bestimmt.
languageIdintSprachidentifikator. Bitte verwenden Sie einen Wert aus der Aufzählung MSLanguageId oder MacLanguageId, abhängig vom Kontext, definiert durch den platformId‑Parameter.
Textstring

Rückgabewert

JSON-Objekt

FeldBeschreibung
errorCode
errorText
fileNameResult

Beispiele

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);

Siehe auch