Skip to content

Instantly share code, notes, and snippets.

@elijahmanor
Created March 19, 2023 19:28
Show Gist options
  • Save elijahmanor/c10e5787bf9ac6b8c276e47e6745826c to your computer and use it in GitHub Desktop.
Save elijahmanor/c10e5787bf9ac6b8c276e47e6745826c to your computer and use it in GitHub Desktop.
Font Smoke Test
#/bin/bash
echo "Normal"
echo "\033[1mBold\033[22m"
echo "\033[3mItalic\033[23m"
echo "\033[3;1mBold Italic\033[0m"
echo "\033[4mUnderline\033[24m"
echo "== === !== >= <= =>"
echo "契     勒 鈴 "
@Grazfather
Copy link

I needed -e for the ansi escape codes to work

@msmafra
Copy link

msmafra commented Apr 28, 2023

Also, for me, the "-e" was a requirement. So I decide to replace echo with printf since it is more portable and added the usually said as best practices crash bang.

#!/usr/bin/env bash

printf "%b\n" "Normal"
printf "%b\n" "\033[1mBold\033[22m"
printf "%b\n" "\033[3mItalic\033[23m"
printf "%b\n" "\033[3;1mBold Italic\033[0m"
printf "%b\n" "\033[4mUnderline\033[24m"
printf "%b\n" "== === !== >= <= =>"
printf "%b\n" "契          勒 鈴 "

Edit
A better one, printf "%b" can be replaced with echo -e, if desired:

#!/usr/bin/env bash

smoke_tests="Normal
\033[1mBold\033[22m
\033[3mItalic\033[23m
\033[3;1mBold Italic\033[0m
\033[4mUnderline\033[24m
== === !== >= <= =>
契          勒 鈴 "

printf "%b" "${smoke_tests}"

@marcohc79
Copy link

Hi,
Hello, I have problems with these characters in my kitty. I see that the "Nerd Fonts - Material Design Icons" fails. I installed the sources from the Fedora repo but I'm still on.
image
Sorry, if this is not the place for the query.

@cpjobling
Copy link

I had some missing fonts and used nerdfix to find alternatives.

Here is the revised script, with corrected UTF codes. It is based on @msmafra's revised version of smoke-test.sh

#!/usr/bin/env bash

smoke_tests="Normal
\033[1mBold\033[22m
\033[3mItalic\033[23m
\033[3;1mBold Italic\033[0m
\033[4mUnderline\033[24m
== === !== >= <= =>
󰐊     󰄉      󰑓 󰒲 "


printf "%b" "${smoke_tests}"

@HaleTom
Copy link

HaleTom commented Jul 19, 2023

zsh indicates that there's a \n missing at the end of the printed output.

@doyonm
Copy link

doyonm commented Aug 19, 2023

The bang is missing in #!

@workflow
Copy link

workflow commented Mar 29, 2024

Some of the icon codepoints have since changed on nerdfonts (March 2024), here's the updated string:

   "     󰾆      󱑥 󰒲 󰗼"

@manikantateja973
Copy link

Some of the icon codepoints have since changed on nerdfonts (March 2024), here's the updated string:

   "     󰾆      󱑥 󰒲 󰗼"

Thanks

@msmafra
Copy link

msmafra commented Apr 4, 2024

#!/usr/bin/env bash

smoke_tests="Normal
\033[1mBold\033[22m
\033[3mItalic\033[23m
\033[3;1mBold Italic\033[0m
\033[4mUnderline\033[24m
== === !== >= <= =>
Nerdfont
         󰾆      󰢻   󱑥   󰒲   󰗼   
Fontawesome Free
                           

"


printf "%b" "${smoke_tests}"

@jagdishadusumalli
Copy link

hi @msmafra
Thanks for the fix you gave for smoke-test.sh
i was also testing the test-fonts.sh script at
https://github.com/ryanoasis/nerd-fonts/blob/master/bin/scripts/test-fonts.sh

When i ran it, its does not show any icons and shows hex codes for all symbols
Not even a single symbol is getting rendered
I am using the JetBrainsMono Nerd Font in ITerm
See the screenshot

Screenshot 2024-07-05 at 1 07 09 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment