50mm f/1.4 vs 40mm f/2.8 STM
The 50 f/1.4 offers a wider maximum aperture, letting in more light, slightly sharper at f/2.8 than the 40mm at f/2.8 and offers full time manual focus. Really lovely focal length for portraits, especially on a crop sensor camera like a T4i/T5i.
The 40mm f/2.8 STM – tiny, makes the DSLR much more portable, quiet but not silent auto focus during video with smoother movement(most useful if you record audio with an external mic), cheaper and not really noticeably less sharp at f/2.8. Above f/2.8 sharpness is on par with 50 f/1.4. Slightly wider focal length makes the lens a little more versatile.
Buy the 50 f/1.8 (cheapest option) if budget is concern.
Quick illustration of the differences in bokeh between f/2.8 and f/1.4 using the 40mm f/2.8 and the 50mm f/1.4
Mouse Over to see the change (Do not click)