Stroke outside of text, not inside

Recommended Posts

How do I stroke the outside of a font? font.drawStroke seems to stroke the inside of the font.

Something like this: (as shown in this issue here:

Your example, here, doesn't seem to show clearly how to do this.


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.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:

Screen Shot 2019-12-15 at 7.32.08 PM.png

Edited by Growler

Share this post

Link to post
Share on other sites

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" ?

Share this post

Link to post
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.