shoes_code shoes_init(SHOES_INIT_ARGS) { #ifdef SHOES_SIGNAL signal(SIGINT, shoes_sigint); signal(SIGQUIT, shoes_sigint); #endif shoes_ruby_embed(); shoes_ruby_init(); shoes_world = shoes_world_alloc(); #ifdef SHOES_WIN32 shoes_world->os.instance = inst; shoes_world->os.style = style; #endif shoes_native_init(); rb_const_set(cShoes, rb_intern("FONTS"), shoes_font_list()); return SHOES_OK; }
VALUE shoes_load_font(const char *filename) { FcConfig *fc = FcConfigGetCurrent(); FcFontSet *fonts = FcFontSetCreate(); if (!FcFileScan(fonts, NULL, NULL, NULL, (const FcChar8 *)filename, FcTrue)) return Qnil; VALUE ary = rb_ary_new(); shoes_make_font_list(fonts, ary); FcFontSetDestroy(fonts); if (!FcConfigAppFontAddFile(fc, (const FcChar8 *)filename)) return Qnil; // refresh the FONTS list shoes_update_fonts(shoes_font_list()); return ary; }