Tao.Sdl SDK Documentation

SdlTtf.TTF_SetFontStyle Method 

Set the font style This font style is implemented by modifying the font glyphs, and doesn't reflect any inherent properties of the truetype font file.

[Visual Basic]
Public Shared Sub TTF_SetFontStyle( _
   ByVal font As IntPtr, _
   ByVal style As Integer _
)
[C#]
public static void TTF_SetFontStyle(
   IntPtr font,
   int style
);

Parameters

font
The loaded font to get the style of
style
A bitmask of the desired style composed from the TTF_STYLE_* defined values

Remarks

Set the rendering style of the loaded font.

NOTE: Passing a NULL font into this function will cause a segfault.

NOTE: This will flush the internal cache of previously rendered glyphs, even if there is no change in style, so it may be best to check the current style using TTF_GetFontStyle first.

NOTE: I've seen that combining TTF_STYLE_UNDERLINE with anything can cause a segfault, other combinations may also do this. Some brave soul may find the cause of this and fix it...

Binds to C-function in SDL_ttf.h

            void TTF_SetFontStyle(TTF_Font *font, int style)
            

Example

            // set the loaded font's style to bold italics
                    //TTF_Font *font;
                    TTF_SetFontStyle(font, TTF_STYLE_BOLD|TTF_STYLE_ITALIC);
                    // render some text in bold italics...
                    // set the loaded font's style back to normal
                    TTF_SetFontStyle(font, TTF_STYLE_NORMAL);
            

See Also

SdlTtf Class | Tao.Sdl Namespace | TTF_GetFontStyle