[WIP] Fix #109: Implement basic subpixel rendering #377
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change adds subpixel rendering for low DPI displays to improve the quality of the rendered text (important for editors like Onivim 2). The basic strategy is to render the font glyph at 3x resolution, and then use a kernel to sample each color channel individually.
The chosen strategy only works with solid color backgrounds, which is an acceptable trade-off for now (if there is a non-solid color background, we'll fallback to a non-subpixel strategy).
The initial kernel is very simple - sample each channel subpixel against the high-resolution glyph. There's better choices of kernel potentially (that require more texture reads), we can experiment and see what works well.
This fixes #109
TODO:
FT_Render_Mode_LCD
with FreeType, along with various filtersGL_NEAREST
instead ofGL_LINEAR
for sampling? Nope