From a996d36047d757ba40b177a76967d29f6da8b295 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sun, 29 Apr 2018 18:39:47 +0530 Subject: [PATCH] Fix FontGetName and FontGetDefaultName in mruby binding --- binding-mruby/font-binding.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/binding-mruby/font-binding.cpp b/binding-mruby/font-binding.cpp index e76a1cd..46da209 100644 --- a/binding-mruby/font-binding.cpp +++ b/binding-mruby/font-binding.cpp @@ -91,8 +91,7 @@ MRB_METHOD(fontInitializeCopy) MRB_METHOD(FontGetName) { - /* FIXME: getName method is missing from Font */ - return mrb_str_new_cstr(mrb, "name"); + return mrb_iv_get(mrb, self, mrb_intern_cstr(mrb, "name")); } MRB_METHOD(FontSetName) @@ -106,6 +105,7 @@ MRB_METHOD(FontSetName) names.push_back(RSTRING_PTR(name)); f->setName(names); + mrb_iv_set(mrb, self, mrb_intern_cstr(mrb, "name"), name); return name; } @@ -142,13 +142,12 @@ DEF_KLASS_PROP(Font, mrb_bool, DefaultItalic, "b", bool) DEF_KLASS_PROP(Font, mrb_bool, DefaultOutline, "b", bool) DEF_KLASS_PROP(Font, mrb_bool, DefaultShadow, "b", bool) -MRB_FUNCTION(FontGetDefaultName) +MRB_METHOD(FontGetDefaultName) { - /* FIXME: getDefaultName method is missing from Font */ - return mrb_str_new_cstr(mrb, "default_name"); + return mrb_iv_get(mrb, self, mrb_intern_cstr(mrb, "default_name")); } -MRB_FUNCTION(FontSetDefaultName) +MRB_METHOD(FontSetDefaultName) { mrb_value nameObj; mrb_get_args(mrb, "S", &nameObj); @@ -157,6 +156,7 @@ MRB_FUNCTION(FontSetDefaultName) names.push_back(RSTRING_PTR(nameObj)); Font::setDefaultName(names, shState->fontState()); + mrb_iv_set(mrb, self, mrb_intern_cstr(mrb, "default_name"), nameObj); return nameObj; }