Add Nerd Font icon fallback to the Terminal so Starship-style prompts render correctly
Bundles Symbols Nerd Font Mono (MIT, ryanoasis/nerd-fonts) as a glyph-only @font-face and appends it to every Terminal font-family option, so distro icons / git branch glyphs / etc. from prompts like Starship show up instead of broken-glyph boxes. It carries no letterforms, so it never changes how normal text renders.
This commit is contained in:
parent
9372767443
commit
f41b700904
5 changed files with 38 additions and 4 deletions
21
public/fonts/NERD-FONTS-LICENSE.txt
Normal file
21
public/fonts/NERD-FONTS-LICENSE.txt
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Ryan L McIntyre
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
BIN
public/fonts/SymbolsNerdFontMono-Regular.woff2
Normal file
BIN
public/fonts/SymbolsNerdFontMono-Regular.woff2
Normal file
Binary file not shown.
|
|
@ -1,5 +1,13 @@
|
|||
@import "tailwindcss";
|
||||
|
||||
@font-face {
|
||||
font-family: 'Symbols Nerd Font Mono';
|
||||
src: url('/fonts/SymbolsNerdFontMono-Regular.woff2') format('woff2');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@theme {
|
||||
--color-page: #0D0E10;
|
||||
--color-card: #141518;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export interface TabState {
|
|||
const PREFS_KEY = 'archnest-terminal-prefs'
|
||||
|
||||
export function defaultPrefs(): TerminalPrefs {
|
||||
return { themeName: TERM_THEMES[0].name, fontSize: 13, fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace' }
|
||||
return { themeName: TERM_THEMES[0].name, fontSize: 13, fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace, "Symbols Nerd Font Mono"' }
|
||||
}
|
||||
|
||||
export function loadPrefs(): TerminalPrefs {
|
||||
|
|
|
|||
|
|
@ -8,10 +8,15 @@ const GOLD = '#C8A434'
|
|||
const TEXT_SECONDARY = '#7A7D85'
|
||||
|
||||
const FONT_SIZES = [11, 12, 13, 14, 15, 16]
|
||||
// "Symbols Nerd Font Mono" is appended as a glyph-only fallback to every option, so
|
||||
// distro icons / git branch / etc. from prompts like Starship render instead of
|
||||
// showing as boxes — it has no letterforms of its own, so it never overrides the
|
||||
// chosen base font for normal text.
|
||||
const NERD_FALLBACK = '"Symbols Nerd Font Mono"'
|
||||
const FONT_FAMILIES = [
|
||||
{ name: 'Monospace', value: 'ui-monospace, SFMono-Regular, Menlo, monospace' },
|
||||
{ name: 'Fira Code', value: '"Fira Code", ui-monospace, monospace' },
|
||||
{ name: 'JetBrains Mono', value: '"JetBrains Mono", ui-monospace, monospace' },
|
||||
{ name: 'Monospace', value: `ui-monospace, SFMono-Regular, Menlo, monospace, ${NERD_FALLBACK}` },
|
||||
{ name: 'Fira Code', value: `"Fira Code", ui-monospace, monospace, ${NERD_FALLBACK}` },
|
||||
{ name: 'JetBrains Mono', value: `"JetBrains Mono", ui-monospace, monospace, ${NERD_FALLBACK}` },
|
||||
]
|
||||
|
||||
export default function Terminal() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue