summaryrefslogtreecommitdiff
path: root/src/text.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-05-20 21:36:28 -0700
committerJoe Wilm <joe@jwilm.com>2016-05-20 21:36:28 -0700
commitc70acbac0b721ea2f1b1442898c22aee0f360ef2 (patch)
treea78722cbabb59c59e7dacc02a4c4d05405839dea /src/text.rs
parente794bc11b962adef4d6fbbaeb85344cb138376da (diff)
downloadalacritty-c70acbac0b721ea2f1b1442898c22aee0f360ef2.tar.gz
alacritty-c70acbac0b721ea2f1b1442898c22aee0f360ef2.zip
Correct sub-pixel font rendering with OpenGL
Uses the GL_ARB_blend_func_extended to get single-pass, per-channel alpha blending. gl_generator is now used instead of gl to enable the extension. The background color is removed since that presumably needs to run in a separate pass.
Diffstat (limited to 'src/text.rs')
-rw-r--r--src/text.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/text.rs b/src/text.rs
index ca414342..0eb08606 100644
--- a/src/text.rs
+++ b/src/text.rs
@@ -91,8 +91,10 @@ impl Rasterizer {
let glyph = face.glyph();
glyph.render_glyph(freetype::render_mode::RenderMode::Lcd).unwrap();
- // FIXME need LCD filtering to reduce color fringes with subpixel rendering. The freetype
- // bindings don't currently expose this!
+ unsafe {
+ let ft_lib = self.library.raw();
+ freetype::ffi::FT_Library_SetLcdFilter(ft_lib, freetype::ffi::FT_LCD_FILTER_LIGHT);
+ }
let bitmap = glyph.bitmap();
let buf = bitmap.buffer();