Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'svgicons2svgfont' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
]).then(results => {
const baseGlyphsDirectory = results[0];
const boldGlyphsDirectory = results[1];
const characters = results[2];
const outputPath = './demo/public/fonts/Raleway.svg';
const deferred = Promise.pending();
const fontStream = svg2font({
fontName: 'Raleway',
normalize: true,
});
fontStream.pipe(fs.createWriteStream(outputPath))
.on('finish', () => { deferred.resolve(outputPath); })
.on('error', err => { deferred.reject(err); });
const privateSpaceStart = 58880; // \e6XX private space
_.each(characters, char => {
const baseCodePoint = char.charCodeAt(0);
const baseUnicodeCodePoint = baseCodePoint.toString(16);
const baseGlyphPath = `${baseGlyphsDirectory}svg/uni${baseUnicodeCodePoint}.svg`;
if (!fs.existsSync(baseGlyphPath)) {
console.info(`⚠ No glyph for ${char} (${baseGlyphPath})`);
return;
}
return new Promise((resolve, reject) => {
const fontStream = new SVGIcons2SVGFontStream({
ascent: options.ascent,
centerHorizontally: options.centerHorizontally,
descent: options.descent,
fixedWidth: options.fixedWidth,
fontHeight: options.fontHeight,
fontId: options.fontId,
fontName: options.fontName,
fontStyle: options.fontStyle,
fontWeight: options.fontWeight,
// eslint-disable-next-line no-console, no-empty-function
log: options.verbose ? console.log.bind(console) : () => {},
metadata: options.metadata,
normalize: options.normalize,
round: options.round
})
.on("finish", () => resolve(result))
function getGlyphsData(files, options) {
const metadataProvider =
options.metadataProvider ||
defaultMetadataProvider({
prependUnicode: options.prependUnicode,
startUnicode: options.startUnicode
});
const xmlParser = new xml2js.Parser();
const throttle = pLimit(options.maxConcurrency);
return Promise.all(
files.map(srcPath =>
throttle(
() =>
new Promise((resolve, reject) => {
const glyph = fs.createReadStream(srcPath);
let glyphContents = "";
return glyph
descent,
normalize,
round,
} = options;
const svgOptions = {
fontName,
fontHeight,
descent,
normalize,
round,
};
//svgOptions.log = () => {};
const fontStream = svgicons2svgfont(svgOptions)
.on('data', (data) => {
font = Buffer.concat([font, data])
})
.on('end', () => {
done(null, font.toString());
});
options.files.map((file, idx) => {
const glyph = fs.createReadStream(file);
const name = options.names[idx];
const unicode = String.fromCharCode(options.codepoints[name]);
glyph.metadata = {
name: name,
unicode: [unicode]
};
fontStream.write(glyph)
new Promise((resolve, reject) => {
if (!fs.existsSync(ORBIT_ICONS_DIR)) {
fs.mkdirSync(ORBIT_ICONS_DIR);
}
const fontStream = new SVGIcons2SVGFontStream({
fontName: "orbit-icons",
fontHeight: 1000,
normalize: true,
});
fontStream
.pipe(fs.createWriteStream(path.join(ORBIT_ICONS_DIR, "orbit-icons.svg")))
.on("finish", () => {
resolve();
})
.on("error", err => {
reject(err);
});
Object.keys(iconList).forEach(iconName => {
const iconPath =
? glyphsData.sort((fileA, fileB) =>
fileSorter(fileA.srcPath, fileB.srcPath)
)