toptensoftware / RichTextKit

Rich text rendering for SkiaSharp
Other
366 stars 73 forks source link

RichString.Paint is not rendering ClearType when IsAntialias and LcsRenderText are both set to true #33

Open PascalHigelin opened 3 years ago

PascalHigelin commented 3 years ago

Test code:

RichString richString = new RichString
{
    MaxWidth = ScreenClientBounds.Width,
    MaxHeight = ScreenClientBounds.Height
};

richString.FontFamily(Font.FontFamily.Name);
richString.FontSize(Font.Size * 1.25f * ZoomFactor);
richString.FontItalic(Font.Italic);
richString.Bold(Font.Bold);
richString.Add(text);

richString.Paint(canvas, clientRectangle.Location, new TextPaintOptions { IsAntialias = true, LcdRenderText = true });
toptensoftware commented 3 years ago

Thanks for reporting. I've looked into this and the flag is getting passed through to the underlying Canvas.DrawText but doesn't seem to be taking effect.

I suspect this is either a bug in SkiaSharp, or it's not supported on Canvas.DrawText when passed a SKTextBlob.

Gillibald commented 3 years ago

This is somehow related: https://github.com/mono/SkiaSharp/issues/1253