Skip to content

Commit 1e6fcee

Browse files
author
Krystle Salazar
committed
Add Vocabulary fonts
1 parent 76662ca commit 1e6fcee

5 files changed

+34
-0
lines changed

api/_fonts/RobotoCondensed-Bold.woff2

15.3 KB
Binary file not shown.
15.4 KB
Binary file not shown.

api/_fonts/SourceSansPro-Bold.woff2

15.4 KB
Binary file not shown.
15.7 KB
Binary file not shown.

api/_lib/template.ts

+34
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
import { readFileSync } from 'fs';
12
import marked from 'marked'
23
import { sanitizeHtml } from './sanitizer'
34
import { ParsedRequest } from './types'
45
const twemoji = require('twemoji')
56
const twOptions = { folder: 'svg', ext: '.svg' }
67
const emojify = (text: string) => twemoji.parse(text, twOptions)
78

9+
const sourceRglr = readFileSync(`${__dirname}/../_fonts/SourceSansPro-Regular.woff2`).toString('base64');
10+
const sourceBold = readFileSync(`${__dirname}/../_fonts/SourceSansPro-Bold.woff2`).toString('base64');
11+
const robotoRglr = readFileSync(`${__dirname}/../_fonts/RobotoCondensed-Regular.woff2`).toString('base64');
12+
const robotoBold = readFileSync(`${__dirname}/../_fonts/RobotoCondensed-Bold.woff2`).toString('base64');
13+
814
function getCss(theme: string, fontSize: string) {
915
let background = 'white'
1016
let foreground = 'black'
@@ -16,6 +22,34 @@ function getCss(theme: string, fontSize: string) {
1622
radial = 'dimgray'
1723
}
1824
return `
25+
@font-face {
26+
font-family: 'Source Sans Pro';
27+
font-style: normal;
28+
font-weight: normal;
29+
src: url(data:font/woff2;charset=utf-8;base64,${sourceRglr}) format('woff2');
30+
}
31+
32+
@font-face {
33+
font-family: 'Source Sans Pro';
34+
font-style: normal;
35+
font-weight: bold;
36+
src: url(data:font/woff2;charset=utf-8;base64,${sourceBold}) format('woff2');
37+
}
38+
39+
@font-face {
40+
font-family: 'Roboto Condensed';
41+
font-style: normal;
42+
font-weight: normal;
43+
src: url(data:font/woff2;charset=utf-8;base64,${robotoRglr}) format('woff2');
44+
}
45+
46+
@font-face {
47+
font-family: 'Roboto Condensed';
48+
font-style: normal;
49+
font-weight: bold;
50+
src: url(data:font/woff2;charset=utf-8;base64,${robotoBold}) format('woff2');
51+
}
52+
1953
body {
2054
background: ${background};
2155
background-image: radial-gradient(circle at 25px 25px, ${radial} 2%, transparent 0%), radial-gradient(circle at 75px 75px, ${radial} 2%, transparent 0%);

0 commit comments

Comments
 (0)