GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: a tiny graphical app kit for ruby
Homepage: http://code.whytheluckystiff.net/shoes
Clone URL: git://github.com/why/shoes.git
 * shoes/native/gtk.c: filter out dups in the font list.
 * shoes/world.c: small API for updating the font list, to avoid 
 redundancy on each platform.
why (author)
Mon Oct 06 09:01:27 -0700 2008
commit  64b8d0f6ac27568721d0969190e0180d3e19fd78
tree    7c39fa699b61a9a916f8b5dd5168cd023c2c8747
parent  e99be98d7841b322878eef8f6b1e9bd8d87bcfaa
...
31
32
33
 
34
35
36
...
63
64
65
66
67
68
 
 
69
70
71
72
73
74
75
76
77
78
...
31
32
33
34
35
36
37
...
64
65
66
 
 
 
67
68
69
70
71
72
73
74
 
75
76
77
0
@@ -31,6 +31,7 @@ shoes_make_font_list(FcFontSet *fonts, VALUE ary)
0
     if (FcPatternGet(p, FC_FAMILY, 0, &val) == FcResultMatch)
0
       rb_ary_push(ary, rb_str_new2(val.u.s));
0
   }
0
+ rb_funcall(ary, rb_intern("uniq!"), 0);
0
   rb_funcall(ary, rb_intern("sort!"), 0);
0
   return ary;
0
 }
0
@@ -63,16 +64,14 @@ shoes_load_font(const char *filename)
0
     return Qnil;
0
 
0
   // refresh the FONTS list
0
- rb_funcall(rb_const_get(cShoes, rb_intern("FONTS")), rb_intern("replace"), 1,
0
- shoes_font_list());
0
- return rb_funcall(ary, rb_intern("uniq"), 0);
0
+ shoes_update_fonts(shoes_font_list());
0
+ return ary;
0
 }
0
 
0
 void shoes_native_init()
0
 {
0
   curl_global_init(CURL_GLOBAL_ALL);
0
   gtk_init(NULL, NULL);
0
- rb_const_set(cShoes, rb_intern("FONTS"), shoes_font_list());
0
 }
0
 
0
 void shoes_native_cleanup(shoes_world_t *world)
...
64
65
66
67
 
68
69
70
...
98
99
100
101
102
103
104
...
64
65
66
 
67
68
69
70
...
98
99
100
 
101
102
103
0
@@ -64,7 +64,7 @@ shoes_load_font(const char *filename)
0
   allfonts = shoes_font_list();
0
   oldfonts = rb_const_get(cShoes, rb_intern("FONTS"));
0
   newfonts = rb_funcall(allfonts, rb_intern("-"), 1, oldfonts);
0
- rb_funcall(oldfonts, rb_intern("replace"), 1, allfonts);
0
+ shoes_update_fonts(allfonts);
0
   return newfonts;
0
 }
0
 
0
@@ -98,7 +98,6 @@ void shoes_native_init()
0
   shoes_classex_init();
0
   shoes_world->os.hidden = CreateWindow(SHOES_HIDDENCLS, SHOES_HIDDENCLS, WS_OVERLAPPEDWINDOW,
0
     CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, shoes_world->os.instance, NULL);
0
- rb_const_set(cShoes, rb_intern("FONTS"), shoes_font_list());
0
 }
0
 
0
 void shoes_native_cleanup(shoes_world_t *world)
...
94
95
96
 
97
98
99
 
 
 
 
 
 
100
101
102
...
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
0
@@ -94,9 +94,16 @@ shoes_init(SHOES_INIT_ARGS)
0
   shoes_world->os.style = style;
0
 #endif
0
   shoes_native_init();
0
+ rb_const_set(cShoes, rb_intern("FONTS"), shoes_font_list());
0
   return SHOES_OK;
0
 }
0
 
0
+void
0
+shoes_update_fonts(VALUE ary)
0
+{
0
+ rb_funcall(rb_const_get(cShoes, rb_intern("FONTS")), rb_intern("replace"), 1, ary);
0
+}
0
+
0
 static VALUE
0
 shoes_load_begin(VALUE v)
0
 {
...
39
40
41
 
42
43
44
...
39
40
41
42
43
44
45
0
@@ -39,6 +39,7 @@ extern SHOES_EXTERN shoes_world_t *shoes_world;
0
 //
0
 SHOES_EXTERN shoes_world_t *shoes_world_alloc(void);
0
 SHOES_EXTERN void shoes_world_free(shoes_world_t *);
0
+void shoes_update_fonts(VALUE);
0
 
0
 //
0
 // Shoes

Comments

    No one has commented yet.