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

SKCanvas.DrawText over a SKBitmap no longer works in Azure App Service for Windows but works for Linux #3128

Open
1 task done
jasminjasmin2 opened this issue Dec 21, 2024 · 1 comment
Labels

Comments

@jasminjasmin2
Copy link

Description

SKCanvas.DrawText cannot write over a SKBitmap in Azure App Service application for Windows but works in the similar application for Azure App Service on Linux. There is no error or exception, it just does not have any effect.
This is a regression because it was working well in 2.88.9 .

Code

SKBitmap skBitmap = SKBitmap.FromImage(skImage);
SKCanvas skCanvas = new SKCanvas(skBitmap);
SKFont skFont = new SKFont(SKTypeface.Default, 16);
SKPaint sKPaint = new SKPaint(skFont);
sKPaint.Color = new SKColor(255, 0, 0);
sKPaint.IsAntialias = true;
skCanvas.DrawText("My Text", 10, 10, sKPaint);

Expected Behavior

A text is written over the image

Actual Behavior

No text is written and no exception is thrown

Version of SkiaSharp

3.116.0 (Current)

Last Known Good Version of SkiaSharp

2.88.9 (Previous)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

Windows, Other (Please indicate in the description)

Platform / Operating System Version

Azure App Service for Windows

Devices

No response

Relevant Screenshots

No response

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jasminjasmin2
Copy link
Author

After further investigation, it seems it is related to text align not getting properly initialized in the latest version of library. Explicitly setting the TextAlign in SKPaint did not help either. There are some TODO comments in SKCanvas.cs (e.g. below). Will you address that TODO somehow in the future versions?

	public void DrawText (string text, SKPoint p, SKFont font, SKPaint paint) =>

#pragma warning disable CS0618 // Type or member is obsolete (TODO: replace paint.TextAlign with SKTextAlign.Left)
DrawText (text, p, paint.TextAlign, font, paint);
#pragma warning restore CS0618 // Type or member is obsolete

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

No branches or pull requests

1 participant