[cairo] Cairo used in mono libgdiplus CVS

Dave Beckett dave.beckett at bristol.ac.uk
Mon Feb 16 15:12:25 PST 2004


I was looking to see what the Mono libgdiplus in CVS used of the cairo
library and found some distinctly unportable code in src/gdip.h -
#include <cairoint.h>
which won't (shouldn't) be packaged by any cairo packager.

I picked Jordi to CC: on the mono side of things, I'm not sure who's the
best to email.  I appreciate this code is very new and in CVS, unstable.


So I found in the CVS libgdiplus, src/gdip.h:

// NOTE: This file includes some internal cairo definitions to
// avoid to define them again you should have it in your include path
// it is part of the standard cairo development package
#include <cairoint.h>

/* Cairo internal extructures and defines*/
#define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 64.0))
#define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0)
#define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
#define DOUBLE_FROM_16_16(t) ((double)(t) / 65536.0)

...

and libgdiplus needs, at the least, cairo_matrix, cairo_font
and cairo_ft_font_t.

These internals seem to be used for fonts, for example in
src/font.c:

/* Selects a font in Cairo without destroying it*/
cairo_status_t
cairo_select_font_nondestructive (cairo_t *cr,
			cairo_font_t *font)
{
    cr->gstate->font = font;
    return CAIRO_STATUS_SUCCESS;
}

and also (earlier in the file) in gdip_font_create which is rather long
to paste but uses a field inside a cairo internal structure and some
of the defines above.

There is also use in src/graphics.c functions
  _utf8_to_glyphs
  gdip_measure_string_widths
  GdipDrawString
of fields face, face.matrix, base fields of cairo_font/ft_font.

This code probably should be pulled apart and the cairo/libgdiplus
parts separated.  There doesn't seem to be any web-based CVS for mono
that you can browse at.  So start at http://www.go-mono.com/ccvs.html
and cvs -z3 co libgdiplus

Dave




More information about the cairo mailing list