I tried using a Raspberry Pi with 14 x L298N Dual H-Bridge Driver Modules to run the electromagnets and it usually works, but there's a lot of wiring involved with the H-Bridge modules, making fault-finding tricky, and I've had a few fail on me already.
If you used lots of small pcb modules with L298's on them then I guess current pulses in ground wires are going to cause a lot of ground bounce, that is the GND voltage on each module is going to spike pretty bad when they switch. Problem is, no current is flowing in the digital signal wires so you can end up in a situation where the Raspberry Pi outputs 0V, and the ground on your L298 module spikes up a few volts, and it ends up with a negative input voltage (relative to its local GND) which could fry it since its maximum rating for input voltage is only -0.3V when going negative.
Also L298 does not include freewheeling diodes, this means you have to add them to drive inductive loads as per datasheet application schematic. Do your modules include these diodes or not? Each module also requires an electrolytic supply decoupling cap if the supply wires are long.
So the solution using modules is quite a mess. Why not make a nice pcb?
Now, there's someone on the internet who already did a project like that and published schematics...
This is similar to the schematic in Kevin White's answer with multiplexing. Each coil needs a dual diode, which might be already included into the digit assembly or not.
This multiplexing requires 4 "column" lines (one per digit) and 7 "row" lines (one per segment).
No need for H-bridges, you can use ULN2803A and its high-side equivalent MIC2981 for driving both polarities.
Now, it may not be cost-effective to multiplex your digits. If the digits are big enough that the four do not fit on the cheap 10x10cm PCB format from the usual Chinese internet suppliers, and you need a larger PCB... and since you get five PCBs for the price of one... then it will be cheaper to make one PCB per digit. In this case I'd just put one MIC2981 and one ULN2803A per board, with the shift registers or I2C IO expanders to drive them, and supply decoupling caps.