Creating a PDF redux: FMX and OS X in slightly sour disharmony

Not so long ago I posted about how to create a PDF file using the OS X API and a FireMonkey TCanvas. Alas, but little did I know but the hack I used to get a canvas to accept an arbitrary CGContextRef (= HDC for OS X’ers) no longer worked in the soon-to-be released XE3. Oh dear!

Nonetheless, I have now got it to (mostly) work again, and with a couple of IFDEF’s the revised demo should now compile in both XE2 and XE3 (the code is in the same place if you’re interested). I say ‘mostly’, because page 1 of the output (which results from simply asking a TLayout to draw itself and its children) loses the subtle glow effect I added round the title. If you peer closely, you should be able to see what I mean in this screenshot (on the left is the FMX/XE3 application, on the right the outputted PDF open in Preview):

Not a big deal, but still sliiighly disappointing.

As for the hot and bothered simian itself… well, it’s a lot better than its XE2 precursor. If you had the patience to stick with FMX in XE2, you will find upgrading quite a chore though because there has been lots of little interface changes, like the one that bit my PDF demo. Put another way, pretty much *any* hack you felt forced to make in XE2 will need to be either rewritten (because no longer possible) or removed (because the hack is no longer necessary). I really don’t think people should complain about that though – in fact, if anything, *more* interface changes were needed.

By that I mean the refactoring effort for FMX/XE3 hasn’t been completed even on its own terms. For example, the walking-up-the-list disease I blogged about before has been mostly fixed, but there is still the odd example left unfixed – TMainMenu, I’m looking at you! The fact the latter appears in the final part of a unit where cases above it *have* been fixed suggests the development team just ran out of time, though as I said, they did make genuine progress even so.

Advertisements

One thought on “Creating a PDF redux: FMX and OS X in slightly sour disharmony

  1. Pingback: A few XE5-related bits | Delphi Haven

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s