Jump to content
Sign in to follow this  
alank2

Is there a way to outline text in a TLabel?

Recommended Posts

So that the font itself is black for example, but it has a white outline immediately around the font, but not the entire background.  I am wanting to overlay a TLabel on top of a graphic and make it visible if the graphic is dark or light.

Share this post


Link to post

AFIK there isn't a way to achieve this with a plain TLabel. 

You need to convert your text to a Path (TPathData) and then render this on a Canvas. Google is your friend for more information.

Share this post


Link to post

Many of those examples are large fonts like a WordArt type of thing.  Can this approach work on smaller font sizes like 12pt?

 

Thank you for the help!

Edited by alank2

Share this post


Link to post

I'm not in love with it, but I ended up using 5 TLabels - one offset to each corner underneath the real one to give it an outline.

Share this post


Link to post

Why not override DoDrawText and do whatever you want (glow effect)?

Edited by Fr0sT.Brutal

Share this post


Link to post

You can just use the StrokeColor property of TSkLabel from Skia4Delphi library:

 

 

 

TSkLabel.thumb.png.e2167c7cf5d8a9c5258c52b4a8bc7f3e.png

  

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×