aboutsummaryrefslogtreecommitdiff
path: root/alacritty/res/text.v.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'alacritty/res/text.v.glsl')
-rw-r--r--alacritty/res/text.v.glsl31
1 files changed, 20 insertions, 11 deletions
diff --git a/alacritty/res/text.v.glsl b/alacritty/res/text.v.glsl
index 0f5fd3f9..31e6f934 100644
--- a/alacritty/res/text.v.glsl
+++ b/alacritty/res/text.v.glsl
@@ -1,18 +1,20 @@
#version 330 core
// Cell properties.
-layout (location = 0) in vec2 gridCoords;
+layout(location = 0) in vec2 gridCoords;
// Glyph properties.
-layout (location = 1) in vec4 glyph;
+layout(location = 1) in vec4 glyph;
// uv mapping.
-layout (location = 2) in vec4 uv;
+layout(location = 2) in vec4 uv;
-// Text foreground rgb packed together with multicolor flag.
-layout (location = 3) in vec4 textColor;
+// Text foreground rgb packed together with cell flags. textColor.a
+// are the bitflags; consult RenderingGlyphFlags in renderer/mod.rs
+// for the possible values.
+layout(location = 3) in vec4 textColor;
// Background color.
-layout (location = 4) in vec4 backgroundColor;
+layout(location = 4) in vec4 backgroundColor;
out vec2 TexCoords;
flat out vec4 fg;
@@ -24,9 +26,9 @@ uniform vec4 projection;
uniform int backgroundPass;
+#define WIDE_CHAR 1
-void main()
-{
+void main() {
vec2 projectionOffset = projection.xy;
vec2 projectionScale = projection.zw;
@@ -39,8 +41,14 @@ void main()
vec2 cellPosition = cellDim * gridCoords;
if (backgroundPass != 0) {
- vec2 finalPosition = cellPosition + cellDim * position;
- gl_Position = vec4(projectionOffset + projectionScale * finalPosition, 0.0, 1.0);
+ vec2 backgroundDim = cellDim;
+ if ((int(textColor.a) & WIDE_CHAR) != 0) {
+ // Update wide char x dimension so it'll cover the following spacer.
+ backgroundDim.x *= 2;
+ }
+ vec2 finalPosition = cellPosition + backgroundDim * position;
+ gl_Position =
+ vec4(projectionOffset + projectionScale * finalPosition, 0.0, 1.0);
TexCoords = vec2(0, 0);
} else {
@@ -49,7 +57,8 @@ void main()
glyphOffset.y = cellDim.y - glyphOffset.y;
vec2 finalPosition = cellPosition + glyphSize * position + glyphOffset;
- gl_Position = vec4(projectionOffset + projectionScale * finalPosition, 0.0, 1.0);
+ gl_Position =
+ vec4(projectionOffset + projectionScale * finalPosition, 0.0, 1.0);
vec2 uvOffset = uv.xy;
vec2 uvSize = uv.zw;