vtgl

terminal emulator implemented in OpenGL
git clone anongit@rnpnr.xyz:vtgl.git
Log | Files | Refs | Feed | LICENSE

Commit: eefea3d75f758700c76af83c46e742684a7e927d
Parent: 2800fa1a5f6cd085e8fee0ac45a1b0967dea22a9
Author: Randy Palamar
Date:   Mon, 21 Oct 2024 10:34:40 -0600

make underline and strike min/max floating point parameters

this generally gives more consistent results when the font size changes

Diffstat:
Mfrag_render.glsl | 8++++----
Mutil.h | 8++++----
Mvtgl.c | 8++++----
3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/frag_render.glsl b/frag_render.glsl @@ -23,11 +23,11 @@ layout(std140, binding = 0) uniform parameters { uint margin_colour; float blink_parameter; - uint strike_min; - uint strike_max; + float strike_min; + float strike_max; - uint underline_min; - uint underline_max; + float underline_min; + float underline_max; }; layout(location = 3) uniform sampler2D u_bitmap_texture; diff --git a/util.h b/util.h @@ -229,11 +229,11 @@ typedef struct { f32 blink_parameter; - u32 strike_min; - u32 strike_max; + f32 strike_min; + f32 strike_max; - u32 underline_min; - u32 underline_max; + f32 underline_min; + f32 underline_max; u32 _pad[2]; } ShaderParameters; diff --git a/vtgl.c b/vtgl.c @@ -789,10 +789,10 @@ do_terminal(Term *t, f32 dt) ShaderParameters *sp = &t->gl.shader_parameters; sp->blink_parameter += 2 * PI * g_blink_speed * dt_for_frame; if (sp->blink_parameter > 2 * PI) sp->blink_parameter -= 2 * PI; - sp->strike_min = (u32)(t->fa.info.baseline + 0.40 * t->fa.info.h); - sp->strike_max = (u32)(t->fa.info.baseline + 0.48 * t->fa.info.h); - sp->underline_min = (u32)(0.94 * t->fa.info.h); - sp->underline_max = t->fa.info.h; + sp->strike_min = (t->fa.info.baseline + 0.40 * t->fa.info.h); + sp->strike_max = (t->fa.info.baseline + 0.48 * t->fa.info.h); + sp->underline_min = (0.89 * t->fa.info.h); + sp->underline_max = (0.96 * t->fa.info.h); glUniform2fv(t->gl.render.vertscale, 1, t->gl.window_size.E);