src/osd/sdl/sdlmain.c
| r9587 | r9588 | |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | #ifdef SDLMAME_UNIX |
| 628 | #define POINT_SIZE 144.0 |
| 629 | |
| 628 | 630 | #ifdef SDLMAME_MACOSX |
| 629 | 631 | |
| 630 | 632 | #define EXTRA_HEIGHT 1.0 |
| 631 | 633 | #define EXTRA_WIDTH 1.15 |
| 632 | | #define POINT_SIZE 144.0 |
| 633 | 634 | |
| 634 | 635 | //------------------------------------------------- |
| 635 | 636 | // font_open - attempt to "open" a handle to the |
| r9587 | r9588 | |
| 805 | 806 | bool bold = (name.replace(0, "[B]", "") + name.replace(0, "[b]", "") > 0); |
| 806 | 807 | bool italic = (name.replace(0, "[I]", "") + name.replace(0, "[i]", "") > 0); |
| 807 | 808 | bool underline = (name.replace(0, "[U]", "") + name.replace(0, "[u]", "") > 0); |
| 809 | #if TTF_MAJOR_VERSION >= 2 |
| 810 | #if TTF_PATCHLEVEL >= 10 // SDL_ttf 2.0.9 and earlier does not define TTF_STYLE_STRIKETHROUGH |
| 808 | 811 | bool strike = (name.replace(0, "[S]", "") + name.replace(0, "[s]", "") > 0); |
| 812 | #endif // MAJOR_VERSION |
| 813 | #endif // PATCHLEVEL |
| 809 | 814 | |
| 810 | 815 | // first up, try it as a filename |
| 811 | | font = TTF_OpenFont(name.cstr(), 120); |
| 816 | font = TTF_OpenFont(name.cstr(), POINT_SIZE); |
| 812 | 817 | |
| 813 | 818 | // if that didn't work, crank up the FontConfig database |
| 814 | 819 | if (!font) |
| r9587 | r9588 | |
| 857 | 862 | } |
| 858 | 863 | |
| 859 | 864 | mame_printf_verbose("Matching font: %s\n", val.u.s); |
| 860 | | font = TTF_OpenFont((const char*)val.u.s, 120); |
| 865 | font = TTF_OpenFont((const char*)val.u.s, POINT_SIZE); |
| 861 | 866 | |
| 862 | 867 | if (font) |
| 863 | 868 | { |
| r9587 | r9588 | |
| 891 | 896 | } |
| 892 | 897 | |
| 893 | 898 | mame_printf_verbose("Matching unstyled font: %s\n", val.u.s); |
| 894 | | font = TTF_OpenFont((const char*)val.u.s, 120); |
| 899 | font = TTF_OpenFont((const char*)val.u.s, POINT_SIZE); |
| 895 | 900 | |
| 896 | 901 | if (font) |
| 897 | 902 | { |
| r9587 | r9588 | |
| 918 | 923 | style |= italic ? TTF_STYLE_ITALIC : 0; |
| 919 | 924 | } |
| 920 | 925 | style |= underline ? TTF_STYLE_UNDERLINE : 0; |
| 926 | #if TTF_MAJOR_VERSION >= 2 |
| 927 | #if TTF_PATCHLEVEL >= 10 |
| 921 | 928 | style |= strike ? TTF_STYLE_STRIKETHROUGH : 0; |
| 929 | #endif // MAJOR_VERSION |
| 930 | #endif // PATCHLEVEL |
| 922 | 931 | TTF_SetFontStyle(font, style); |
| 923 | 932 | |
| 924 | 933 | height = TTF_FontLineSkip(font); |
| r9587 | r9588 | |
| 954 | 963 | bitmap_t *bitmap = (bitmap_t *)NULL; |
| 955 | 964 | SDL_Surface *drawsurf; |
| 956 | 965 | SDL_Color fcol = { 0xff, 0xff, 0xff }; |
| 957 | | char ustr[16]; |
| 966 | UINT16 ustr[16]; |
| 958 | 967 | |
| 959 | 968 | ttffont = (TTF_Font *)font; |
| 960 | 969 | |
| 961 | | memset(ustr, 0, sizeof(ustr)); |
| 962 | | utf8_from_uchar(ustr, 1, chnum); |
| 963 | | drawsurf = TTF_RenderUTF8_Solid(ttffont, ustr, fcol); |
| 970 | memset(ustr,0,sizeof(ustr)); |
| 971 | ustr[0] = (UINT16)chnum; |
| 972 | drawsurf = TTF_RenderUNICODE_Solid(ttffont, ustr, fcol); |
| 964 | 973 | |
| 965 | 974 | // was nothing returned? |
| 966 | 975 | if (drawsurf) |