Controlling the needle postion.
On a sewing machine, constant rpms drive the needle and the fabric is fed by the foot under the fabric. The distance of the thread exposed on the surface of the fabric is controlled by the foot movement while the needle is cycling up then back down.
If I understand correctly, you will want to be able to control the length of the stitch to mimic embroidery. Therefore the XY frame will control the fabric leaving the foot to just pinch the fabric during a stitch.
THe problem lies in how to control the cycling of the needle especially if you want long stitches.
One thought is to have a stepper motor drive the needle axis (call it Z). THen have the stepper oscillate back and forth from a zero position (needle up). IN this way, simple XYZ GCode could be used to do the embroidery. Z would always have to be full depth to insert the needle, then full retract to remove, move to next XY, rinse and repeat until done. THis makes it easy to use image to gcode tools - select a color out of an image - convert to gcode - next color - repeat.
On thinking further, I believe a sewing machine will stitch in both directions so you do not need to keep constant direction on the needle drive shaft - it should operate bidirectionally or a single stitch at a time.
Just musing.......