Skip to content

Commit f7a72a7

Browse files
haseciluFinii
andauthoredSep 20, 2024··
Add script to generate NF lib file (#142)
Add script to generate NF lib file Also remove some spaces on Codeberg line on icons.tsv file Update scripts/create_nf_lib.sh Replace "U" with "u", change sequence format Co-authored-by: Fini <ulf.fini.jastrow@desy.de>
1 parent 4855f0d commit f7a72a7

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed
 

‎icons.tsv

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ offset name id
4747
45 Solus solus
4848
46 Void void
4949
47 Zorin OS zorin
50-
48 Codeberg codeberg
50+
48 Codeberg codeberg
5151
49 KDE Neon kde-neon
5252
50 KDE Plasma kde-plasma
5353
51 Kubuntu kubuntu

‎scripts/create_nf_lib.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
# Convert the icons.tsv file's data to Nerd Font lib's format
4+
# to update their lib file with the new glyphs.
5+
# Usage: ./create_lib.sh
6+
# Copy missing glyphs from the output to the
7+
# <PATH>/nerd-fonts/bin/scripts/lib/i_logos.sh file.
8+
9+
# Get script directory to set file path relative to it
10+
file_path="$(
11+
cd -- "$(dirname "${0}")" >/dev/null 2>&1 || exit
12+
pwd -P
13+
)/../icons.tsv"
14+
15+
# Read the tsv file excluding the header
16+
sed '1d' "${file_path}" | while IFS=$'\t' read -r offset _ classname; do
17+
# Calculate the codepoint, font-logos starts at 0xF300
18+
codepoint=$((0xF300 + offset))
19+
# Get the glyph from the codepoint
20+
glyph=$(printf "\\u%x" "${codepoint}" 2>/dev/null)
21+
# Print line using the Nerd Fonts lib's format
22+
printf "i='%b' i_linux_%s=\$i\n" "${glyph}" "${classname}"
23+
done

0 commit comments

Comments
 (0)
Please sign in to comment.