-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
21 changed files
with
253 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
*.html | ||
*.css | ||
!src/assets/base.css | ||
!src/assets/main.css | ||
!src/assets/font-*.css | ||
!stories/story.css | ||
|
||
**/generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import * as fsSync from 'node:fs' | ||
import * as fs from 'node:fs/promises' | ||
import * as https from 'node:https' | ||
import tar from 'tar' | ||
import bz2 from 'unbzip2-stream' | ||
|
||
const ENSO_FONT_URL = 'https://github.com/enso-org/font/releases/download/1.0/enso-font-1.0.tar.gz' | ||
const MPLUS1_FONT_URL = | ||
'https://github.com/coz-m/MPLUS_FONTS/raw/71d438c798d063cc6fdae8d2864bc48f2d3d06ad/fonts/ttf/MPLUS1%5Bwght%5D.ttf' | ||
const DEJAVU_SANS_MONO_FONT_URL = | ||
'https://sourceforge.net/projects/dejavu/files/dejavu/2.37/dejavu-fonts-ttf-2.37.tar.bz2' | ||
|
||
/** @param {string | https.RequestOptions | URL} options | ||
* @param {((res: import('node:http').IncomingMessage) => void) | undefined} [callback] */ | ||
function httpsGet(options, callback) { | ||
return https.get(options, (response) => { | ||
const location = response.headers.location | ||
if (location) { | ||
httpsGet( | ||
typeof options === 'string' || options instanceof URL | ||
? location | ||
: { ...options, ...new URL(location) }, | ||
callback, | ||
) | ||
} else { | ||
callback?.(response) | ||
} | ||
}) | ||
} | ||
|
||
console.info('Downloading Enso font...') | ||
await fs.rm('./public/font-enso/', { recursive: true, force: true }) | ||
await fs.mkdir('./public/font-enso/', { recursive: true }) | ||
await new Promise((resolve, reject) => { | ||
httpsGet(ENSO_FONT_URL, (response) => { | ||
response.pipe( | ||
tar.extract({ | ||
cwd: './public/font-enso/', | ||
strip: 1, | ||
filter(path) { | ||
// Reject files starting with `.`. | ||
return !/[\\/][.]/.test(path) | ||
}, | ||
}), | ||
) | ||
response.on('end', resolve) | ||
response.on('error', reject) | ||
}) | ||
}) | ||
console.info('Downloading M PLUS 1 font...') | ||
await fs.rm('./public/font-mplus1/', { recursive: true, force: true }) | ||
await fs.mkdir('./public/font-mplus1/', { recursive: true }) | ||
await new Promise((resolve, reject) => { | ||
httpsGet(MPLUS1_FONT_URL, (response) => { | ||
response.pipe(fsSync.createWriteStream('./public/font-mplus1/MPLUS1.ttf')) | ||
response.on('end', resolve) | ||
response.on('error', reject) | ||
}) | ||
}) | ||
console.info('Downloading DejaVu Sans Mono font...') | ||
await fs.rm('./public/font-dejavu/', { recursive: true, force: true }) | ||
await fs.mkdir('./public/font-dejavu/', { recursive: true }) | ||
await new Promise((resolve, reject) => { | ||
httpsGet(DEJAVU_SANS_MONO_FONT_URL, (response) => { | ||
response.pipe(bz2()).pipe( | ||
tar.extract({ | ||
cwd: './public/font-dejavu/', | ||
strip: 2, | ||
filter(path) { | ||
return /[\\/]DejaVuSansMono/.test(path) || !/Oblique[.]ttf$/.test(path) | ||
}, | ||
}), | ||
) | ||
response.on('end', resolve) | ||
response.on('error', reject) | ||
}) | ||
}) | ||
console.info('Done.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@font-face { | ||
font-family: 'DejaVu Sans Mono'; | ||
src: url('/font-dejavu/DejaVuSansMono.ttf'); | ||
font-weight: 400; | ||
} | ||
|
||
@font-face { | ||
font-family: 'DejaVu Sans Mono'; | ||
src: url('/font-dejavu/DejaVuSansMono-Bold.ttf'); | ||
font-weight: 700; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
@font-face { | ||
font-family: 'Enso'; | ||
src: url('/font-enso/Enso-Thin.ttf'); | ||
font-weight: 100; | ||
} | ||
|
||
@font-face { | ||
font-family: 'Enso'; | ||
src: url('/font-enso/Enso-ExtraLight.ttf'); | ||
font-weight: 200; | ||
} | ||
|
||
@font-face { | ||
font-family: 'Enso'; | ||
src: url('/font-enso/Enso-Light.ttf'); | ||
font-weight: 300; | ||
} | ||
|
||
@font-face { | ||
font-family: 'Enso'; | ||
src: url('/font-enso/Enso-Regular.ttf'); | ||
font-weight: 400; | ||
} | ||
|
||
@font-face { | ||
font-family: 'Enso'; | ||
src: url('/font-enso/Enso-Medium.ttf'); | ||
font-weight: 500; | ||
} | ||
|
||
@font-face { | ||
font-family: 'Enso'; | ||
src: url('/font-enso/Enso-SemiBold.ttf'); | ||
font-weight: 600; | ||
} | ||
|
||
@font-face { | ||
font-family: 'Enso'; | ||
src: url('/font-enso/Enso-Bold.ttf'); | ||
font-weight: 700; | ||
} | ||
|
||
@font-face { | ||
font-family: 'Enso'; | ||
src: url('/font-enso/Enso-ExtraBold.ttf'); | ||
font-weight: 800; | ||
} | ||
|
||
@font-face { | ||
font-family: 'Enso'; | ||
src: url('/font-enso/Enso-Black.ttf'); | ||
font-weight: 900; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@font-face { | ||
font-family: 'M PLUS 1'; | ||
src: url('/font-mplus1/MPLUS1.ttf'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.