Skip to content

When drawing a text with outline, draws fill after stroke and not before#1426

Merged
cameronwhite merged 5 commits into
PintaProject:masterfrom
pedropaulosuzuki:patch-2
May 9, 2025
Merged

When drawing a text with outline, draws fill after stroke and not before#1426
cameronwhite merged 5 commits into
PintaProject:masterfrom
pedropaulosuzuki:patch-2

Conversation

@pedropaulosuzuki
Copy link
Copy Markdown
Contributor

Fixes #1423.

@pedropaulosuzuki
Copy link
Copy Markdown
Contributor Author

Before:

image

After:

image

Copy link
Copy Markdown
Member

@cameronwhite cameronwhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I like the new behaviour much more 👍

I wonder if we can consolidate things a bit to avoid all the separate cases, e.g something like

if (StrokeText) {
    g.SetSourceColor (FillText ? CurrentTextEngine.SecondaryColor : CurrentTextEngine.PrimaryColor);
    ...
    g.Stroke ();
}

if (FillText) {
    g.MoveTo (CurrentTextEngine.Origin.X, CurrentTextEngine.Origin.Y);
    g.SetSourceColor (CurrentTextEngine.PrimaryColor);
    PangoCairo.Functions.ShowLayout (g, CurrentTextLayout.Layout);
}

@pedropaulosuzuki
Copy link
Copy Markdown
Contributor Author

Thanks! I like the new behaviour much more 👍

I wonder if we can consolidate things a bit to avoid all the separate cases, e.g something like

if (StrokeText) {
    g.SetSourceColor (FillText ? CurrentTextEngine.SecondaryColor : CurrentTextEngine.PrimaryColor);
    ...
    g.Stroke ();
}

if (FillText) {
    g.MoveTo (CurrentTextEngine.Origin.X, CurrentTextEngine.Origin.Y);
    g.SetSourceColor (CurrentTextEngine.PrimaryColor);
    PangoCairo.Functions.ShowLayout (g, CurrentTextLayout.Layout);
}

Done! I placed g.MoveTo() and g.SetSourceColor() inside if (StrokeText) because it is only needed because g.Stroke() resets state. Should be cleaner now.

@cameronwhite cameronwhite merged commit 04a7510 into PintaProject:master May 9, 2025
6 checks passed
@pedropaulosuzuki pedropaulosuzuki deleted the patch-2 branch May 10, 2025 02:47
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

Successfully merging this pull request may close these issues.

[Text tool] Outline in "Normal and Outline" text stroke appears over the text

2 participants