Adopting the approach of most movies made about the life of the notorious pleasure seeker, Lasse Hallström’s Casanova isn’t a biography but a free-form embellishment. It treats Casanova as a legend, a symbol—like Zorro. Though he’s celebrated for his sexual conquests in his city—the lush, candied Venice of the mid-18th century—few people actually recognize Casanova (Heath Ledger) on sight, though many claim to. When he stops on the street to watch himself represented in a puppet show, a man observes that the figure on the miniature stage is Casanova to the very life. “I know him well,” the stranger assures Casanova with a canny chuckle.

Hallström has seized on the idea of a man who gains fame in a world before media—that is, a world where no one’s face is famous—and made an intricate farce in which almost everyone is masked. The plot is an ingeniously tangled lark. The doge of Venice (Tim McInnerny) is simpatico with Casanova, but he can save him from being imprisoned for licentiousness only if Casanova marries a respectable woman. So Casanova courts a beautiful maiden who is less proper than she seems.

Then he becomes smitten with Francesca Bruni (Sienna Miller), an outspoken intellectual who is put off by Casanova’s conduct. So he plays a double game and pretends to be Signor Salvato. When the enormous lard magnate Paprizzio (Oliver Platt), to whom Francesca has become engaged sight unseen in order to rescue her family from bankruptcy, comes to town, “Salvato” plays host to him, keeping him at home—ostensibly to help him slim down before he meets his bride—while he switches masks. Claiming now that he is Paprizzio, Casanova courts the firm-willed Francesca by professing to admire her favorite philosopher, Bernardo Guardi. In fact, Francesca herself is Guardi; she’s paid an illiterate drunkard (Philip Davis) to let her use his name for her publications. These charades take on added suspense when Bishop Pucci (Jeremy Irons), the most infamous of the pope’s inquisitors, appears to hunt down Guardi and Casanova, both of whom he considers dangerous heretics.

Jeffrey Hatcher, one of the film’s screenwriters, loves gender-bending and other kinds of mistaken identity, and the script he and Kimberly Simi have concocted (from a story by Simi and Michael Cristofer) keeps finding ways to extend the masque. It would spoil the fun to reveal too much. Let’s just say that there’s a clever 11th-hour rescue and that the filmmakers return to the framing story—Casanova, at the end of his life, completing his memoirs—in a most unexpected manner. And the plot further plays with the mask motif by having the formidable merchant Paprizzio invent advertising, a development that leads directly to the identification of the elusive Casanova.

As Victoria, the fiancée whom Casanova settles on—and the object of the longtime adoration of Francesca’s younger brother Giovanni (Charlie Cox)—Natalie Dormer has the pampered pink-and-gold delicacy of a figure in a Fragonard painting. The movie is stocked with beauty of all types, not just among the women but also in the production design, costumes and the cinematography. The images are superbly composed, and some of them—an embossed gondola lit up by carnival fireworks, a hot air balloon floating up into the inky night sky—are magical.

As Casanova, Ledger is a handsome cipher, but he’s surrounded by players so deft that you hardly notice. Platt and Irons (whose death’s-head face has rarely been used so wittily) are hilarious. As Casanova’s impeccable manservant, Omid Djalili combines finicky propriety with a Sancho Panza–like plainspokenness, a talent for improvisation and a soupçon of lust. Cox is delightful as a young man who trades innocence for experience without altering the wonderstruck look in his eye.

The movie is sexy, gorgeous and as benign as a fairy tale: true love wins out and fate smiles on the courageous and the faithful.