The Foil (head foil) is the device on the forestay with one or two grooves into which the luff cable runs. In our case, it is an aluminum
extrusion. The drum at the bottom permits the foil to be rotated on the forestay cable which is fixed and inside. The tack of the jib
is attached to a shackle on top of the drum. A line wound on the drum is pulled in order to make the foil rotate and wind
up the sail on the foil like a window shade. You can appreciate that the halyard cannot also wrap around the fore stay. For this reason, the head
of the sail is attached below a bearing that allows the sail to wind
up while the halyard does not. Various forces will attempt to make the halyard twist with the foil. Minimizing the distance from the halyard bearing to the halyard block (pulley) minimize this effect. In the photos below, there is also a metal tang on the top of the bearing. The halyard is attached to the top of the tang. At full hoist, the tang fits into a wrap-stop on the stationary halyard cable. An aft facing notch in the wrap-stop prevents rotation of the halyard around the forestay.
You can see the wrap stop on the top of the forestay in the photos. I hope this helps.