Skip to content

When multiple spaces are present, label width is computed incorrectly #6510

Open
@ruro

Description

@ruro

Are you experiencing an issue with...

🪲 Description

It seems that the width of the badge label/value text is computed incorrectly for space characters. This leads to the rest of the text getting stretched out.

🔗 Link to the badge

Here are some badges that have their label replaced by foo + N spaces + bar. Notice that there are no whitespace characters between f, o and o as well as between b, a and r.

https://raster.shields.io/pypi/v/a?label=foo%20bar:

https://raster.shields.io/pypi/v/a?label=foo%20%20bar:

https://raster.shields.io/pypi/v/a?label=foo%20%20%20%20bar:

https://raster.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20bar:

https://raster.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20bar:

https://raster.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20bar:

Compare with the same badges but with %20 replaced by _:

https://raster.shields.io/pypi/v/a?label=foo_bar:

https://raster.shields.io/pypi/v/a?label=foo__bar:

https://raster.shields.io/pypi/v/a?label=foo____bar:

https://raster.shields.io/pypi/v/a?label=foo________bar:

https://raster.shields.io/pypi/v/a?label=foo________________bar:

https://raster.shields.io/pypi/v/a?label=foo________________________________bar:

And the svg versions

https://img.shields.io/pypi/v/a?label=foo%20bar:

https://img.shields.io/pypi/v/a?label=foo%20%20bar:

https://img.shields.io/pypi/v/a?label=foo%20%20%20%20bar:

https://img.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20bar:

https://img.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20bar:

https://img.shields.io/pypi/v/a?label=foo%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20bar:

https://img.shields.io/pypi/v/a?label=foo_bar:

https://img.shields.io/pypi/v/a?label=foo__bar:

https://img.shields.io/pypi/v/a?label=foo____bar:

https://img.shields.io/pypi/v/a?label=foo________bar:

https://img.shields.io/pypi/v/a?label=foo________________bar:

https://img.shields.io/pypi/v/a?label=foo________________________________bar:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBugs in badges and the frontendnpm-packageBadge generation and badge templates

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions