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

Suggest replacement for F719 #9

Closed
Finii opened this issue Jun 2, 2023 · 4 comments · Fixed by #10
Closed

Suggest replacement for F719 #9

Finii opened this issue Jun 2, 2023 · 4 comments · Fixed by #10

Comments

@Finii
Copy link

Finii commented Jun 2, 2023

First of all I want to say thank you for this great tool! 🥇
This really helps Nerd Fonts to help others with the painful transition to the new codepoints.
I would add you as contributor to Nerd Font, if you agree.

On this Issue topic:
Via Gitter I just had the question where F719 is. This is what nerdfix says:

image

The direct replacement for F719 (file_document_box) is F021A (text_box).
(They renamed the icon.)

I do not know if nerdfix has the possibility to handle pairs that have not-similar names, so maybe this is not possible.

@Finii
Copy link
Author

Finii commented Jun 2, 2023

At the moment I have no list of renamed icons. But in principle it should be possible to create such a list; starting with 'seems to be dropped' icons and searching for (almost) identical images in the new svgs. That would require some work, but if the list could be utilized I can set out to create it.

@Finii
Copy link
Author

Finii commented Jun 2, 2023

These are the 'seems to be dropped' icons (where the is no 1:1 equivalent name in the new icons):

$ cat ~/git/nerd-fonts/glyphnames.json | \
    jq | \
    grep '^  "' | \
    sed 's/^  "//;s/".*//' | \
    grep '^md' | \
    sed 's/^mdi-/MDI /;s/^md-/MD  /' | \
    sort -k2 | \
    grep -B 1 MDI | \
    uniq -c -s 4 | \
    grep '1 MDI' | \
    sed 's/.* MDI //' | \
    xclip

Full list hidden here:

account_card_details
account_location
account_settings_variant
airplay
allo
amazon
amazon_clouddrive
android_debug_bridge
android_head
apple_mobileme
approval
artist
audiobook
azure
bandcamp
basecamp
beats
behance
bible
bing
blackberry
blogger
book_multiple_variant
book_secure
book_unsecure
buffer
camcorder_box
camcorder_box_off
cash_usd
cellphone_android
cellphone_iphone
chart_scatterplot_hexbin
circle
circle_outline
cisco_webex
coin
coins
contact_mail
currency_chf
dictionary
disk
disk_alert
disqus_outline
do_not_disturb
do_not_disturb_off
douban
dribbble
dribbble_box
edge
email_secure
etsy
eventbrite
face
facebook_box
face_profile
file_document_box
file_pdf
file_xml
flash_circle
flattr
format_list_numbers
foursquare
fridge_filled
fridge_filled_bottom
fridge_filled_top
github_box
github_circle
github_face
glassdoor
google_pages
google_photos
google_physical_web
google_plus_box
google_wallet
gradient
hackernews
hangouts
hotel
houzz
houzz_box
image_filter
instapaper
internet_explorer
itunes
json
language_python_text
laptop_chromebook
laptop_mac
laptop_windows
lastfm
library_books
library_music
library_plus
linkedin_box
login_variant
loop
mail_ru
markdown
martini
maxcdn
medium
message_settings_variant
mixcloud
mixer
music_note_eighth
nest_protect
nest_thermostat
office
onedrive
onenote
periodic_table_co2
periscope
pharmacy
phone_locked
pinterest_box
plane_shield
playstation
plus_one
pocket
poll_box
quicktime
radiobox_blank
raspberrypi
roomba
security_home
send_secure
settings
settings_box
sort_alphabetical
sort_numeric
square_inc
square_inc_cash
stackexchange
tablet_ipad
telegram
terrain
textbox
textbox_password
tooltip_outline_plus
tor
towing
tumblr
tumblr_reblog
twitter_box
twitter_circle
twitter_retweet
uber
untappd
venmo
verified
visualstudio
vk
vk_box
vk_circle
voice
weather_partlycloudy
wii
wiiu
windows
worker
wunderlist
xamarin_outline
xaml
xbox
xbox_controller
xbox_controller_battery_alert
xbox_controller_battery_empty
xbox_controller_battery_full
xbox_controller_battery_low
xbox_controller_battery_medium
xbox_controller_battery_unknown
xbox_controller_off
xda
xing
xing_box
xing_circle
yammer
yelp
youtube_creator_studio
youtube_play

Oh, I used a 'special' glyphnames.json that does contain also the removed icon names (just copied the code also into the else branch):

diff --git a/bin/scripts/generate-css.sh b/bin/scripts/generate-css.sh
index 014a0ce0f..468ad3572 100755
--- a/bin/scripts/generate-css.sh
+++ b/bin/scripts/generate-css.sh
@@ -102,6 +102,10 @@ for var in "${!i@}"; do
     } >> "$output_json_file"
 
   else
+    # generate json entry
+    {
+      printf ",\"%s\":{\"char\":\"%s\",\"code\":\"%s\"}" "$glyph_name" "$glyph_char" "$glyph_code"
+    } >> "$output_json_file"
     # generate css min rules for removed glyphs
     {
       printf ".nfold-%s:before{content:\"\\%s\"}" "$glyph_name" "$glyph_code"

@loichyan
Copy link
Owner

loichyan commented Jun 2, 2023

I would add you as contributor to Nerd Font, if you agree.

It would be my pleasure, thank you very much!

I do not know if nerdfix has the possibility to handle pairs that have not-similar names

Currently this can be done with --replace nf-md-file_document_box,nf-mdi-text_box. But this option is meant to replace icons with the same suffix, so I would add a feature to load a predefined list of icon suggestions that can be used in autofix.

That would require some work, but if the list could be utilized I can set out to create it.

This is definitely useful, as it gives nerdfix the ability to handle most obsolete icons automatically.

@Finii
Copy link
Author

Finii commented Jun 5, 2023

Solution based on MaterialDesign's own replacements database

  1. Apply patch from Suggest replacement for F719 #9 (comment) to Nerd Font repo
  2. Call bin/scripts/generate-css.sh
  3. Create list of missing icons with [1]
  4. Search for replacements in aliases database with [2]

Result

+ means we found one or more (!) substitution(s). (48 icons)
> means we found one substitution manually. (43 icons)
- means that there seems to be no replacements. (89 icons)

+ account-location => tooltip-account
+ airplay => cast-variant
+ apple-mobileme => apple-icloud
+ approval => check-decagram check-decagram-outline
+ artist => account-music
+ bible => book-cross
+ book-secure => book-lock
+ book-unsecure => book-lock-open
+ chart-scatterplot-hexbin => chart-scatter-plot-hexbin
+ coins => circle-multiple
+ contact-mail => card-account-mail
+ dictionary => book-alphabet
+ do-not-disturb-off => minus-circle-off
+ email-secure => email-lock
+ face => emoticon
+ file-document-box => text-box
+ flash-circle => lightning-bolt-circle
+ format-list-numbers => format-list-numbered
+ fridge-filled => fridge
+ fridge-filled-bottom => fridge-top
+ fridge-filled-top => fridge-bottom
+ hotel => bed
+ image-filter => image-auto-adjust image-multiple-outline
+ library-music => music-box-multiple
+ library-plus => plus-box-multiple
+ loop => refresh reload restore sync
+ martini => glass-cocktail
+ nest-protect => smoke-detector
+ phone-locked => phone-lock
+ plane-shield => shield-airplane
+ plus-one => numeric-positive-1
+ poll-box => chart-box
+ raspberrypi => raspberry-pi
+ roomba => robot-vacuum
+ security-home => shield-home
+ send-secure => send-lock
+ settings => cog cogs tune tune-variant
+ settings-box => cog-box
+ stackexchange => stack-exchange
+ tooltip-outline-plus => tooltip-plus-outline
+ twitter-retweet => repeat-variant
+ verified => check-decagram check-decagram-outline shield-check
+ visualstudio => microsoft-visual-studio
+ weather-partlycloudy => weather-partly-cloudy
+ worker => account-hard-hat
+ xaml => language-xaml
+ youtube-creator-studio => youtube-studio
+ youtube-play => youtube

> account-card-details => card-account-details
> azure => microsoft-azure
> bing => microsoft-bing
> circle => circle-medium
> circle-outline => checkbox-blank-circle-outline
> do-not-disturb => minus-circle
> do-not-disturb-off => minus-circle-off
> edge => microsoft-edge
> face-profile => face-man-profile
> github-circle => github
> gradient => gradient-vertical
> hangouts => google-hangouts
> internet-explorer => microsoft-internet-explorer
> json => code-json
> linkedin-box => linkedin
> login-variant => exit-to-app
> markdown => language-markdown
> office => microsoft-office
> onedrive => microsoft-onedrive
> onenote => microsoft-onenote
> playstation => sony-playstation
> radiobox-blank => checkbox-blank-circle-outline
> sort-alphabetical => sort-alphabetical-variant
> sort-numeric => sort-numeric-variant
> tablet-ipad => tablet
> terrain => image-filter-hdr
> textbox => form-textbox
> textbox-password => form-textbox-password
> towing => tow-truck
> voice => account-voice
> wii => nintendo-wii
> wiiu => nintendo-wiiu
> windows => microsoft-windows
> xamarin-outline => microsoft-xamarin
> xbox => microsoft-xbox
> xbox-controller => microsoft-xbox-gamepad
> xbox-controller-battery-alert => microsoft-xbox-gamepad-battery-alert
> xbox-controller-battery-empty => microsoft-xbox-controller-battery-empty
> xbox-controller-battery-full => microsoft-xbox-controller-battery-full
> xbox-controller-battery-low => microsoft-xbox-controller-battery-low
> xbox-controller-battery-medium => microsoft-xbox-controller-battery-medium
> xbox-controller-battery-unknown => microsoft-xbox-controller-battery-unknown
> xbox-controller-off => microsoft-xbox-controller-off

- account-settings-variant
- allo
- amazon
- amazon-clouddrive
- android-debug-bridge
- android-head
- audiobook
- bandcamp
- basecamp
- beats
- behance
- blackberry
- blogger
- book-multiple-variant
- buffer
- camcorder-box
- camcorder-box-off
- cash-usd
- cellphone-android
- cellphone-iphone
- cisco-webex
- coin
- currency-chf
- disk
- disk-alert
- disqus-outline
- douban
- dribbble
- dribbble-box
- etsy
- eventbrite
- facebook-box
- file-pdf
- file-xml
- flattr
- foursquare
- github-box
- github-face
- glassdoor
- google-pages
- google-photos
- google-physical-web
- google-plus-box
- google-wallet
- hackernews
- houzz
- houzz-box
- instapaper
- itunes
- language-python-text
- laptop-chromebook
- laptop-mac
- laptop-windows
- lastfm
- library-books
- mail-ru
- maxcdn
- medium
- message-settings-variant
- mixcloud
- mixer
- music-note-eighth
- nest-thermostat
- periodic-table-co2
- periscope
- pharmacy
- pinterest-box
- pocket
- quicktime
- square-inc
- square-inc-cash
- telegram
- tor
- tumblr
- tumblr-reblog
- twitter-box
- twitter-circle
- uber
- untappd
- venmo
- vk
- vk-box
- vk-circle
- wunderlist
- xda
- xing
- xing-box
- xing-circle
- yammer
- yelp

Helper

[1] Command line to create missing file

cat git/nerd-fonts/glyphnames.json | \                                                                 
    jq | \
    grep '^  "' | \
    sed 's/^  "//;s/".*//' | \
    grep '^md' | \
    sed 's/^mdi-/MDI /;s/^md-/MD  /' | \
    sort -k2 | \
    grep -B 1 MDI | \
    uniq -c -s 4 | \
    grep '1 MDI' | \
    sed 's/.* MDI //' | \
    tr '_' '-' > missing

[2] Command line to create substitution list

while read icon; do
    rep=$(jq ".[] | select(.aliases[] | select(. == \"${icon}\")) | .name" -r git/MaterialDesign/meta.json)
    if [ -n "${rep}" ]; then
        xargs echo "+ ${icon} =>" <<<${rep}
    else
        echo "- ${icon}"
    fi 
done <<< $(cat missing) | \
LC_ALL=C sort > replacements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants