How to use the svg2ttf function in svg2ttf

To help you get started, we’ve selected a few svg2ttf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github algolia / algoliasearch-client-css / scripts / demo / generate-font.js View on Github external
svg2ttf(filepath) {
    const output = filepath.replace('.svg', '.ttf');

    const svg = fs.readFileSync(filepath, 'utf-8');
    fs.writeFileSync(output, new Buffer(svg2ttf(svg).buffer));
    return Promise.resolve(output);
  },
github itgalaxy / webfont / src / standalone.js View on Github external
function toTtf(buffer, options) {
  return Buffer.from(svg2ttf(buffer, options).buffer);
}
github entria / font-generator / src / svgToTTF.js View on Github external
const generateTTFfromSVGFont = (svgFont: string, options: Object) => {
  const font = svg2ttf(svgFont, options.formatOptions.ttf);

  return new Buffer(font.buffer);
};
github kiwicom / orbit-components / config / createSVGFont.js View on Github external
createSVG().then(() => {
  const TTF_PATH = path.join(ORBIT_ICONS_DIR, "orbit-icons.ttf");

  const TTF = svg2ttf(fs.readFileSync(path.join(ORBIT_ICONS_DIR, "orbit-icons.svg"), "utf8"), {});
  fs.writeFileSync(TTF_PATH, Buffer.from(TTF.buffer));

  fs.writeFileSync(
    path.join(ORBIT_ICONS_DIR, "orbit-icons.woff2"),
    ttf2woff2(fs.readFileSync(TTF_PATH)),
  );
});
github eugene1g / font-blast / src / verify.js View on Github external
function generateVerifyFile(svgFont: string, iconSet, withPng, toFolder) {
  //Convert the SVG file into a TTF file so that more browsers can parse and show it
  const ttf = svg2ttf(svgFont, {});
  fs.writeFileSync(
    path.join(toFolder, "source-font.ttf"),
    new Buffer(ttf.buffer)
  );

  //load the template for the verification file which contains some generic HTML
  let htmlTemplate = fs.readFileSync(
    path.join(__dirname, "..", "/resources/verify.html"),
    "utf-8"
  );
  let iconContent = [];
  let cssRules = [];

  //Add a header to to the table
  iconContent.push(
    `<div class="row"></div>