Feature Request: Text stroke color/width

Discussion and feedback on Construct 2

Post » Sun Jan 15, 2017 4:58 am

Hi,

I'd like to request an addition to the Text plugin: the ability to define stroke color and width for text.

I modified the official Text plugin to do it, as a test. I added Stroke Color and Stroke Width properties, then inside the text.draw method set ctx.strokeStyle and ctx.lineWidth to the user-defined values. It worked as expected in Firefox, Chrome, Edge and even I.E., so I hope this is just a standard browser feature that can be supported.

I'm a Javascript novice, and I'm sure there are gotchas that I don't know about, but it was so easy for me to hack something in I'm hopeful it's not a huge ask to get official support.

Thank you!
B
38
S
11
G
2
Posts: 46
Reputation: 3,916

Post » Sun Jan 15, 2017 9:34 am

As more expirienced developer I suggest you to not mess with official plugins,
because every Construct 2 update may conflict with your upgrades.
If you want your modifications, better to duplicate the Text plugin call it for example "Super Text" and change it.
But even better to use already writen plugin that solves your request:
https://www.scirra.com/forum/plugin-tag-text_t92363

But I agree, outline could be a good addition to the official Text plugin.
B
60
S
31
G
6
Posts: 124
Reputation: 7,856

Post » Sun Jan 15, 2017 10:15 am

Thanks for pointing out the tag text plugin, Yura G. I didn't know about that one, and it looks like it'll do all I wanted and then some.

The thing is, I normally avoid using third-party plugins since they aren't guaranteed to be supported and I've often found them to be buggy. It sucks to invest time into integrating some plugin only to realize it isn't reliable and/or isn't supported by the author. I might break down and use this one since rex is so active, but I would still love to see official support for more text options.

I don't make direct changes to official plugins btw, for the reason you mentioned. I made a copy of the text plugin with my changes to test that what I was asking for could be done easily. But still, I wish I had named it "Super Text"... I called it "Text Stroke" which now seems very boring. ;)
B
38
S
11
G
2
Posts: 46
Reputation: 3,916

Post » Fri Feb 10, 2017 10:51 am

Hi @JerkTheRipper
SuperRex add a Stroke parameter in his plugin TagText but not the possibility to modify Stroke width.
Do you think it would be possible you send me your custom text plugin with stroke width, just to understand how you made the change ?
B
18
S
4
Posts: 83
Reputation: 2,083

Post » Mon Feb 13, 2017 8:14 pm

amkp wrote:Hi @JerkTheRipper
SuperRex add a Stroke parameter in his plugin TagText but not the possibility to modify Stroke width.
Do you think it would be possible you send me your custom text plugin with stroke width, just to understand how you made the change ?


Hey @amkp, I will try to dig that up, sure. I may have deleted it though, so in the meantime here's an example of stroke width in pure HTML/JS.

http://www.html5canvastutorials.com/tut ... xt-stroke/

If I recall, I just added ctx.lineWidth to the draw call, and exposed a number variable for it in the editor. I also exposed a variable for the stroke color in the same way the text color was done. Mostly copy/paste stuff tbh.
B
38
S
11
G
2
Posts: 46
Reputation: 3,916

Post » Tue Feb 14, 2017 9:07 am

Thanks for your answer @JerkTheRipper

Rex has updated his plugin TagText, so the stroke option with border width is now available:
https://www.scirra.com/forum/viewtopic.php?f=153&t=92363&p=1100592&sid=16ff5b639bcf4860b7428c8446ed5a51#p1100592
B
18
S
4
Posts: 83
Reputation: 2,083

Post » Tue Feb 14, 2017 9:13 pm

amkp wrote:Thanks for your answer @JerkTheRipper

Rex has updated his plugin TagText, so the stroke option with border width is now available:
https://www.scirra.com/forum/viewtopic.php?f=153&t=92363&p=1100592&sid=16ff5b639bcf4860b7428c8446ed5a51#p1100592


Great @amkp, thanks for the heads-up! That's good since I believe I deleted my test plugin.
B
38
S
11
G
2
Posts: 46
Reputation: 3,916


Return to Construct 2 General

Who is online

Users browsing this forum: Hiran Rodrigues, Yahoo [Bot] and 4 guests