"Oh what a tangled web we weave,
When first we practise to deceive!"
-- "Marmion," by Sir Walter Scott

Apple (AAPL 0.51%) is living that famed quotation in courtrooms across the world. The company is under legal assault from small-time patent trolls, but it gives as good as it gets -- Cupertino also wages thermonuclear war on Google (GOOGL 1.42%) and its Android allies.

It's all getting very complicated, and Apple is starting to lose more of these courtroom challenges than it wins.

What's going wrong?
Last week, Apple published its court-ordered apology for forcing Samsung's tablets off the British market with a design patent lawsuit that Apple eventually lost. But the mea culpa didn't look apologetic at all. The court slapped Apple and forced the company to try again. One judge bemoaned Apple's "plain breach" of the original order, an observation that comes dangerously close to discussing contempt of court penalties.

Needless to say, Apple posted a much more humble version within 48 hours or that rebuke. And this time, Apple apologized for not apologizing in the first place.

Meanwhile, the U.S. Patent Office rejected all claims of Apple's rubber-banding patent based on an avalanche of prior art. This patent was a key weapon in Apple's $1 billion infringement win over Samsung in this summer's biggest legal spectacle. This invalidation should help Samsung's appeals and calls for mistrial. At the very least, final damages should be reduced.

Across the Atlantic, a Dutch court found Sammy innocent of infringing on Apple's "pinch to zoom" patent. The patent was not invalidated this time, but the ruling contradicts jury verdicts in California and elsewhere. The same patent also failed to trip up Samsung, HTC, and Motorola Mobility in British and German cases earlier this year. It's beginning to look a lot like Android vendors can design around Apple's patent claims.

Speaking of the billion-dollar Californian case, Samsung wants it thrown out because the jury foreman appears to have guided his fellow jurors to a guilty verdict. Moreover, he may have dodged some crucial questions during the jury selection process, hiding a personal vendetta against Seagate Technology (STX). That conflict would make him want to hurt Samsung, because the Korean company is now one of Seagate's largest shareholders and a major business partner. And now Apple refuses to talk about what it knew about the foreman's background, which makes it sound like Cupertino has something to hide.

Far-fetched and crazy, you say? Oh yes, certainly material worthy of a second-rate telenovela at best. But lifelong grudges have started over less.

We're not done yet. Just the other day, Judge Crabb in the Western District of Wisconsin dismissed Apple's suit against Motorola Mobility. This case was Apple's attempt to have the courts set fair and reasonable (and very, very low) royalty rates for Motorola's wireless patents. "Court finds that case can not proceed to trial on remaining issue; case dismissed with prejudice," said the curt court filing.

In other words, feel free to do your own royalty negotiations, Apple -- Judge Crabb won't do it for you.

Leaving Android aside for a moment, data security research firm VirnetX (VHC 3.19%) just scored $368 million in damages from Cupertino. That's pocket change for Apple, but a major victory for VirnetX. Four VirnetX patents allegedly apply to Apple's FaceTime chat app, which now appears across all of Apple's phones, tablets, and even Mac computers.

Verdicts like this one are often overturned on appeal, given this particular Texan court's tendency to find in favor of patent holders. File this under "annoying" for now.

Okay, so what's going right?
This Tuesday, Apple enhanced a different Californian suit against Samsung with some new claims. Specifically, Cupertino wants to add the Jelly Bean version of Google's mobile operating system to a complaint about the Galaxy Note 10.1 tablet.

If Judge Paul Grewal allows it, this would be the first time a core component of Google's own software comes under direct legal fire from Apple. Deceased CEO Steve Jobs may have wanted to crush Android, but Apple has only attacked the platform indirectly so far by filing suits and complaints against the ecosystem of device builders. This looks like a sharp strategy shift. The real fireworks might be about to start.

This lawsuit isn't scheduled for trial until 2014. By then, the specific Samsung tablet under scrutiiny will be very old hat -- but in 2014 Jelly Bean should be the most popular Android version around. Keep an eye on this one, folks.

Oh, one more thing. You know how Apple likes to design tablets and phones in the general shape of flat rectangles with rounded corners? Design patents to that effect have been bandied about in many of the cases discussed above, but the rectangle was always just one of many elements in the patented designs. Apple never actually had a solid patent on exactly this. Until now.

The USPTO just granted a bevy of Apple's design patent applications, including USD669468. The patent shows line drawings of iPad tablets, noting that only the solid lines are part of the patent -- shaded and dotted lines just show context.

The only solid line? A rounded rectangle around the front of the device. Everything else is apparently "ornamental" and not patented. Yep, Apple has in fact patented a geometric shape.

Apple is still on the legal offensive even if some courts raise a disapproving eyebrow at many of Cupertino's claims.