Building a Better SyntaxEditor Text Rendering Engine

by Avatar Bill Henning (Actipro) - 1 comment
Monday, October 2, 2017 at 4:28pm

BlogPostBanner-SyntaxEditor-DevNotes

The past several weeks, we've been prototyping a new core text rendering engine for future use with SyntaxEditor (and possibly other products) that can be used across multiple platforms.  This text rendering API is the same across all supported platforms, which currently are WPF, UWP, and WinForms.  The implementation of that common API is platform-specific behind the scenes since each UI platform supports rendering text in very different ways.

SyntaxEditor would be a consumer of that text rendering API.  By using that text rendering API that is common across platforms, we could consolidate all the SyntaxEditor logic related to text formatting, rendering, and hit testing to be the same.

Platform Benefits

First the UWP version's text rendering implementation in this new engine is lightning fast, and would yield a massive rendering speed increase when merged into the UWP SyntaxEditor, compared to our current way of rendering text in the UWP SyntaxEditor.  It also would be more culture-sensitive with better logic on caret movement, right-to-left text, etc.

The WinForms version's implementation is also fast and compared to the current WinForms SyntaxEditor's way of rendering text, would gain culture sensitivity for caret movement, right-to-left text, etc.  Having a common text rendering API with other platforms would also be a big step in moving the WinForms SyntaxEditor down a path towards using the same general SyntaxEditor API as the other newer UI platforms use.  A future goal is to make this happen so that changes we make to features, add-ons, etc. can flow freely between all the SyntaxEditor platforms.

Finally the WPF version's text rendering is already very fast and culture-sensitive, but there are several logic enhancements we're making to improve speed when rendering long lines.

What's Next

We're still working on everything, but so far, tests in separate projects are very promising for the future of this text rendering API experiment.

Once things are finalized a bit more, we may plug it into one of the platforms like UWP to begin actual usage testing with SyntaxEditor.  This process will take some time since we will have to pull out all the plumbing for the current SyntaxEditor text rendering implementation, and adjust things to work with this new API.  We will give some updates once we make progress on that end.