Personally, I would approximate it to a rectangle — combined height of all the blocks being the length; and the longest width block being the breadth ... the centre of the rectangle then, would be the hinge.

Notwithstanding the computational complexity, arriving at a solution for finding the exact visual centre of the polygon formed by the text, for this use case, feels a bit overkill.
Having said that, Mapbox has developed an algorithm for finding the visual centre of a(ny) polygon.
The corresponding library is called polylabel. (so named because the problem they were trying to solve was to find an optimum place — a.k.a. "visual centre" — to place a label inside an irregularly shaped polygon)
However the work remains on your part to calculate the coordinates of the formed polygon, to be passed to polylabel like so:
const polygon = [[x1, y1], [x2, y2], [x3, y3]];
const centre = polylabel([polygon]);
Sai Kishore Komanduri
Engineering an eGovernance Product | Hashnode Alumnus | I love pixel art