Growler Posted December 16, 2019 Share Posted December 16, 2019 (edited) How do I stroke the outside of a font? font.drawStroke seems to stroke the inside of the font. Something like this: http://jsfiddle.net/vNWn6/ (as shown in this issue here: https://github.com/melonjs/melonJS/issues/299) Your example, here https://melonjs.github.io/melonJS/examples/font_test/, doesn't seem to show clearly how to do this. @obiot My code: game.ClickableEntity = me.Entity.extend({ init: function(x, y, settings) { ... this.color = 'black'; this.font = new me.Font('Verdana', 14, this.color); this.font.bold(); this.font.strokeStyle.parseCSS('white'); this.font.lineWidth = 1; draw: function(renderer) { this.font.draw(renderer, this.text, (this.width/2)-10, (this.height/2)-10); this.font.drawStroke(renderer, this.text, (this.width/2)-10, (this.height/2)-10); }, How mine currently looks in game: Edited December 16, 2019 by Growler Quote Link to comment Share on other sites More sharing options...
Growler Posted December 18, 2019 Author Share Posted December 18, 2019 @obiot @Parasyte any thoughts on this? Quote Link to comment Share on other sites More sharing options...
obiot Posted January 7, 2020 Share Posted January 7, 2020 Hi, actually the current implementation is correct in the sense that it complies with the html5 font API, where font.drawStroke() strokes the outline of the letters while font.draw() fills the inside of the letters. As you can see on the below example, the outline stroke is actually the "edge" of the letter and not outside of it : looks like you have an issue due to a "too low res" ? Quote Link to comment Share on other sites More sharing options...
obiot Posted January 7, 2020 Share Posted January 7, 2020 have you tried as well using a less than 1 value for lineWidth ? like 0.5 or even smaller ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.