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

Text Color Bleeding Out of Outline #952

Open
myokeeh opened this issue Mar 17, 2024 · 2 comments
Open

Text Color Bleeding Out of Outline #952

myokeeh opened this issue Mar 17, 2024 · 2 comments

Comments

@myokeeh
Copy link

myokeeh commented Mar 17, 2024

I have an app that displays text over an image that's rotated at varying angles. To contrast the text, I outline it with a darker color (black).

I've managed to get the effect I want except for something undesired. Sometimes, the text color bleeds out of the outline and I can't figure out why. It does better on different scales, FontSize, and angles. Is there a better way to do this? Is there something I can change in the existing code easily?

image

string datetimetext = datetim.ToString("MMM d");
var fontsize = 50;
CanvasTextFormat textFormat = new()
{
    FontWeight = Windows.UI.Text.FontWeights.Bold,
    FontFamily = "Segoe UI Variable",
    FontSize = fontsize * scaleFactor,
    Direction = CanvasTextDirection.LeftToRightThenTopToBottom,
};
CanvasTextLayout textLayout = new(clds, datetimetext, textFormat, 1000, 100);

clds.DrawText(datetimetext
    , new Vector2(...),
    Color.FromArgb(200, 255, 255, 255), textFormat);
CanvasStrokeStyle dashedStroke = new()
{
    DashStyle = CanvasDashStyle.Solid
};

clds.DrawGeometry(CanvasGeometry.CreateText(textLayout),
    new Vector2(...),
    Color.FromArgb(200, 0, 0, 0), 2 * scaleFactor, dashedStroke);

@myokeeh
Copy link
Author

myokeeh commented Apr 24, 2024

Anyone?

@myokeeh
Copy link
Author

myokeeh commented May 3, 2024

@getrou any ideas?

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

No branches or pull requests

1 participant