AsposeFontSetInfo
AsposeFontSetInfo function
Ställ in information (metadata) i en fontfil.
function AsposeFontSetInfo(
fileName,
nameId,
platformId,
platformSpecificId,
languageId,
text
)
| Parameter | Typ | Beskrivning |
|---|---|---|
| fileName | string | Filnamn. |
| nameId | TtfNameTableNameId | Namnidentifierare, logisk strängkategori, specificerad av NameId‑enumerationen |
| platformId | TtfNameTablePlatformId | |
| platformSpecificId | int | Plattformspecifik kodningsidentifierare. Använd ett värde från någon av dessa enumerationer – UnicodePlatformSpecificId, MacPlatformSpecificId, MSPlatformSpecificId. Vilken enumeration som ska användas bestäms av kontext (platformId parameter). |
| languageId | int | Språkidentifierare. Använd ett värde från MSLanguageId eller MacLanguageId‑enumerationerna beroende på kontext, definierad av platformId-parametern. |
| text | string |
Returvärde
JSON-objekt
| Fält | Beskrivning |
|---|---|
| errorCode | |
| errorText | |
| fileNameResult |
Exempel
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);