Skip to content

Latest commit

 

History

History
65 lines (43 loc) · 2.17 KB

FONTS.md

File metadata and controls

65 lines (43 loc) · 2.17 KB

Fonts API

Get template available fonts

Retrieves template available fonts.

const RenderforestClient = require('@renderforest/sdk-node')

const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 })

Renderforest.getTemplateAvailableFonts(1021)
  .then(console.log) // handle the success
  .catch(console.error) // handle the error

See example

getTemplateAvailabeFonts function returns an object containing all fonts. The returned object has getFontById method which accepts fontId parameter. getFontId method returns flattened font.

Be careful: setFonts() project data instance setter accepts only flattened font.

const primaryFont = fonts.getFontById(256) // returns flatten font with tuned character size

Now the flatten font can be used as parameter for setFonts setter in project data instance.

See setFonts() setter in project data

Get own fonts

Retrieves own fonts.

const RenderforestClient = require('@renderforest/sdk-node')

const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 })

Renderforest.getOwnFonts()
  .then(console.log) // handle the success
  .catch(console.error) // handle the error

See example

getOwnFonts function returns an object containing own fonts. In contrast with template fonts, own font object contains path parameter which is the url of the font file. The returned object has getFontById method which accepts fontId parameter. getFontId method returns flattened font.

Be careful: setFonts() project data instance setter accepts only flattened font.

const primaryFont = fonts.getFontById(256) // returns flatten font with tuned character size

Now the flatten font can be used as parameter for setFonts setter in project data instance.

See setFonts() setter in project data

⬆ back to the top