Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix glyphnames in released fonts #1758

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,13 @@ jobs:
fontforge --version
fontforge --version 2>&1 | grep libfontforge | awk '{print $NF}'

- name: Bump version for source files
- name: Bump version for source files and update glyphnames.json
# and check if generated glyphnames.json is valid
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
./version-bump.sh "$RELEASE_VERSION"
./generate-css.sh
jq . ../../glyphnames.json > /dev/null

- name: Patch all the variations of the font family
run: |
Expand Down
14 changes: 6 additions & 8 deletions bin/scripts/generate-css.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Nerd Fonts Version: 3.3.0
# Script Version: 1.2.1
# Script Version: 1.3.0
# Generates CSS file for the font and cheat sheet code

# shellcheck disable=SC1091 # Do not pull in the sourced file
Expand Down Expand Up @@ -70,40 +70,38 @@ for var in "${!i@}"; do
# replace _ with -
glyph_name=${glyph_name/_/-}
glyph_char=${!var}
glyph_code=$(printf "%x" "'$glyph_char'")

#echo "$var=${!var}"

#echo "$glyph_name"
#echo "$glyph_char"
#echo "$glyph_code"
#printf "%x" "'$glyph_char'"

if [[ "$glyph_name" != mdi-* ]]; then
# generate css rules
{
printf ".nf-%s:before {" "$glyph_name"
printf "\\n"
printf " content: \"\\%s\";" "$glyph_code"
printf " content: \"\\%x\";" "'$glyph_char'"
printf "\\n"
printf "}"
printf "\\n"
} >> "$output_css_file"

# generate css min rules
{
printf ".nf-%s:before{content:\"\\%s\"}" "$glyph_name" "$glyph_code"
printf ".nf-%s:before{content:\"\\%x\"}" "$glyph_name" "'$glyph_char'"
} >> "$output_css_min_file"

# generate json entry
{
printf ",\"%s\":{\"char\":\"%s\",\"code\":\"%s\"}" "$glyph_name" "$glyph_char" "$glyph_code"
printf ",\"%s\":{\"char\":\"%s\",\"code\":\"%x\"}" "$glyph_name" "$glyph_char" "'$glyph_char'"
} >> "$output_json_file"

else
# generate css min rules for removed glyphs
{
printf ".nfold-%s:before{content:\"\\%s\"}" "$glyph_name" "$glyph_code"
printf ".nfold-%s:before{content:\"\\%x\"}" "$glyph_name" "'$glyph_char'"
} >> "$output_css_min_rem_file"
fi

Expand All @@ -114,7 +112,7 @@ for var in "${!i@}"; do
else
namespace="nf"
fi
printf " \"%s-%s\": \"%s\",\\n" "$namespace" "$glyph_name" "$glyph_code"
printf " \"%s-%s\": \"%x\",\\n" "$namespace" "$glyph_name" "'$glyph_char'"
} >> "$output_cheat_sheet_file"

done
Expand Down