1. Is this a form of defensive or offensive formation?
It is defensive formation, offensive formation is usually arranged in wedge formation, and normally heavy cavalry would be put into the front for crashing enemy's infantry.
The first line of this formation is set up with barriers, that is one evidence of defensive formation. The second line comprises with light crossbowmen which serve as the second barrier, which mean that the opposite side has to arrange their attack in
loose formation. This also give an opportunity to predict that the
rate of attacking from the imaginary adversary would be slow, because if they desire to speed up their frontal attack by cavalry, your formation needs to put pikemen or spearmen at front not crossbowmen.
The frontal area of this formation shows that it may not be finished yet, since small frontal contact and deep ranks will prove fatal if the enemy manage to encircle them.
What I don't really get is the two small group of crossbowmen back behind the first two spearmen formations, it is unlogical. Their position gives no advantage in firing range at all.
While there are cavalry protected the flanks, what happened to the very end units? They were left without protection at flanks and may manoeuvred in the case their enemy manage successfully to encircle them.
If the enemy managed to attack strongly at flanks of this army, what happened. The longitudinal cavalries might hold them back a bit, and then they will be broken, the crossbowmen in front became useless.
To break this formation, the opposite force might divide their armies into two parts, and have many options, they may outflank left or right flanks of this army. But frontal attack is impossible. Anyhow, the frontal defensive of this formation is still strong enough to withstand a heavy attack, but still show its weakness in flanks.