Get your 4 digits to be displayed into an array.
Create a software map of digit to segment:
byte fontArray[] = {
0b00111111, // 0 - DP-g-f-e-d-c-b-a
0b00000110, // 1
etc
and
LED segments:
a
f b
g
e c
d DP
Then send the array to 4 daisy chained shift registers:
digitalWrite (latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, fontArray[dataArray[0]]);
shiftOut(dataPin, clockPin, MSBFIRST, fontArray[dataArray[1]]);
shiftOut(dataPin, clockPin, MSBFIRST, fontArray[dataArray[2]]);
shiftOut(dataPin, clockPin, MSBFIRST, fontArray[dataArray[3]]);
digitalWrite (latchPin, HIGH);
I prefer using
SPI.transfer(fontArray[dataArray[0]]);
myself to take advantage of the faster hardware speed.