From 18ddf3817454768dfc16d934dcf56784653cc595 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 4 Sep 2021 18:54:32 -0700 Subject: [PATCH] font: set alpha to 0xff in rasterizer Since fonts now use dual source blending, the pixel colors are interpreted as individual alpha channels. The A component should be set to 1.0, so that's what we do here. refs: #1025 --- wezterm-font/src/rasterizer/freetype.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/wezterm-font/src/rasterizer/freetype.rs b/wezterm-font/src/rasterizer/freetype.rs index 0fe9f2d6f..b195ed0a0 100644 --- a/wezterm-font/src/rasterizer/freetype.rs +++ b/wezterm-font/src/rasterizer/freetype.rs @@ -124,7 +124,6 @@ impl FreeTypeRasterizer { let dest_offset = y * width * 4; for x in 0..width { let linear_gray = data[src_offset + x]; - let gray = linear_u8_to_srgb8(linear_gray); // Texture is SRGBA, which in OpenGL means @@ -135,7 +134,7 @@ impl FreeTypeRasterizer { rgba[dest_offset + (x * 4)] = gray; rgba[dest_offset + (x * 4) + 1] = gray; rgba[dest_offset + (x * 4) + 2] = gray; - rgba[dest_offset + (x * 4) + 3] = linear_gray; + rgba[dest_offset + (x * 4) + 3] = 0xff; } } RasterizedGlyph { @@ -165,7 +164,6 @@ impl FreeTypeRasterizer { let red = data[src_offset + (x * 3)]; let green = data[src_offset + (x * 3) + 1]; let blue = data[src_offset + (x * 3) + 2]; - let alpha = red.max(green).max(blue); // Texture is SRGBA, which in OpenGL means // that the RGB values are gamma adjusted @@ -179,7 +177,7 @@ impl FreeTypeRasterizer { rgba[dest_offset + (x * 4)] = red; rgba[dest_offset + (x * 4) + 1] = green; rgba[dest_offset + (x * 4) + 2] = blue; - rgba[dest_offset + (x * 4) + 3] = alpha; + rgba[dest_offset + (x * 4) + 3] = 0xff; } }