To complete my previous post on text rendering in .NET I will present here the pitfalls I encountered migrating HTML Renderer to native GDI text rendering. The final result is ready to use NativeTextRenderer class with simple managed API that can be used for native GDI text rendering.
Continue reading
Category Archives: DevLife
The wonders of text rendering and GDI
My research into text rendering in .NET/Windows started with HTML Renderer, I have noticed text issues in the rendered HTML: fonts were pixelated, letter were too close, words were either too close or too far apart (Figure 1). Although minor issues they were bugging me, also I was hoping it will lead to some performance improvements as from my last optimization session text draw/measure were the most time consuming operations.
The resulted improvement exceeded my wildest expectations and worth a post on.
Continue reading
Multicore JIT starting time optimization
Quick post on a great new feature in .NET 4.5: Multicore JIT.
Inspired by Rick Brewster blog post.
Continue reading
Optimizing images usage in .NET – part 2
Following my previous post, where I investigated the performance impact of loading images in .NET application, I will conclude the discussion with optimization proposals.
Continue reading
Optimizing images usage in .NET – part 1
Using image is an integral part of GUI application but I have found very little resources on it's resource consumption and how I can optimize it. The goal of this post is exactly that, in part 1 I will show the performance impact and in part 2 I will propose an optimization.
I'm going to consider only the memory usage as CPU performance is generally insignificant.
Continue reading
HTML Renderer 1.4.0.0
I'm very happy to release another update for the project, I believe I'm getting very close to remove the 'Beta' tag from it.
This update has many fixes for complex layout and tables to handle much more complex htmls, better support for style sheet loading (see below), context menu, embedded videos and finally fixing the support for preformatted text!
I have dropped support for 'Bridge' object (see below) which can be a breaking change if used, it quite easy to replace it's use with events as can be seen in the demo application. Hopefully this will be the last version that has breaking changes.
For next version (v1.5) I'm planning to rewrite the object model (CssBox monster) and core parsing engine to significantly improve performance, especially the memory allocations that can pretty bad now for large htmls. Of course I will continue to fix bugs and add support for features as requested by the community.
Continue reading
HTML Renderer 1.3.0.0
Sorry for taking so long for this version I have been busy with work.
This version is focused around image and error handling (see below) with more fixes as usual.
The next version, 5-6 weeks, will have many html layout improvements so stay tuned.
Continue reading
Using T4 Templates for caching image resources
In my project I'm doing a lot of native UI rendering1, soon I will blog on why.
Naturally I have many images to render using DrawImage methods, that requires an Image instance.
There are couple of ways to load an image but the best2 and easies option is using a Resource File, just dragging and dropping the images into the resource designer will add the file to the project and generate a nice static property by the name of the file in the static class generated by the name of the resource file.
The problem is that each time image resource property is called a new image instance is created with the requested image, so if the same image is used in multiple places3 it will be loaded multiple times in memory4.
Continue reading
International keyboard layout handling
In the Outlook add-in project I'm working on there is a feature that if the users enters '@' character in the body of mail editor window a dropdown popup will show with some options.
Because this feature is on Outlook window we implemented the feature by capturing keyboard events1 and waiting for "shift + 2" keycode. We check for "shift + 2" because the captured windows keyboard message contains keycode and not the actual character.
In a beta phase an European client reported that this functionality doesn't work, a quick session with the client revealed he used European keyboard layout, something new to me as I used to US keyboard layout.
Continue reading
HTML Renderer 1.2.0.0
I'm happy to release another update to Html Renderer project.
This release is a result of integration of the Html Renderer in actual commercial project with complex html and stylesheet (more than 400 different styles), still not perfect but much closer to WebBrowser control rendering I'm replacing.
My next big step is to add support for images so stay tuned.
Continue reading