Quantcast
Channel: HTML Renderer
Viewing all articles
Browse latest Browse all 693

New Post: loss of font fidelity (missing ClearType?)

$
0
0
I fixed it by adding the hinting into your latest code: ;-)

The new HtmlPanel.OnPaint:
        /// <summary>
        /// Perform paint of the html in the control.
        /// </summary>
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            if (_htmlContainer != null)
            {
                e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;  // this is the line I added

                _htmlContainer.ScrollOffset = AutoScrollPosition;
                _htmlContainer.PerformPaint(e.Graphics);

                // call mouse move to handle paint after scroll or html change affecting mouse cursor.
                var mp = PointToClient(MousePosition);
                _htmlContainer.HandleMouseMove(this, new MouseEventArgs(MouseButtons.None, 0, mp.X, mp.Y, 0));
            }
        }
I went back and looked at my 1.4.1 code, and this was what was there:
    /// <summary>
    /// Perform paint of the html in the control.
    /// </summary>
    protected override void OnPaint(PaintEventArgs e)
    {
        base.OnPaint(e);

        if (_htmlContainer != null)
        {
            _htmlContainer.ScrollOffset = AutoScrollPosition;
            e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
            _htmlContainer.PerformPaint(e.Graphics);
        }
    }
My guess is I added it there as well, but forgot. It was 15-16 months ago. ;-) Or else it used to be there and you got rid of it. Either way, that is why it wasn't working now.

So mystery solved I think. If you could please make sure this fix makes it into the next build that would be great so that I can start (and keep) using the official builds so I don't have to manage my own code stream would be great.

Of course, this only has an affect when UseGdiPlusRendering is true. If I set it to false, the text goes back to ugly. But if I set it to true and use the official build, it stays ugly. It is only actually rendering with ClearType when the Hint is set.

Let me know if any questions.

Thanks,
Ryan

Viewing all articles
Browse latest Browse all 693

Trending Articles