-
Notifications
You must be signed in to change notification settings - Fork 117
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
improve font-size consistency with textMarginRatio property #134
improve font-size consistency with textMarginRatio property #134
Conversation
The problem with the old implementation was that it would not behave as expected when using relative units (primarily percentages) for Maybe we should try determining the I'd love to hear the opinion of @Sitebase and some of react-avatar's users before moving ahead. The original issue is available at #136 |
I made a second commit that takes your first comment about not working with relatives sizes into account.
Your meaning is not clear to me so I can't comment any further on this. |
@GertSallaerts Could you finalise this PR as it seems to address most issues related to font-scaling. |
2a851b4
to
6fb4ea4
Compare
6fb4ea4
to
2fac07f
Compare
Updated. |
Thanks, I'll look into merging this next week! |
This has been released as part of version v3.5.0! |
This is a proposal of a new way to manage font-size on text-based avatars.
The current implementation makes the width of the text match
avatarSize / textSizeRatio
but this results in a lot of different font sizes. This happens because when you're not using a monospaced font, "JJ" for example will be significantly narrowed than "WW". This causes font-sizes to very even between avatars that all have two initials. (see image)My proposal returns it back to the old implementation where font-size is set as
avatarWidth / textSizeRatio
. The problem with that implementation was that avatars with three of four initials could overflow the avatar's background. I propose to solve this by adding a new propertytextMarginRatio
which reduces font-size only when the text would become to wide.For now this is a POC; let me know what you think and I'll dot all the i's 😉