Well, nowadays they get ready manuscripts from the authors. At least in my community (theoretical high-energy nuclear physics) you send your paper as a LaTeX file + figures (usually pdf's). Then they deform it by transforming it to another format and in the proofs you correct the errors ;-)). I've not yet written a textbook myself yet. I only know from my thesis advisor who once edited a big Lecture Notes in Physics volume. After the book got totally distorted by the editors we ended up to get it printed in color without extra fees, because of a huge delay.