Skip to content

Commit

Permalink
pretty and options
Browse files Browse the repository at this point in the history
  • Loading branch information
delphiactual committed Jun 12, 2024
1 parent 6d045f6 commit 7504b13
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Binary file modified output/DIMSymbols.woff2
Binary file not shown.
17 changes: 11 additions & 6 deletions src/generate-custom-glyph-enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import fse from 'fs-extra';

const { writeFileSync, unlinkSync } = fse;
const acc: Record<string, number> = {};
const TAG = "CUSTOM-GLYPHS"
const TAG = 'CUSTOM-GLYPHS';
const options = {
ts: 0,
description: 'generated by d2ai for Destiny Item Manager',
url: 'http://www.destinyitemmanager.com',
};

webfont({
files: './DIM-custom-font/SVGs/',
Expand All @@ -23,14 +28,14 @@ webfont({
})
.then((result) => {
const woffFile = './DIM-custom-font/DIM-Symbols.woff';
const woff2File = './output/DIMSymbols.woff2'
const woff2File = './output/DIMSymbols.woff2';
// loadSync requires .otf or .woff filetype for enumeration
const ttf = Buffer.from(svg2ttf(String(result.svg!), { ts: 0 }).buffer);
const ttf = Buffer.from(svg2ttf(String(result.svg!), options).buffer);
writeFileSync(woffFile, ttf2woff(ttf));
infoLog(TAG, `TEMP: ${woffFile} saved.`)
infoLog(TAG, `TEMP: ${woffFile} saved.`);
// Generate font format to be used by DIM
writeFileSync(woff2File, ttf2woff2(ttf));
infoLog(TAG, `${woff2File} saved.`)
infoLog(TAG, `${woff2File} saved.`);

const font = loadSync(woffFile);

Expand All @@ -51,7 +56,7 @@ webfont({
writeFile('./data/dim-custom-symbols.ts', outputEnum);
// no need to keep this temp file
unlinkSync(woffFile);
infoLog(TAG, `TEMP: ${woffFile} removed.`)
infoLog(TAG, `TEMP: ${woffFile} removed.`);
})
.catch((error) => {
throw error;
Expand Down

0 comments on commit 7504b13

Please sign in to comment.