For all but the E in your example you can achieve this fairly straightforwardly by using CSS.
What happens in this snippet is that a background is created which shows enough of the stripes for each type of layout and uses the CSS mask properties to use the text to 'cut out' the background.
body {
background: black;
}
.letters {
font-size: 120px;
font-family: sans-serif, monospaced;
}
.letters>* {
background-size: 100% 100%, 100% 100%;
background-repeat: no-repeat, repeat;
display: inline-block;
width: fit-content;
height: fit-content;
-webkit-mask-image: linear-gradient(black, black);
mask-image: linear-gradient(black, black);
-webkit-mask-clip: text;
mask-clip: text;
color: transparent;
font-weight: bold;
background-image: var(--bg), repeating-linear-gradient(-45deg, black, black 2px, white 2px, white 4px);
}
.halftop {
--bg: linear-gradient(white 0 50%, transparent 50% 100%);
}
.halfright {
--bg: linear-gradient(to left, white 0 50%, transparent 50% 100%)
}
div.twothirds {
--bg: linear-gradient(to left, white 0 33.3333%, transparent 33.3333% 66.6666%, white 66.6666% 100%);
}
.onethird {
--bg: linear-gradient(to left, transparent 0 33.3333%, white 33.3333% 66.6666%, transparent 66.6666% 100%);
}
<body>
<div class="letters">
<div class="halftop">TO</div>
<div class="halfright">S</div>
<div class="twothirds">H</div>
<div class="onethird">H</div>
</div>
</body>
The problem with the E example is that the fonts tend to have ascender/descender space, lineheight not the same as the height of these characters. You would have to find out for the font you are using exactly what the top and bottom 'space' for each character is to have the sort of cutout you want for the E.
So, not a general purpose solution, but interesting to work on.
I suspect you will need to actually draw the characters yourself rather than using a font if total generality is required.