Class: RedBird::Font
- Inherits:
-
Data
- Object
- Data
- RedBird::Font
- Defined in:
- ext/red_bird/font.c,
ext/red_bird/font.c
Overview
This class represents a font; it is necessary for rendering any text.
Instance Method Summary collapse
- #initialize(file_path, size) ⇒ Object constructor
Constructor Details
#initialize(file_path, size) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'ext/red_bird/font.c', line 59
VALUE
bird_cFont_initialize(VALUE self, VALUE file_path, VALUE size)
{
struct bird_font_data *ptr;
SafeStringValue(file_path);
RB_INTEGER_TYPE_P(size);
TypedData_Get_Struct(self, struct bird_font_data, &bird_font_type, ptr);
ptr->data = TTF_OpenFont(StringValueCStr(file_path), NUM2INT(size));
if(!ptr->data)
{
rb_raise(rb_eArgError, "failed to load font: %s", TTF_GetError());
}
return self;
}
|