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

Added SvgForTheBadgeRenderer #86

Merged
merged 6 commits into from
Feb 18, 2022
Merged

Conversation

ricardoboss
Copy link
Collaborator

@ricardoboss ricardoboss commented Jan 27, 2022

Hi! In another project using this library, I requested to add support for more styles: PUGX/badge-poser#705. (PR to fix that one: PUGX/badge-poser#707)

All styles were already there, except from for-the-badge. So I implemented it in this PR. This is what the new style looks like:

image

Note: there is a new dependency on kartsims/easysvg. The only problem this library has, is that it still supports PHP 5.6 (oof). Maybe no one bothered to update it or the author wants to support older PHP version. Anyhow, I created a fork of it, which I added as a VCS repository in composer.json. That way, this PR doesn't have to wait until my PR over there is merged: kartsims/easysvg#32

Let me know what you think!

@JellyBellyDev
Copy link
Collaborator

Hi @ricardoboss! Thanks for your PR! Can you fix the CI, please?

@ricardoboss
Copy link
Collaborator Author

@JellyBellyDev fixed (I hope)

},
{
"type": "vcs",
"url": "https://github.com/ricardoboss/easysvg"
Copy link
Collaborator

@antonkomarev antonkomarev Jan 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need to depend on the unpublished fork of the third party lib?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by unpublished?

I specifically explained why this fork has a release: https://github.com/ricardoboss/easysvg/releases/tag/2.0

We need this fork, since the original library has a lot of deprecation warnings (and even fatal errors) because it supported very old PHP versions. In my fork, I fixed them and opened a PR. I am in talks with the creator of the library to merge my PR and then we can drop this extra repository.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I pinged kartsims/easysvg#32 (comment) :)

@antonkomarev
Copy link
Collaborator

antonkomarev commented Jan 27, 2022

@ricardoboss thanks for pushing this forward!

Why Roboto and Montserrat fonts are used?
Original style for-the-badge just uses common Verdana,Geneva,DejaVu Sans,sans-serif.

Screenshot 2022-01-27 at 17 47 58

Output image looks blurred and not flat (it has some kind of bevel border on the top).

image

}
],
"require": {
"php": ">=7.4",
"ext-gd": "*",
"ext-simplexml": "*",
"kartsims/easysvg": "^2.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need extra dependency? How svg rendering is implemented in other badge styles without it?

Copy link
Collaborator Author

@ricardoboss ricardoboss Jan 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In https://github.com/ekfuhrmann/badge-generator it is implemented using opentype.js. We need some way to render a font in SVG, since not everyone has the required fonts installed on their systems. If you know another way, let me know!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem for me to new deps but i prefer to use the standard font as talk by @antonkomarev here: #86 (comment)

@ricardoboss
Copy link
Collaborator Author

ricardoboss commented Jan 27, 2022

@ricardoboss thanks for pushing this forward!

Why Roboto and Montserrat fonts are used? Original style for-the-badge just uses common Verdana,Geneva,DejaVu Sans,sans-serif.

I used the same fonts that are used by the original "for the badge" generator: https://github.com/ekfuhrmann/badge-generator
If they're wrong, they can easily be replaced.

Output image looks blurred and not flat (it has some kind of bevel border on the top).

image

The bevel on top is just my poor screenshot of the badge :) The svg itself is flat.

Copy link
Collaborator

@JellyBellyDev JellyBellyDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yoy can add to readme how to use the new feature?
Thanks

}
],
"require": {
"php": ">=7.4",
"ext-gd": "*",
"ext-simplexml": "*",
"kartsims/easysvg": "^2.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem for me to new deps but i prefer to use the standard font as talk by @antonkomarev here: #86 (comment)

},
{
"type": "vcs",
"url": "https://github.com/ricardoboss/easysvg"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I pinged kartsims/easysvg#32 (comment) :)

README.md Outdated Show resolved Hide resolved
@ricardoboss
Copy link
Collaborator Author

@antonkomarev I addressed your comments in the last commits. I took a look at the shields.io for-the-badge badges and adjusted the fonts and layout:

test

Copy link
Collaborator

@JellyBellyDev JellyBellyDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ricardoboss!
For now i merged but i open a issue to remove the unpublished fork deps as soon as the PR is released

@JellyBellyDev JellyBellyDev merged commit d517d0c into badges:master Feb 18, 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

Successfully merging this pull request may close these issues.

4 participants