[cairo] Cairo fails to render under Windows/MSVC

Tristam MacDonald swiftcoder at gmail.com
Sun May 30 06:58:11 PDT 2010


On Sun, May 30, 2010 at 9:04 AM, Jonathan Morton
<jonathan.morton at movial.com> wrote:
> On 29 May 2010 23:41, Tristam MacDonald <swiftcoder at gmail.com> wrote:
>> I have a minimal sample using pango + cairo (attached), copied pretty
>> much verabtim from a pangocairo tutorial on the web.
>>
>> This sample functions perfectly under Linux, writing out a png file
>> containing a coloured and outlined rectangle, and a line of text.
>>
>> However, when compiled on Windows using MSVC, and linking against the
>> pre-built cairo and pango binaries from GTK+, it only renders the
>> background. You can double check this by changing the background color
>> - this always renders out perfectly, but the fill, stroke and text
>> never appear.
>>
>> Any ideas why this might be happening, given that the program compiles
>> and runs without error, and does successfully render the background
>> and output it as a png? I thought my Windows-specific hurdles were
>> over when I managed to get it to compile, but apparently that is not
>> the case...
>
> I don't see any error checking in the code.  Adding some would help
> you to narrow down the cause.  Cairo's standard behaviour when an
> error is encountered is to ignore all drawing commands until the error
> condition is rectified.

At your suggestion, I have added cairo_status() checks throughout the
code, and all return CAIRO_STATUS_SUCCESS.

> My gut feeling is this line:
>
>    desc = pango_font_description_from_string("Arial Bold 12");
>
> ...simply because font handling *will* be different between platforms
> to some extent.
>
>  - Jonathan Morton

Commenting out all of the pango code still leads to the same result,
that the background renders, but not the stroke or fill.

I think my issue probably has to do with a DLL incompatibility between
versions of msvrct.dll, which is mentioned on the GTK site, but not
heavily explained. Perhaps my best option is to try and compile pango
and cairo myself, using MSVC?

-- 
Tristam MacDonald
http://swiftcoder.wordpress.com/


More information about the cairo mailing list