Skip to content

Commit

Permalink
protosynth: improve font readability
Browse files Browse the repository at this point in the history
  • Loading branch information
JoepVanlier committed Apr 21, 2024
1 parent 1e7b885 commit 9111e84
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 13 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,21 @@ global()
);

function txt_blit(str, x, y)
local(ix, row, c_char, src_x, src_y, x_start, xc, yc)
global(gfx_x, gfx_a)
local(ix, row, c_char, src_x, src_y, x_start, xc, yc, old_dest)
global(gfx_dest, gfx_x, gfx_a, bigger_font)
(
bigger_font ? (
old_dest = gfx_dest;
gfx_dest = 15;
gfx_a = 0.7;
) : (
gfx_a = 0.7;
);

ix = 0;
xc = x;
yc = y;

gfx_a = 0.7;
x_start = x;
loop(strlen(str),
c_char = str_getchar(str, ix, 'cu');
Expand All @@ -149,12 +156,20 @@ global(gfx_x, gfx_a)
src_y = 5 * row;
src_x = 5 * (c_char - row * 16);

gfx_blit(12, 1, 0, src_x, src_y, 5, 5, xc, yc, 5, 5, 0, 0);
bigger_font ? (
gfx_blit(14, 1, 0, src_x + src_x, src_y + src_y, 10, 10, xc + xc, yc + yc, 10, 10, 0, 0);
) : (
gfx_blit(12, 1, 0, src_x, src_y, 5, 5, xc, yc, 5, 5, 0, 0);
);
xc += 5;
);
ix += 1;
);

bigger_font ? (
gfx_dest = old_dest;
);

gfx_x = xc;
);

Expand Down Expand Up @@ -694,7 +709,7 @@ global(
mouse_x, mouse_y, mouse_cap, gfx_a,
cap_mode, last_cap, last_mouse_x
hinter.set_hint, info_active,
active_mod,
active_mod, bigger_font,
)
(
_me = me;
Expand Down Expand Up @@ -774,8 +789,16 @@ global(
ix = x + 2;
loop(floor(0.5 * (w - 3)),
(ix - x) <= floor(x_norm * w) ? (
colormodel(color);
active ? (gfx_a = 0.6) : (gfx_a = 0.2)
(color < 2) ? (
colormodel(color);
active ? (gfx_a = 0.6) : (gfx_a = 0.2)
) : (
active ? (
gfx_set(1, 0.2, 0.1, 0.1 + smooth_highlight);
) : (
gfx_set(0.1, 0.1, 0.1, 0.3);
);
);
) : (
gfx_set(0, 0, 0, 0.2);
);
Expand Down Expand Up @@ -843,7 +866,7 @@ global(
this.txt_measure(label);

gfx_set(1, 0.4, 0.3, 0.4);
active ? txt_blit(label, x + 0.5 * w - 0.5 * txt_w, y + 1 + 0.5 * h - 0.5 * txt_h);
active ? txt_blit(label, x + 0.5 * w - 0.5 * txt_w + 0.5 * bigger_font, y + 1 + 0.5 * h - 0.5 * txt_h - 0.5 * bigger_font);
gfx_set(1, 0.2, 0.1, 0.1);
);

Expand Down
26 changes: 21 additions & 5 deletions protosynth/saike_protosynth.jsfx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
desc:Saike Protosynth
options:maxmem=32000000
tags: instrument, synth, generator, synthesizer
version: 0.10
version: 0.11
author: Joep Vanlier
changelog: fix verb buffer sizes for long reverb (prevents some rare noise bursts)
changelog: Improve font readability
license: MIT
provides:
protosynth_dependencies/*
Expand Down Expand Up @@ -1580,6 +1580,7 @@ current_f4_gain += df4_gain;
current_gain += d_gain;

@gfx 1050 768
bigger_font = 1;
(!active_text_input) ? (
char = gfx_getchar();

Expand Down Expand Up @@ -1615,8 +1616,10 @@ global()
//loaded = 0;
!loaded ? (
loaded = gfx_loadimg(12, "./protosynth_dependencies/font.png");
loaded = gfx_loadimg(14, "./protosynth_dependencies/bigfont_caps3.png");
gfx_setimgdim(13, img_w, img_h);
gfx_setimgdim(10, img_w, img_h);
gfx_setimgdim(15, img_w * 2, img_h * 2);

gfx_dest = 10; gfx_mode = 0;
scolor(0); gfx_a = 1.0;
Expand Down Expand Up @@ -1653,6 +1656,13 @@ function reset_color()
gfx_mode = 1;
);

bigger_font ? (
gfx_dest = 15;
gfx_clear = 0;
gfx_set(0, 0, 0, 1);
gfx_rect(0, 0, img_w * 2, img_h * 2);
);

/* Background color */
gfx_dest = 13;
gfx_clear = 0;
Expand Down Expand Up @@ -1846,7 +1856,7 @@ cy += 4;
function node(x, y, w, h, text, text_offset)
instance(_x, _y, _w, _h, x_from, x_to, y_from, y_to, over)
local(mouse_nx, mouse_ny)
global(x_offset, y_offset, blit_scale, mouse_cap, gfx_x, gfx_y, mouse_x, mouse_y, cap_mode)
global(x_offset, y_offset, blit_scale, mouse_cap, gfx_x, gfx_y, mouse_x, mouse_y, cap_mode, bigger_font)
(
gfx_set(0.2, 0.2, 0.3, 1.0);
_x = x; _y = y; _w = w; _h = h;
Expand All @@ -1861,7 +1871,7 @@ global(x_offset, y_offset, blit_scale, mouse_cap, gfx_x, gfx_y, mouse_x, mouse_y
over = ((mouse_nx > x) && (mouse_nx < (x + w)) && (mouse_ny > y) && (mouse_ny < (y + w)) && (cap_mode == 0));

text ? (
txt_blit(text, x + text_offset, y + 2);
txt_blit(text, x + text_offset + 0.5 * bigger_font, y + 2);
);
);

Expand Down Expand Up @@ -2174,7 +2184,7 @@ verb_enable_toggle.simple_serialize_toggle(fx_origin, cy + 1, toggle_size, verb_
verb_enabled = 1 - verb_enabled;
);

txt_blit("REVERB", fx_origin + 8, cy + 2);
txt_blit("VERB", fx_origin + 8, cy + 2);

fb_toggle.simple_serialize_toggle(fx_origin + 45, cy + 1, toggle_size, 1 - low_feedback, "Metallic\n\nAllows longer ringing, but sounds more metallic", "Metallic") ? (
low_feedback = 1 - low_feedback;
Expand Down Expand Up @@ -2326,6 +2336,12 @@ gfx_set(1, 1, 1, 1);
gfx_mode = 4;
gfx_blit(13, blit_scale, 0);


bigger_font ? (
gfx_mode = 5;
gfx_blit(15, 0.5 * blit_scale, 0);
);

last_cap = mouse_cap;
last_mouse_x = mouse_x;
last_mouse_y = mouse_y;
Expand Down

0 comments on commit 9111e84

Please sign in to comment.