Line formation in magnetic fields