Fix most-likely-to-fail SDL_TTF version check. Added a warning if strikethrough is specified but not supported. [Couriersud]

This commit is contained in:
Couriersud 2010-12-28 23:31:12 +00:00
parent 7ae0a6898e
commit 8bc7fc5f76
2 changed files with 7 additions and 7 deletions

View File

@ -627,10 +627,12 @@ static render_primitive_list &drawsdl_window_get_primitives(sdl_window_info *win
{
sdlwindow_blit_surface_size(window, window->monitor->center_width, window->monitor->center_height);
}
if (!sdl->scale_mode->is_scale)
window->target->set_bounds(window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor));
else
window->target->set_bounds(sdl->hw_scale_width, sdl->hw_scale_height);
return window->target->get_primitives();
}

View File

@ -904,11 +904,7 @@ osd_font sdl_osd_interface::font_open(const char *_name, int &height)
bool bold = (name.replace(0, "[B]", "") + name.replace(0, "[b]", "") > 0);
bool italic = (name.replace(0, "[I]", "") + name.replace(0, "[i]", "") > 0);
bool underline = (name.replace(0, "[U]", "") + name.replace(0, "[u]", "") > 0);
#if TTF_MAJOR_VERSION >= 2
#if TTF_PATCHLEVEL >= 10 // SDL_ttf 2.0.9 and earlier does not define TTF_STYLE_STRIKETHROUGH
bool strike = (name.replace(0, "[S]", "") + name.replace(0, "[s]", "") > 0);
#endif // MAJOR_VERSION
#endif // PATCHLEVEL
// first up, try it as a filename
font = TTF_OpenFont(name.cstr(), POINT_SIZE);
@ -949,10 +945,12 @@ osd_font sdl_osd_interface::font_open(const char *_name, int &height)
style |= italic ? TTF_STYLE_ITALIC : 0;
}
style |= underline ? TTF_STYLE_UNDERLINE : 0;
#if TTF_MAJOR_VERSION >= 2
#if TTF_PATCHLEVEL >= 10
// SDL_ttf 2.0.9 and earlier does not define TTF_STYLE_STRIKETHROUGH
#if SDL_VERSIONNUM(TTF_MAJOR_VERSION, TTF_MINOR_VERSION, TTF_PATCHLEVEL) > SDL_VERSIONNUM(2,0,9)
style |= strike ? TTF_STYLE_STRIKETHROUGH : 0;
#endif // MAJOR_VERSION
#else
if (strike)
mame_printf_warning("Ignoring strikethrough for SDL_TTF with version less 2.0.10\n");
#endif // PATCHLEVEL
TTF_SetFontStyle(font, style);