// ----------------------------------------- font_manager_get_from_description ---
texture_font_t *
font_manager_get_from_description( font_manager_t *self,
                                   const char * family,
                                   const float size,
                                   const int bold,
                                   const int italic )
{
    texture_font_t *font;
    char *filename = 0;

    assert( self );

    if( file_exists( family ) )
    {
        filename = strdup( family );
    }
    else
    {
#if defined(_WIN32) || defined(_WIN64)
        fprintf( stderr, "\"font_manager_get_from_description\" not implemented yet.\n" );
        return 0;
#endif
        filename = font_manager_match_description( self, family, size, bold, italic );
        if( !filename )
        {
            fprintf( stderr, "No \"%s (size=%.1f, bold=%d, italic=%d)\" font available.\n",
                     family, size, bold, italic );
            return 0;
        }
    }
    font = font_manager_get_from_filename( self, filename, size );

    free( filename );
    return font;
}
Beispiel #2
0
TextureFont *
font_manager_get_from_description( FontManager *self,
                                   const char * family,
                                   const float size,
                                   const int bold,
                                   const int italic )
{
    assert( self );

    TextureFont *font;
    char *filename = font_manager_match_description( self, family, size, bold, italic );
    // fprintf(stderr, "Matched filename for %s: %s\n", family, filename);
    if( !filename )
    {
        return 0;
    }
    font = font_manager_get_from_filename( self, filename, size );
    free( filename );
    return font;
}