No Text Antialiasing

Oct 2, 2013 at 2:32 PM
Hello!

I've encountered really strange problem. I'm trying to render under ASP.Net environment (server side image generation) and here is my test code (pretty sort)

    using (var bitmap = new Bitmap(300, 200, PixelFormat.Format24bppRgb))
    {
        using (var graphics = Graphics.FromImage(bitmap))
        {
            graphics.CompositingQuality = CompositingQuality.HighQuality;
            graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
            graphics.SmoothingMode = SmoothingMode.HighQuality;
            graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;

            using (var htmlContainer = new HtmlContainer())
            {
                htmlContainer.AvoidGeometryAntialias = false;
                htmlContainer.SetHtml(File.ReadAllText(@"test.html"));
                htmlContainer.MaxSize = new SizeF(bitmap.Width, bitmap.Height);
                htmlContainer.PerformLayout(graphics);
                htmlContainer.PerformPaint(graphics);
            }
        }

        bitmap.Save("test.png");
    }
and here is my HTML code

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <style> body { background-color: #FFFFFF; font-size: 60pt; } </style>
    </head>
    <body>
        TEST
    </body>
</html>
and I'm getting text with NO antialiasing.

When I add "color:red" CSS I'm getting red text with ugly black borders, like alpha-blending failed or something like that.

I've tried to initialize bitmap with white background like this

graphics.FillRectangle(Brushes.White, 0, 0, bitmap.Width, bitmap.Height);
or add background CSS property to html element, but it did not help.
Developer
Oct 5, 2013 at 9:47 AM
Damn GDI not properly supporting alpha channel :(
I played with the idea to support GDI and GDI+ text rendering side by side but GDI+ text rendering just sucks...
If you want I can upload v1.4.5.0 that was before I switched to GDI text rendering so you can use it until I figure out a proper solution for this.
Oct 5, 2013 at 1:33 PM
Thanks for your reply,

I can compile code by myself, no need to make you do this :-) Just wanted to know what's the problem.
Oct 7, 2013 at 7:04 AM
I have to solve this issue, it seem that it related to this problem. Can you please upload v1.4.5 so that I can be able to try if it helps or not?
Developer
Oct 19, 2013 at 3:48 PM
Try 1.4.8.0, let me know if it has issues.