Arrange common items to spell out words

Hey I recently asked this on computergraphics.stachexchange.com but then I realized, I bet somebody has done this in processing - so I will copy the question below, it is quite verbose and detailed (maybe overly so) because I had some confusion earlier when someone thought I wanted to rasterize text.

This seems like a pretty easy thing to do, but I’ve never done anything like it and I would rather not reinvent the wheel - so I’m looking for example code in pretty much any language or an algorithm that explains how this is done. If not that a pointer to what I should actually be searching for (computer science theories/Branches that cover this kind of thing) would be appreciated.

Assuming I have a bunch of dark and light common household items, these could be anything really - Teddy Bears, Dominoes, cupcakes whatever laid out in a grid where each cell is a single one of these objects. Obviously when you look at the objects in the grid you can see the details of the object, that is to say you can recognize it is a Teddy Bear if it is a Teddy Bear. I want an algorithm, or code examples in whatever language that shows me how to take the Darker objects and arrange them to spell out words. As a very primitive example of what I mean look at this image https://c8.alamy.com/comp/AX3KY0/red-chili-peppers-spell-out-words-relating-to-their-taste-AX3KY0.jpg where chili peppers have been arranged to spell the word hot. Obviously this is not an exact example of what I want because this takes advantage of the shape of the chili to make the individual strokes of the letters and I expect instead to have the objects the code arranges to be more structured.

So if the letter H where spelled out in Teddy Bears I suppose the H would take 12 cells to draw, the left most vertical stroke of the H to be composed of 3 Dark Teddy Bears, the middle of the H composed of 2 light Teddy Bears above the middle horizontal stroke, the middle horizontal stroke 2 Dark Teddy Bears, and the lower of the middle two Light Teddy Bears again, and then the rightmost vertical stroke would again be 3 Dark Teddy Bears. This way one does not need to do anything clever like rotate the Teddy Bear to make the middle lines.

if i were to assume how such an algorithm would work I would think I have every position in the grid given a number, then every alphanumerical character I want to support having a corresponding Object that describes how the item is positioned to make the strokes of the character. I have the length of the text I want to write I determine if it can be written in the grid and where I have to start to write it, (how?) then I look up first letter T and get move commands do it, move 1 column over get next letter h and do move commands. But that is my probably reinventing the wheel and as you can see I still would need to work out quite a bit more to be able to actually make it work.

another example of people spelling things with common items -

This is not exactly what I want as it assumes an even background whereas I want the words I spell out of everyday items to be mixed in with lighter versions of that item.