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