Johnny Depp, Colin Farrell, and Jude Law gave all the income they received for this movie to Heath Ledger's daughter Matilda, so that her economic future would be secure.
After the death of Heath Ledger, production was shut down for a few months. Then it was re-started when Johnny Depp, Jude Law, and Colin Farrell agreed to complete Ledger's role. The film's fantasy premise, and some clever re-writes, let the actors play a man whose appearance changes as he travels between imaginary worlds.
According to Terry Gilliam, the last line Heath Ledger spoke for filming on the set was "Don't shoot the messenger." When Johnny Depp filmed his role after Ledger's death, Depp asked Gilliam if he could try a new ad-lib: "Don't shoot the messenger", unaware that Ledger had improvised an identical line. Gilliam was astounded, remarking, "Heath is still out there. Johnny's channeling Heath somehow. I mean, Shirley MacLaine would love all this."
Heath Ledger was so impressed with Andrew Garfield's audition that he immediately hugged him and said "welcome to the family."