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

FontAwesome icons are too big #13

Open
risalfajar opened this issue Dec 5, 2021 · 5 comments
Open

FontAwesome icons are too big #13

risalfajar opened this issue Dec 5, 2021 · 5 comments

Comments

@risalfajar
Copy link

Using FA icons:
image

Using Jetpack Compose built-in Icons:
image

I am just using IconButton and Icon normally.
I think there is something wrong with FA icons vectors, looking at the code from any icons from FA, it have its own viewport width and height:

public val SolidGroup.Pen: ImageVector
    get() {
        if (_pen != null) {
            return _pen!!
        }
        _pen = Builder(name = "Pen", defaultWidth = 512.0.dp, defaultHeight = 512.0.dp,
                viewportWidth = 512.0f, viewportHeight = 512.0f).apply {
            path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f,
                    strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
                    pathFillType = NonZero) {
                moveTo(290.74f, 93.24f)
                lineToRelative(128.02f, 128.02f)
                lineToRelative(-277.99f, 277.99f)
                lineToRelative(-114.14f, 12.6f)
                curveTo(11.35f, 513.54f, -1.56f, 500.62f, 0.14f, 485.34f)
                lineToRelative(12.7f, -114.22f)
                lineToRelative(277.9f, -277.88f)
                close()
                moveTo(497.94f, 74.18f)
                lineToRelative(-60.11f, -60.11f)
                curveToRelative(-18.75f, -18.75f, -49.16f, -18.75f, -67.91f, 0.0f)
                lineToRelative(-56.55f, 56.55f)
                lineToRelative(128.02f, 128.02f)
                lineToRelative(56.55f, -56.55f)
                curveToRelative(18.75f, -18.76f, 18.75f, -49.16f, 0.0f, -67.91f)
                close()
            }
        }
        .build()
        return _pen!!
    }

private var _pen: ImageVector? = null
@BreimerR
Copy link

I think sizing with modifiers works just fine.

Icon(
 FontAwesomeIcons.Brands.Github,
 modifier = Modifier.size(24.dp)
)

@risalfajar
Copy link
Author

@BreimerR well that can be a temporary workaround. For long term it will add more boilerplate to our code, remembering icon size each time we use icons is a hassle too.

@DevSrSouza
Copy link
Owner

The project when generating use the same svg size values when generating. You could easily create a custom Composable to sets your preferred font size and use it. This is actually the only way possible to do this. If I would be doing on Compose-Icons side, would be the same thing, a custom composable for that.

CompositionLocals is not an option in this case because the fonts code does not use @composable.

@DevSrSouza
Copy link
Owner

I will close this because this is not something that I would change to be honest. Unless everyone thinks that compose-icons should provide a custom Icon Composable with the size set by default.

@risalfajar
Copy link
Author

what about changing the value of defaultWidth, defaultHeight, viewportHeight, and viewportWidth to match the Compose standard? I found this in androidx.compose.material.icons
image

@DevSrSouza DevSrSouza reopened this Apr 24, 2022
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

No branches or pull requests

3 participants