mikepenz / Android-Iconics

Android-Iconics - Use any icon font, or vector (.svg) as drawable in your application.
https://mikepenz.dev
Apache License 2.0
5.19k stars 617 forks source link

icon names don't quite correspond with those in font library #647

Open XilinJia opened 3 months ago

XilinJia commented 3 months ago

About this issue

Details

Checklist

I recently migrate from Iconify to this library. So I admit I'm new with this. My trouble is to figure out what name to use for a font/icon. I don't see this is documented clearly.

For instance, I implemented these:

    implementation 'com.mikepenz:iconics-core:5.5.0-compose01'
    implementation 'com.mikepenz:iconics-views:5.5.0-compose01'
    implementation 'com.mikepenz:google-material-typeface:4.0.0.3-kotlin@aar'
    implementation 'com.mikepenz:google-material-typeface-outlined:4.0.0.2-kotlin@aar'

I searched for an icon named "pause" on https://fonts.google.com/icons?selected=Material+Symbols+Outlined:pause_circle:FILL@0;wght@400;GRAD@0;opsz@24&icon.query=pause+&icon.size=24&icon.color=%23e8eaed&icon.platform=android

I want to use the one with a circle, and it says the name for Android is pause_circle, so I tried with "{pause_circle}" and it didn't work. I google around and got some hint somewhere that I need to add a prefix like gmd- or gmo-, so I fooled around with "{gmo-pause_circle}" and "{gmd-pause_circle}", but it didn't get the icon either. I then searched in your source code and guessed that it might be {gmo-pause_circle_outline}, and it works.

I wonder how other people use this to avoid this type of trouble, but I hope it can be make clearer.

mikepenz commented 3 months ago

There's a chance that icon names have changed since they were originally added. They were originally sourced via: https://github.com/google/material-design-icons

I unfortunately don't have a solution to make it clearer, as it strongly depends on the font mapping itself.

However you can always use the iconics sample application which includes all the fonts and icons for you to search in

XilinJia commented 3 months ago

Thanks. The app is a good start point. It would be better if they are shown on the computer so that I can copy-paste the names into my code.

mikepenz commented 3 months ago

Not what you mean but I personally like to mirror my phone to the computer using scrcpy (https://github.com/Genymobile/scrcpy), which then allows me to copy paste strings.