Adding back check for CAIRO 1.8, in rbpangocairo.c

So after some rework I see done in pango, I see Kou had pulled out some
old checks for CAIRO 1.8.

I’m sadly still stuck on RHEL 5, which using Cairo 1.2.4

Before I submitted a pull request I thought I would ask if you even
wanted this change, I can just hang on to the code in my local build
area.

My change that I was going to make, was for rbpangocairo.c, adding the
check back in for rg_s_create() but in a little different manner.

So the rg_s_create() function would look like:

static VALUE
rg_s_create(int argc, VALUE *argv, G_GNUC_UNUSED VALUE klass)
{
#if CAIRO_CHECK_VERSION(1, 8, 0)
VALUE rb_font_type;
PangoFontMap *font_map = NULL;

 rb_scan_args(argc, argv, "01", &rb_font_type);
 if (NIL_P(rb_font_type)) {
     font_map = pango_cairo_font_map_new();
 } else {
     cairo_font_type_t font_type = CAIRO_FONT_TYPE_USER;
     if (rbgutil_key_equal(rb_font_type, "ft") ||
         rbgutil_key_equal(rb_font_type, "freetype")) {
         font_type = CAIRO_FONT_TYPE_FT;
     } else if (rbgutil_key_equal(rb_font_type, "win32")) {
         font_type = CAIRO_FONT_TYPE_WIN32;
     } else if (rbgutil_key_equal(rb_font_type, "quartz")) {
         font_type = CAIRO_FONT_TYPE_QUARTZ;
   } else {
         rb_raise(rb_eArgError,
                  "font type must be one of "
                  ":ft, :freetype, :win32 or :quartz: %s",
                  RBG_INSPECT(rb_font_type));
     }
     font_map = pango_cairo_font_map_new_for_font_type(font_type);
 }

 return GOBJ2RVAL(font_map);

#else
return GOBJ2RVAL(pango_cairo_font_map_new());
#endif
}

Hi,

In [email protected]
“[ruby-gnome2-devel-en] Adding back check for CAIRO 1.8, in
rbpangocairo.c” on Fri, 07 Feb 2014 20:36:28 +0100,
Grant S. [email protected] wrote:

My change that I was going to make, was for rbpangocairo.c, adding the
check back in for rg_s_create() but in a little different manner.

Thanks for your report!

I’ve added PANGO_CHECK_VERSION(1, 18, 0) check instead of
CAIRO_CHECK_VERSION() check. It will solve the problem.

Thanks,

kou

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs