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

"Not published" badge has too much horizontal padding #85

Open
hadley opened this issue Oct 24, 2016 · 6 comments
Open

"Not published" badge has too much horizontal padding #85

hadley opened this issue Oct 24, 2016 · 6 comments

Comments

@hadley
Copy link

hadley commented Oct 24, 2016

e.g. http://www.r-pkg.org/badges/version/pkgdown

@gaborcsardi
Copy link
Contributor

Wait, when you say vertical padding, is that horizontal padding? I mean, padding on the left and right?

Because the height of the badge is (should be) exactly the same as other badges, 20px. The text font and size is also the same as for other https://shields.io badges: 11pt, DejaVu Sans, Verdana, Geneva, sans-serif.

Or maybe the SVG rendering is not right in your browser? If you suspect that this is the case, can you post a PNG screenshot with this and other badges, instead of the SVG?

@hadley
Copy link
Author

hadley commented Nov 15, 2016

Sorry, yes, there's excess padding to the left and right of "not published"

@hadley hadley changed the title "Not published" badge has too much vertical padding "Not published" badge has too much horizontal padding Nov 15, 2016
gaborcsardi added a commit that referenced this issue Nov 15, 2016
@gaborcsardi
Copy link
Contributor

OK, I think it is better now. Spacing is quite hacky, unfortunately, I am trying to set the width based on a string...

@hadley
Copy link
Author

hadley commented Nov 15, 2016

You might be able to use gdtools::str_metrics() to help

@gaborcsardi
Copy link
Contributor

@hadley The SVG is rendered in the browser, with the fonts you have, so imo the only solution is a server side SVG library that converts the text to paths. Then padding will be correct and the SVG will look the same everywhere.

I should just look at what shields.io is doing, really....

@hadley
Copy link
Author

hadley commented Nov 15, 2016

But you're presumably choosing a common font that most browsers have. You can also set the svg textWidth property

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

2 participants