Class: Caca::Font

Inherits:
Object
  • Object
show all
Defined in:
ext/caca/caca-font.c

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# File 'ext/caca/caca-font.c', line 31

static VALUE font_initialize(VALUE self, VALUE name)
{
    caca_font_t *font;

    font = caca_load_font(StringValuePtr(name), 0);
    if(font == NULL)
    {
        rb_raise(rb_eRuntimeError, "%s", strerror(errno));
    }
    _SELF = font;
    return self;
}

Class Method Details

.listObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'ext/caca/caca-font.c', line 44

static VALUE font_list(void)
{
    VALUE ary;
    char const* const* list;

    list = caca_get_font_list();

    ary = rb_ary_new();
    while (*list != NULL)
    {
        rb_ary_push(ary, rb_str_new2(*list));
        list++;
    }

    return ary;
}

Instance Method Details

#blocksObject



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'ext/caca/caca-font.c', line 71

static VALUE get_font_blocks(VALUE self)
{
    VALUE ary;
    uint32_t const *list;

    list = caca_get_font_blocks(_SELF);

    ary = rb_ary_new();
    while (*list != 0L)
    {
        rb_ary_push(ary, ULONG2NUM(*list));
        list++;
    }

    return ary;
}

#heightObject



66
67
68
69
# File 'ext/caca/caca-font.c', line 66

static VALUE get_font_height(VALUE self)
{
    return UINT2NUM(caca_get_font_height(_SELF));
}

#widthObject



61
62
63
64
# File 'ext/caca/caca-font.c', line 61

static VALUE get_font_width(VALUE self)
{
    return UINT2NUM(caca_get_font_width(_SELF));
}