Closed EngRajabi closed 3 years ago
What is the purpose of this issue? RTL text rendering should work just fine with RichTextKit
I have such a code but it does not work properly
// Create the text block
var tb = new TextBlock();
// Configure layout properties
tb.MaxWidth = 900;
tb.Alignment = Topten.RichTextKit.TextAlignment.Right;
// Create normal style
var styleNormal = new Style()
{
FontFamily = "Arial",
FontSize = 14
};
tb.AddText("مجسن رجبی", styleNormal);
var text = "محسن رجبی";
var monkeyBitmap = SKBitmap.Decode(
new FileStream(@"D:\Projects\Sadad Payment External Service\Sadad.Payment.External.Api\Images\safte12.jpg", FileMode.Open));
// Create canvas based on bitmap
using (SKCanvas canvas = new SKCanvas(monkeyBitmap))
{
tb.Paint(canvas, new SKPoint(100, 100));
using (MemoryStream memStream = new MemoryStream())
using (SKManagedWStream wstream = new SKManagedWStream(memStream))
{
monkeyBitmap.Encode(wstream, SKEncodedImageFormat.Jpeg, 100);
byte[] data = memStream.ToArray();
File.WriteAllBytes(@"D:\test.jpg", data);
}
}
Thanks for reporting. I thought this was all working correctly but will have to investigate when I get home next week. Can you post some images showing what RichTextKit is doing along with example of how it should be rendered?
Sorry for the slow reply on this. I just did some quick tests here with that same piece of text and it seems to be working fine:
If you're still having issues with this could you please send a complete project demonstrating the problem and I'll investigate further.
Please give me a sample code you entered Did you print this text on another photo?
I just changed this line to use the text you supplied and then ran the Sandbox project.
No I didn't print over a photo - not sure how that's relevant. You haven't described exactly what the issue with the output is besides to say "does not work properly" - so I'm not sure, maybe it is.
fix text rtl drwing. https://github.com/mono/SkiaSharp/issues/1461