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

Improve blurred output #50

Open
torfranz opened this issue Feb 24, 2017 · 5 comments · Fixed by #71
Open

Improve blurred output #50

torfranz opened this issue Feb 24, 2017 · 5 comments · Fixed by #71
Assignees
Labels

Comments

@torfranz
Copy link

Hi,
Currently formulas are rendered pretty blurred.

Toying with the v0.3 version now it seems I'm unable to influence the rendering of the formula with any of the usual options, RenderOptions, TextOptions, UseLayoutRounding. I tried basically all combinations but to no avail. Can you give any hint on how to reduce the blur?

Btw, thx for the lightning speed in releasing v0.3 👍

@ForNeVeR
Copy link
Owner

Alright, it wasn't completely fixed. See comment from @torfranz:

image

Please note the blurred horizontal lines on the equal sign.

@B3zaleel
Copy link
Contributor

B3zaleel commented Sep 5, 2018

See this one. To the left are the computer modern fonts and to the right are the Asana Math fonts render_compare

@ForNeVeR
Copy link
Owner

ForNeVeR commented Sep 5, 2018

That's not a font issue, it's more of WPF aliasing / layout rendering / pixel pinning issue. You can't just "fix" it by changing a font.

Also, for the record, the right one looks more blurry to me (check the radical sign: its' top part definitely has more pixels in height than it should; the top pixel line is shadowed).

@B3zaleel
Copy link
Contributor

B3zaleel commented Sep 5, 2018

Have you tried overriding the OnRender method of the formula control and changing the VisualTextRenderingMode of the base to TextRenderingMode.Cleartype or GrayScale. It gets sharper but sometimes (when scaled), it adds excess pixels.

B3zaleel added a commit to B3zaleel/xaml-math that referenced this issue Sep 5, 2018
@B3zaleel
Copy link
Contributor

You could make the following changes in the "WpfMath/Rendering/WpfElementRenderer.cs" file.

public void RenderGlyphRun(Func<double, GlyphRun> scaledGlyphFactory, double x, double y, Brush foreground)
        {
            var glyphRun = scaledGlyphFactory(_scale);
            Pen glyphPen = new Pen(foreground, 1);
            _drawingContext.DrawGeometry(foreground, glyphPen, glyphRun.BuildGeometry());

            //_drawingContext.DrawGlyphRun(foreground, glyphRun);
        }

It has the tendency of being too bold so you'll have to make a lot of small changes to it(the Pen).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants