When rendering text by rasterizing one glyph at a time and copying the bitmaps for each glyph onto a larger bitmap it is quite complicate to copy from the source bitmap to the target bitmap at sub-pixel precision. I was able to improve this by adding a dx parameter which allows setting the sub-pixel x offset when rasterizing a glyph. This way the source bitmap can be copied to the target bitmap at exact pixel offsets. Have a look at the result:
The top line was rendered using the new sub-pixel offset in order to place the glyph at the exact position of the accumulated horizontal advance. The bottom line shows the best effort rendering of the text by rounding the current x position to the nearest whole pixel. Have a look at the 'd' and 'e' in video on the bottom line. These are too close together. Also the 'u' and 'b' in youtube is too far form each other.
When rendering text by rasterizing one glyph at a time and copying the bitmaps for each glyph onto a larger bitmap it is quite complicate to copy from the source bitmap to the target bitmap at sub-pixel precision. I was able to improve this by adding a dx parameter which allows setting the sub-pixel x offset when rasterizing a glyph. This way the source bitmap can be copied to the target bitmap at exact pixel offsets. Have a look at the result:
The top line was rendered using the new sub-pixel offset in order to place the glyph at the exact position of the accumulated horizontal advance. The bottom line shows the best effort rendering of the text by rounding the current x position to the nearest whole pixel. Have a look at the 'd' and 'e' in video on the bottom line. These are too close together. Also the 'u' and 'b' in youtube is too far form each other.