Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DrawText with border? #407

Closed
Menighin opened this issue Dec 20, 2017 · 2 comments
Closed

DrawText with border? #407

Menighin opened this issue Dec 20, 2017 · 2 comments
Labels

Comments

@Menighin
Copy link

Hi guys,

This is more of a doubt (by the way, is there a specific forum for question or something?):

I have dynamic text over dynamic backgrounds. Im always writing the text in white but depending on the background and text length it may cause some issues writing white text over white background.

I was wondering: is there a simple way to add borders to my text? Or maybe some shadow or some kind of filter to highlight my text over the background?

I have searched on the TextGraphicsOptions and Font but couldnt find nothing.

The only way I can think of is first drawing the text in a black font with a slightly bigger size and then writing it in white, so it would be like a black-bordered white text.

Thanks,

@JimBobSquarePants
Copy link
Member

Hi @Menighin

Yeah we do have a forum for general chat. It's highlighted in the contribution guidelines that pop up when you raise an issue. You're not the first to miss it so no worries 😄

https://github.com/SixLabors/ImageSharp/blob/deb1c9c8a6c0e09219e36edc12c49cb1aaf4fc60/.github/CONTRIBUTING.md#do-you-have-questions-about-consuming-the-library-or-the-source-code

In answer to your question. Yes we can. You need the overload that accepts a pen that creates an outline

image.Mutate(x => x.DrawText("ImageSharp", font, Brushes.Solid(Rgba32.Black), Pens.Solid(Rgba32.Red, 2), Vector2.Zero));

car

Hope that helps

Cheers

James

@Menighin
Copy link
Author

Menighin commented Feb 1, 2018

Hi Jim, sorry to bother again. This time I tried the Gitter but didnt get any response... Can you answer me?

Hi everyone,
Can anybody help me with drawing text with an outline stroke? Is it possible?
Right now I am able to draw it with the stroke but it is inset:
_image.DrawText(quote, font, Brushes.Solid(Rgba32.White), Pens.Solid(Rgba32.Black, 1), new Vector2(X_TRANSLATE, yDraw), textOptions)
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants