/* call-seq:
* italic = value -> Bool
*
* Set whether italicizing is enabled for this font. Returns the old value.
*/
VALUE rbgm_ttf_setitalic(VALUE self,VALUE italic)
{
TTF_Font *font;
int style;
Data_Get_Struct(self,TTF_Font,font);
style = TTF_GetFontStyle(font);
/* Font is currently italic, and we want it to be not italic. */
if((style & TTF_STYLE_ITALIC) == TTF_STYLE_ITALIC && !italic)
{
TTF_SetFontStyle(font,style^TTF_STYLE_ITALIC);
return Qtrue; /* The old value */
}
/* Font is not currently italic, and we want it to be italic. */
else if(italic)
{
TTF_SetFontStyle(font,style|TTF_STYLE_ITALIC);
return Qfalse; /* The old value */
}
/* No changes were necessary. */
return italic; /* Same as old value */
}