Bubbles touching transparent glass and coffee

I’m wondering if there might be a technique for creating these bubbles. The Biggest issue is the glass. When the bubbles touch the glass they should be “half” bubbles. I tried manually modeling some once, but I didn’t know how to render them even if I were able to get the model looking right.

This is what the bubbles should look like. Basically soap.

I’d like to also have them look like espresso bubbles as well which would end up being like a rich tan brown color, and very fine bubbles. So my ideal scenario would be to figure out how to create this using something like particles. Maybe I paint some vertex weights or something to decide how many particles to place. But still one of the hardest parts is figuring out how the heck to get the shapes to “cut” with the glass.
Realistically, the bubbles also aren’t round. Tension is created with the neighboring bubble, changing it’s shape to something Somewhat more hexagonal, weighted by how large the neighboring bubble is. But that’s probably a detail that’s worth eliminating.

I just really want to figure out a good way to create amazing looking bubbles that are formed by the meniscus touching the liquid, and the glass. And it needs to be able to be rendered close up.
Something like this. I couldn’t find a view from the other side that looked good up close:

check this one (first 15min), see if technique can be translated to Blender

Well, that’s pretty much how I was thinking about it. However, a solid area of foam is easier than just an edge of foam because that’s less forgiving.
There’s this guy over in the keyshot forum who did something similar, and actually in blender. But he explains how he did it, and there’s a good reason his foam is flowing over the top. No need to create the boolean to cut the bubbles then.
Keyshot post link here

There are some fairly pretty images of his beer, which he modeled in blender. And it’s the same basic idea. Create a volume of foam, punch out a bunch of holes, and manually model some bigger bubbles to sell it. Add a bunch of other details like sweat to distract from the fact that the bubbles don’t actually look right, and there you have it. It works great. BUT, it doesn’t work well for just some bubbles at the edge because there’s not enough going on in the image to distract the viewer from the only real detail.

I was trying to see if anyone had an idea of how to create it with particles and booleans procedurally. I’m still learning what’s possible in blender. But I know enough to know this is Very difficult in any package. Bubbles interacting with eachother with surface tension, so something more like large soap bubbles, is just plain difficult. It would look something more like voronoi, but you need control of density and how sparse a bubble is in 3D space for that to work. This is why dense foam is easier to achieve a believable look. (I think)