Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@A----
Copy link

@A---- A---- commented Jan 12, 2015

Refactors badge drawing functions (removing duplicate lines)
Adds a "none" type (no background shape)
Adds a stroke color options (sort of outline around the text, see http://stackoverflow.com/questions/14126298/create-text-outline-on-canvas-in-javascript)

@twidi
Copy link

twidi commented Dec 23, 2016

I tried this but without success: I don't have any stroke colors (using type:none and setting any stroke color) , and also it changes the "circle" behavior: there is no padding around the text anymore :-/

Edit: about the stroke not visible it's because you set the lineWidth to a hardcoded value, not depending on the width of the size of the font (which seems to depend on the size of the canvas, which depends on the original size of the icon file). For example if the icon file is 512*512, it works for me with the line width set to 30 (in fact I tried with this formula which kinda worked for many sizes: _context.lineWidth = Math.max(parseInt(_context.font.split('px')[0], 0)/15, 3);)
I guess the other issue is related to this too

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.

2 participants