Connecting fonts, which sources fit, the text classes and replacing the fonts.
Koobiq uses the Inter and JetBrains Mono fonts by default.
| Font | Weights |
|---|---|
| Inter | 400, 500, 600, 700; italic — 400 and 600 |
| JetBrains Mono | 400, 600, 700 |
Fonts come from npm packages or from files the application hosts itself. Google Fonts does not fit: it serves the fonts without some of the symbols, and Inter also without the OpenType features the tokens enable — the slashed zero, for example, does not appear.
Both fonts are installed from npm: inter-ui and @fontsource/jetbrains-mono.
npm install inter-ui @fontsource/jetbrains-monoFrom inter-ui, inter.css is the one that fits: it has the whole font — Cyrillic, the special symbols and the OpenType features. inter-latin.css has neither Cyrillic nor some of the symbols, and inter-variable.css declares the InterVariable family, which the tokens do not name.
@fontsource/jetbrains-mono is built from the Google Fonts files and has no box-drawing characters or arrows (├ ─ →): the browser takes them from the next font of --kbq-font-family-mono. If the interface shows them, JetBrains Mono is self-hosted.
The stylesheets go to the styles array of angular.json:
"styles": [
"node_modules/inter-ui/inter.css",
"node_modules/@fontsource/jetbrains-mono/400.css",
"node_modules/@fontsource/jetbrains-mono/600.css",
"node_modules/@fontsource/jetbrains-mono/700.css",
"src/styles.css"
]Inter is downloaded from rsms.me: the web folder of the archive holds the files and a ready-made inter.css. The folder is copied into the project, for example to src/fonts/inter.
JetBrains Mono is downloaded from the font release: the fonts/webfonts folder of the archive has the files but no stylesheet. The folder is copied into the project, for example to src/fonts/jetbrains-mono, and jetbrains-mono.css next to the files is written by hand — one @font-face rule per weight, with the family name the tokens use:
@font-face {
font-family: 'JetBrains Mono';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('JetBrainsMono-Regular.woff2') format('woff2');
}The 600 and 700 weights take JetBrainsMono-SemiBold.woff2 and JetBrainsMono-Bold.woff2. Both stylesheets go to styles:
"styles": [
"src/fonts/inter/inter.css",
"src/fonts/jetbrains-mono/jetbrains-mono.css",
"src/styles.css"
]Inter and JetBrains Mono from any other source — a package, a build or a CDN — are checked before connecting: the files must contain the characters the interface shows, and Inter also the OpenType features the tokens enable: calt, case, kern, liga, ss01, ss04, tnum and zero. A subset may lack both, depending on how it was built. The unicode-range descriptor only tells the browser which characters to request the file for, not which characters the file contains.
Text is styled with the ready-made classes, such as kbq-headline and kbq-text-normal; every class is listed in the design tokens. A class sets the family, size, line height, letter spacing, weight, italic, text transform and OpenType features from the variables of its level, such as --kbq-typography-text-normal-font-size. The variables are for adjusting a single property, not for assembling a text style of your own.
The classes come with the prebuilt theme; a theme built from the SCSS mixins adds them with koobiq-typography().
<h2 class="kbq-headline">Heading</h2>
<p class="kbq-text-normal">Interface text</p>The families are set by three global variables: --kbq-font-family-base for interface text, --kbq-font-family-accent for headings and display styles, --kbq-font-family-mono for code. Overriding them changes the fonts across the interface. The override is declared after the token stylesheets — for example in src/styles.css, which comes after them in styles — otherwise the token values apply.
:root {
--kbq-font-family-base: 'MySans', sans-serif;
--kbq-font-family-accent: 'MyDisplay', 'MySans', sans-serif;
--kbq-font-family-mono: 'MyMono', monospace;
}The OpenType features of the text styles stay on with another font. ss01 and ss04 are Inter's stylistic sets and switch on other glyphs in another font, so they are checked, or the --kbq-typography-*-font-feature-settings variables are overridden as well.