The following fonts are loaded automatically as web fonts with Secure Shell.
In addition, Powerline symbol fonts are bundled and loaded as web fonts for:
The fonts are stored in the gs://chromeos-localmirror/secureshell/distfiles/ bucket and downloaded as part of the mkdeps
build script. See nassh/bin/fonts and nassh/bin/fonts_create_bundle.
Powerline glyphs are included for the fonts listed above. The fonts were created using Nerd Fonts which uses FontForge python scripting.
Powerline uses 6 or so symbol glyphs such as anchor, pencil, arrows, and 7 glyphs in the unicode Private Use Area starting at U+E0A0. Another 30 or so ‘Powerline Extra Smbols’ have been defined in the same PUA block which have been included.
The typical way of using Powerline fonts, is to patch glyphs into an existing font file (e.g. NotoSansMono-Regular.ttf
). This seems to also be the common way they are used for the web. Our approach is different, to only generate the Powerline glyphs in a separate *.woff2
web font, and then list both fonts in the css font list.
@font-face { font-family: 'Noto Sans Mono'; src: url('../fonts/NotoSansMono-Regular.woff2') format('woff2'); } @font-face { font-family: 'Powerline For Noto Sans Mono'; src: url('../fonts/PowerlineForNotoSansMono.woff2') format('woff2'); unicode-range: U+2693,U+270E,U+2714,U+273C,U+2B06-2B07,U+E0A0-E0D4; } body { font-family: 'Noto Sans Mono', 'Powerline for Noto Sans Mono'; }
While the same Powerline glyphs are used for each web font, they must be sized to match the height and width of the corresponding monospaced font they are being used with.
NotoSansMono-Regular.ttf
from https://github.com/googlefonts/noto-fonts/blob/HEAD/hinted/NotoSansMono.sudo apt install fontforge
.git clone https://github.com/ryanoasis/nerd-fonts.git
.git apply 0001-Generate-Powerline-fonts-for-nassh.patch
.woff2_compress
- git clone https://github.com/google/woff2.git
. Follow instructions to build. It may also require https://github.com/google/brotli.git
.PowerlineForNotoSansMono.sfd
. Values for width and height must be copied from the actual font into this file before we use nerd fonts to patch it. Set font name fields in Element > Font Info > PS Names
.Element > Font Info > General
Copy values across.Element > Font Info > OS/2 > Metrics
Copy values across. You might need to experiment with the different values to get Powerline glyphs which match the correct height.Metrics > Set Width
and enter the width. This glyph is empty, which is fine. The nerd-fonts patching script will use this information to patch the empty font file and produce glyphs of the correct width and height.for f in PowerlineFor*.sfd; do fontforge -script ~/work/nerd-fonts/font-patcher --powerline --powerlineextra -ext ttf $f; done
.PowerlineForNotoSansMono.ttf
.for f in PowerlineFor*.ttf; do ~/work/woff2/out/woff2_compress $f; done
.PowerlineForNotoSansMono.woff2
file is used.