Forum: Ruby-Gnome 2 Adding back check for CAIRO 1.8, in rbpangocairo.c

C53e81f5d7c781c6dc3979c4ce888706?d=identicon&s=25 Grant Schoep (matobinder)
on 2014-02-07 20:36
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
}
Ee6ffca720cc428d70247dcd7377dd48?d=identicon&s=25 Kouhei Sutou (Guest)
on 2014-02-08 05:46
(Received via mailing list)
Hi,

In <6f3aed7505a6eb42e8ec9f400aa4c329@ruby-forum.com>
  "[ruby-gnome2-devel-en] Adding back check for CAIRO 1.8, in
rbpangocairo.c" on Fri, 07 Feb 2014 20:36:28 +0100,
  Grant Schoep <ruby-forum-incoming@andreas-s.net> 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
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.