https://kotlinlang.org logo
#compose
Title
# compose
e

eygraber

10/31/2023, 2:26 AM
Is there any way to get a material symbol as an ImageVector that has the same dimensions as a regular material icon? e.g. https://fonts.google.com/icons?icon.query=diagnosis
a

ascii

10/31/2023, 4:10 AM
Copy the SVG into https://www.composables.com/svgtocompose. Or import it into Android Studio, and use the SVG to Compose plugin.
e

eygraber

10/31/2023, 4:11 AM
I did that, and I copied the composable version from composables.com but the size is still bigger than a standard icon
a

ascii

10/31/2023, 4:26 AM
Bigger how? It should still be 24dp, but perhaps symbols don't have additional padding around the icon itself (inset).
Perhaps a screenshot comparison would help
e

eygraber

10/31/2023, 4:50 AM
image.png
a

ascii

10/31/2023, 4:57 AM
Double check what default size is. Should be 24dp unless you used some other tool.
I've seen some that default to 40dp for example
e

eygraber

10/31/2023, 5:01 AM
cc @Alex Styl
a
e

eygraber

10/31/2023, 6:13 AM
Getting the SVG from here and getting compose code for it from https://www.composables.com/svgtocompose or the SVG to Compose plugin result in an
ImageVector
that doesn't render
Was able to get it how I wanted it by scaling the path operations to match the scaling of the viewport from 40 to 24
a

Alex Styl

11/02/2023, 9:26 AM
@eygraber sorry just saw your message. thanks for sharing the svg, will have a look asap. For future reference there is also https://www.composables.com/icons where you can find the material symbols already converted to compose. haven't tested the specific icon, but it is worth checking out
e

eygraber

11/02/2023, 9:46 PM
@Alex Styl I had the same issue getting the symbol from composables.com; looks like it's using 40dp instead of 24dp and the viewport is all wacky. It's happening for other symbols/icons as well
a

Alex Styl

11/03/2023, 2:01 AM
was worth a shot 😄 this might be a combination of things such as the icons from google having an issue with the sizing (there was a case like this a while ago, hopefully this is fixed now and I need to update them on my end) or something is up with the converter. im cooking something new for composables (out in a few days) and as soon as that is done ill have a proper look into the icons
thank you color 1
2 Views