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

[BUG] Unicode characters are not displayed correctly when saving the image in Ubuntu Linux #2983

Open
1 task done
Maaran21 opened this issue Aug 29, 2024 · 1 comment
Open
1 task done
Labels

Comments

@Maaran21
Copy link

Maaran21 commented Aug 29, 2024

Description

Some specific Unicode characters ("\u00Fc", "\u0071", "\u00D8") are not drawn properly in an image file when saving it in Ubuntu Linux. But the same Unicode characters are drawn properly in windows.

Additional information

  • SkiaSharp version = v2.88.8
  • Last known good version = None
  • IDE = Ubuntu Linux (VM)

Code

Replication Steps:
• Create a simple .NET (.NET 8.0) console application with below code.
• Install SkiaSharp (v2.88.8) in the above app.
• Run this application in Ubuntu Linux (VM) terminal using “dotnet run -- proj consoleApp.csproj” command.

int width = 500;
int height = 500;
SKImageInfo imageInfo = new SKImageInfo(width, height);
using (SKSurface surface = SKSurface.Create(imageInfo))
{
    SKCanvas canvas = surface.Canvas;
    canvas.Clear(SKColors.White);
    var bulletPaint = new SKPaint
    {
         Color = SKColors.Black,
         TextSize = 30,
         IsAntialias = true,
         Typeface = SKTypeface.FromFamilyName("Wingdings")
    }
    float X = 30;
    float Y = 50;
    // List of Unicode bullets
    string[] bullets = { "\u00Fc", "\u0071", "\u00D8" };
    // Draw the Unicode bullet
    canvas.DrawText(bullets[0], X, Y, bulletPaint);
    canvas.DrawText(bullets[1], X, Y + 50, bulletPaint);
    canvas.DrawText(bullets[2], X, Y + 100, bulletPaint);               
    using (SKImage image = surface.Snapshot())
    using (SKData data = image.Encode(SKEncodedImageFormat.Jpeg, 100))
    using (FileStream outputStream = new FileStream("Output.jpg", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
    {
        data.SaveTo(outputStream);
    }
}

Expected Behavior

The Unicode character should be drawn properly in Ubuntu Linux as same as Windows.

Actual Behavior

The specific Unicode characters are drawn as rectangle box in Ubuntu Linux.

Version of SkiaSharp

Other (Please indicate in the description)

Last Known Good Version of SkiaSharp

Other (Please indicate in the description)

IDE / Editor

Other (Please indicate in the description)

Platform / Operating System

Linux

Platform / Operating System Version

Ubuntu Linux (VM)
Version : v22.04

Devices

Ubuntu Linux (VM)
Version : v22.04

Relevant Screenshots

Windows
Screenshot 2024-08-29 172345
Ubuntu Linux
Screenshot from 2024-08-29 17-24-49

Relevant Log Output

No response

Code of Conduct

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

HinTak commented Oct 23, 2024

If you did it in a linux vm (as opposed to a fully functional daily used linux desktop), the most likely cause is that you have not installed any emoji capable fonts.

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